Giter VIP home page Giter VIP logo

Comments (6)

utkonos avatar utkonos commented on June 14, 2024

Thanks for the report! We'll get an update for this and any other changes with recent YARA versions shortly.

from plyara.

utkonos avatar utkonos commented on June 14, 2024

I'm not sure of an easy change to support this new format for xor string operator. This change requires rewriting how string operators are parsed.

from plyara.

malwarefrank avatar malwarefrank commented on June 14, 2024

I am not an expert in lexers and parsers, so this may be wrong, but give this a try: malwarefrank@42a9ead

If that works, then I can create a test and submit a PR

from plyara.

malvidin avatar malvidin commented on June 14, 2024

I took what @malwarefrank had, and added more to it.
malvidin@0fcf46b

All of the following are all legitimate XOR modifiers. The first is already handled, and the second one appears to be handled by @malwarefrank's modification.

xor
xor(0x01-0xFA)

xor(0x01)
xor(1)
xor(1-250)
xor(000001-00000250)
xor(0x01-00000250)
xor(000001-0xFF)

This requires all of the following, unless the xor_mod is created as a new token. I didn't see a way to create a single byte hex/int token that didn't cause extraction issues with the NUM and HEXNUM tokens.

                           | XOR_MOD LPAREN NUM RPAREN
                           | XOR_MOD LPAREN NUM HYPHEN NUM RPAREN
                           | XOR_MOD LPAREN HEXNUM RPAREN
                           | XOR_MOD LPAREN HEXNUM HYPHEN HEXNUM RPAREN
                           | XOR_MOD LPAREN NUM HYPHEN HEXNUM RPAREN
                           | XOR_MOD LPAREN HEXNUM HYPHEN NUM RPAREN

I recommend adding a way to determine which version of YARA that plyara can parse, so that accepting the modified XOR won't impact use with versions before YARA 3.11.0.

I did not add anything yet to rebuild_yara_rule to recreate string modifiers with parameters, or checks for YARA >= 3.11.0 version compatibility.

from plyara.

malvidin avatar malvidin commented on June 14, 2024

I've made additional modifications here malvidin@35b9b5d
, but there are still enhancements that could be made.

@malwarefrank, does my current commit meet your current needs?

  • Recommend imports being made before use
  • Ensure all named and anonymous strings are referenced
  • Parse conditions in a way that ensures logical validity
  • Version compatibility checks for conditions & iteration

The reason I brought back the rebuild_yara_rule utility is due to the use by CCCS-Yara
https://github.com/CybercentreCanada/CCCS-Yara/blob/master/yara-validator/yara_validator.py#L414

from plyara.

tlansec avatar tlansec commented on June 14, 2024

Hi,

I'd just like to add a ++ for considerations on rebuild_yara_rule i think most plyara users will want to rebuild a rule from the parsed rule (otherwise why not just check it compiles with yara itself?).

Thanks,
Tom

from plyara.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.