Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discard partial or expressions #190

Merged
merged 1 commit into from
May 19, 2020

Conversation

nazywam
Copy link
Member

@nazywam nazywam commented May 19, 2020

Your checklist for this pull request

  • I've read the contributing guideline.
  • I've tested my changes by building and running mquery, and testing changed functionality (if applicable)
  • I've added automated tests for my change (if applicable, optional)
  • I've updated documentation to reflect my change (if applicable)

What is the current behaviour?
Yara "or" expressions that have one of the two branches rejected (due to lack of query support) are still passed to the ursa engine resulting in possible false negativies (which is a big no no for us)

The included test case should explain this pretty clearly:

rule or_corner_case
{
    meta:
        description = "description"
        date = "2020-05-19"
    strings:
        $a = "this is a legit string"
        $b = /[a-f]{10}/
    condition:
        $a or $b
}

Will result in a "this is a legit string" ursa query, which can lead to matching files being dropped.

What is the new behaviour?
All partially-converted "or" expressions are dropped

Test plan
Run lib/yaraparse.py on the included test file

Closing issues

fixes #issuenumber

@nazywam nazywam added the type:bug Something isn't working label May 19, 2020
@nazywam nazywam requested a review from msm-code May 19, 2020 12:55
@nazywam
Copy link
Member Author

nazywam commented May 19, 2020

(venv) ➜  src git:(master) ✗ python lib/yaraparse.py /tmp/or_corner_case.yar                                                                                                                               14:54:57
or_corner_case {746869732069732061206c6567697420737472696e67}
(venv) ➜  src git:(master) ✗ git checkout bugfix/or-expressions                                                                                                                                            14:55:01
M	ursadb
Switched to branch 'bugfix/or-expressions'
(venv) ➜  src git:(bugfix/or-expressions) ✗ python lib/yaraparse.py /tmp/or_corner_case.yar                                                                                                                14:55:18
or_corner_case {}

@nazywam nazywam removed the type:bug Something isn't working label May 19, 2020
Copy link
Contributor

@msm-code msm-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦭

Perfectly, bugfix just after a release.

@msm-code msm-code merged commit 770f083 into CERT-Polska:master May 19, 2020
KWMORALE pushed a commit to KWMORALE/mquery that referenced this pull request Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants