8000 fix: match non-word-boundary of commands with options by theseion · Pull Request #3425 · coreruleset/coreruleset · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: match non-word-boundary of commands with options #3425

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

Merged
merged 2 commits into from
Jan 5, 2024

Conversation

theseion
Copy link
Contributor

Unix commands such as dig require options or they won't run. dig uses the @ anti-evasion pattern (e.g., for 932237). For a command such as dig --help, the final word boundary (\b) in 932237 actually prevents a match. The @ causes dig to be matched, but the word boundary will not match because both the space character and the dash character are in \W (for \b to match, one of them would have to be in \w).

This commit modifies the final word boundary of 932237 to (?:\b|\W), in order to fix this.
Note that the final expression must work for commands without options, commands with options (@) and for command prefixes (~, e.g., gcc or pip).

Fixes #3401

Unix commands such as `dig` require options or they won't run. `dig`
uses the `@` anti-evasion pattern (e.g., for 932237). For a command such
as `dig --help`, the final word boundary (`\b`) in 932237 actually
prevents a match. The `@` causes `dig ` to be matched, but the word
boundary will not match because both the space character and the dash
character are in `\W` (for `\b` to match, one of them would have to be
in `\w`).

This commit modifies the final word boundary of 932237 to `(?:\b|\W)`, in
order to fix this.
Note that the final expression must work for commands without options,
commands with options (`@`) and for command prefixes (`~`, e.g., `gcc`
or `pip`).

Fixes coreruleset#3401
Copy link
Member
@fzipi fzipi left a comment

Choose a reason for hiding this comment

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

LGTM.

@dune73
Copy link
Member
dune73 commented Jan 5, 2024

@EsadCetiner: Since you discovered this issue, can we have your feedback before we merge this?

Copy link
Member
@EsadCetiner EsadCetiner left a comment

Choose a reason for hiding this comment

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

LGTM

@dune73 dune73 merged commit f34c868 into coreruleset:v4.0/dev Jan 5, 2024
@theseion theseion deleted the 3401-fix-word-boundary-issue branch January 5, 2024 19:19
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.

Problematic word boundary match in 932* rules
4 participants
0