-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Macro expansion inside regex does not work in ModSecurity V3 #1528
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
Comments
asterite3
added a commit
to seclab-msu/ModSecurity
that referenced
this issue
Aug 19, 2017
try to use macro expansion on @rx argument before matching. If after expansion argument changed, make new Regex from the macro-expanded argument and use that for matching. Fixes owasp-modsecurity#1528
Fixed at fa7973a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Documentation on macro expansion says (https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#macro-expansion):
You can use macro expansion for operators that are "compiled" such @rx, etc. however you will have some impact in efficiency.
.In V3, macro expansion in regexes is not performed and operator
"@rx ^%{var}$"
will match data against literal^%{var}$
.The following code can be used for demonstration:
With following
test.conf
:It won't produce expected alert because modsec will match
param
against literal^%{tx.bad_value}$
instead of^%attack$
.This breaks OWASP CRS rule
920420
which uses macro expansion of variabletx.allowed_request_content_type
(this part of the rule will fire for any request because negated operator is used):The text was updated successfully, but these errors were encountered: