-
-
Notifications
You must be signed in to change notification settings - Fork 402
fix 933180 regex #2303
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
fix 933180 regex #2303
Changes from all commits
afa49ce
f4b89aa
9f1126b
60f8ae2
d748448
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -436,12 +436,12 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_H | |
# \(.*\) | ||
# Parentheses optionally containing function parameters | ||
# | ||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/* "@rx \$+(?:[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|\s*{.+})(?:\s|\[.+\]|{.+}|/\*.*\*/|//.*|#.*)*\(.*\)" \ | ||
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/* "@rx \$+(?:[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|{.+}).*\(.*\)" \ | ||
"id:933180,\ | ||
phase:2,\ | ||
block,\ | ||
capture,\ | ||
t:none,\ | ||
t:none,t:compressWhitespace,t:removeWhitespace,t:removeCommentsChar,\ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's not clear on modsec documentation if removeWhitespace removes also \n. we do know that compressWhitespace replace \n with a space \x20 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I wondered about that too :/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if this will be helpful anymore, but maybe it will be 😄
|
||
msg:'PHP Injection Attack: Variable Function Call Found',\ | ||
logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\ | ||
tag:'application-multi',\ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the comment markers forces you to match
.*
instead of(?:\[.+\]|{.+}|/\*.*\*/|//.*|#.*)
(notice that I removed the\s
from that expression). Does that really make sense? Yes, backtracking is better but the regex becomes much more open and prone to FPs. In combination with the removal of spaces you can easily produce FPS:iget10$anhour(no,idon'tgetpaidforovertime)
. Besides, the regex is vulnerable to DOSing anyway.I would compress spaces but not remove them, then you can match against single spaces at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uhm why? @airween checked it but no redos were found anymore
yep, I can try to fix it without removing whitespace. I'm going to send a new version tnx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. I had made a mistake when copying around different versions. Your version is fine.