Skip to content
New issue

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

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

Already on GitHub? # to your account

matching: multi match support #331

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

securitym0nkey
Copy link

Make sure these boxes are signed before submitting your Pull Request
-- thank you.

This is an implementation of redmine 2509

Describe changes:

This is a resubmit of pr #37. After reworking to fit the 2023 code base.

It adds support to specify multiple conditions to match a rule.

Syntax:
multi:<match_condition1>;<match_condition2>;...<match_conditionN>;

Examples:
Match all rules including the term "nmap" but just from the "emerging-scan.rules" file.
multi:filename:rule/emerging-scan.rules; re:nmap;

Match all rules with a recent cve reference and a perimeter deployment
multi:re:cve-202[23];metadata: deployment perimeter;

This adds support to specify multiple conditions to match a rule.

Syntax:
multi:<match_condition1>;<match_condition2>;...<match_conditionN>;

Examples:
Match all rules including the term "nmap" but just from the "emerging-scan.rules" file.
multi:filename:rule/emerging-scan.rules; re:nmap;

Match all rules with a recent cve reference and a perimeter deployment
multi:re:cve-202[23];metadata: deployment perimeter;

Ticket: #2509
@securitym0nkey securitym0nkey requested a review from jasonish as a code owner July 31, 2023 12:56
@jasonish
Copy link
Member

jasonish commented Jan 9, 2025

Sorry for taking so long to get to this. One issue I have is not all valid regex's are supported. For example:

re: sid:\s*2100498;\s*rev:7;

works...

but:

multi: re: sid:\s*2100498;\s*rev:7;

appears to work, but actually fails to properly load as it will only take up to the ;, then silently fail to load the remainder. So I think that would need to be addressed with some test cases.

Copy link
Member

@jasonish jasonish left a comment

Choose a reason for hiding this comment

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants