Comments (6)
Thanks for the report! We'll get an update for this and any other changes with recent YARA versions shortly.
from plyara.
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.
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.
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.
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.
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)
- Add Logic Hash Versioning
- Condition parsing fault HOT 2
- Rule rebuild on plyara.utils.rebuild_yara_rule using external variable as a part of loop condition - bug HOT 1
- Improved Comment Handling
- Mistake with terms parsing in condition. HOT 1
- Bug in plyara.utils.detect_dependencies() with rule reference in last condition HOT 4
- Yet another problem with minuses/dashes parsing in condition terms HOT 2
- Unexpected result when parsing imports HOT 2
- Support for new operators introduced in 4.1.0 HOT 3
- clear problem with lot of rules HOT 1
- Looking for New Maintainer HOT 1
- STRING_ESCAPE_CHARS should contain 'r' HOT 3
- [BUG] plyara parses invalid rule
- Add New PLY as Vendor Directory HOT 2
- Codacy: Parser._add_element is too complex (19) HOT 1
- Windows Newlines Need Improved Unit Test HOT 2
- .clear() does not work to reset start_line and stop_line fields HOT 1
- plyara does not recognise base64 keyword HOT 2
- Follow include index files to load all YARA rulesets ? HOT 3
- parse_string() rules construction causes duplicate results when loading multiple rulesets with one Plyara instance HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plyara.