-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Escape double quotation mark character in non-regex operator #3252
Comments
Hi @capy3ra, thanks for reporting. After a quick scan, I can say that this is - unfortunately - a bug. But let me double check this in detail. |
If you find out how to fix this or escape in another way, Ping me pls |
I could review the issue in detail, and seems like this is an old and already reported bug - see #2148. I discovered this unexpected behavior more than 5 years ago, but the problem is in the engine's parser, which is very sensitive and critical area. There I explained the root cause of the problem and there is a solution - put the rule in the web server's config not to an included file, eg in
(and please do not forget to add a More explanation - here is how looks like the operand ( Breakpoint 1, modsecurity::operators::StrEq::evaluate (this=0x560536130e00, transaction=0x5605360bb520, str="not \"redirect\" to") at operators/str_eq.cc:25
25 return !pt.compare(str);
(gdb) p pt
$1 = "not \\\"redirect\\\" to"
(gdb) p str
$2 = "not \"redirect\" to" As you can see, the engine do not strips the It seems that a solution to this problem should be taken... |
Your solution not work with me.
And error log returned:
|
Ah, sorry - you are right. Unfortunately the parser does not allow this syntax. You still need to add double escape in this case, like:
A possible bypass is that you use a trick: put a transformation and the transformed pattern, like:
but you have to inspect possible security reasons, eg. double encoded argument... |
Currently, am using Nginx + ModSecurity v3.
I want to create a rule that filters double quotation mark characters using a non-regex operator.
Pattern:
not "redirect" to
I write the rule below:
But it not working as I hope
The text was updated successfully, but these errors were encountered: