-
Notifications
You must be signed in to change notification settings - Fork 305
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
Modsecurity response rules not working! - response body won't process! #311
Comments
I have patched this issue and submitted the pull request #307 |
Thanks for your respond,
I also reload openresty but it didn't change anything!!!! |
can you share : modsecurity.conf and debug? |
I did a test with same config as you and looks there is an error in your add_ruleset: Acordding to "https://github.com/p0pr0ck5/lua-resty-waf#lua-resty-wafload_secrules" Note that this still requires the ruleset to be added via add_ruleset (the basename of the file must be given as the key). So I did a test as:
Where I get a 200 OK But with:
I get a 500 Below debug
So my guess is your 200 is caused by your config:
However even fixing this it result in 500 as error code. |
some extra tests:
|
I haven't any error in debug! The response won't process even without loading modsecurity.conf, anyway :
I did this in first place, but I got this error in debug :
I got the best answer with this configuration format : |
This issue occurs without loading modsecurity.conf too! It doesn't depend on this! There isn't any error in debug. Everything works fine and all request rules work perfect! The issue comes when we need to process response! |
I've continue testing your config and it complains on debug for crs-setup.conf as shown below
Once it is loaded with default config inside "SecDefaultAction" it fails, so Lua can't continue and shows: *2018/10/22 22:48:46 [error] 10537#10537: 3 lua entry thread aborted: runtime error: /usr/local/openresty/site/lualib/resty/waf.lua:524: could not find REQUEST-901-INITIALIZATION.conf Some help is needed at this point.. |
Thanks for your time, but I think your tests are changing the subject! |
try with this:
|
Hey nimafia If you notice the Nginx+ ModSec Waf also doesn't use the response header rules. I took part in a webinar with the Nginx sales engineers where one of the topics was ModSec performance on Nginx+ and opensource, so I queried this specifically. He confirmed that Nginx has issues with ModSec OWASPresponse rules currently and it doesn't work, the Nginx team are 'working' to fix this. Perhaps this is the issue? |
Hi Jeff |
I can only report what he said. We were talking about 1.15.8, but I believe I have a recording if you would like? It was a very generic answer. |
Recording would be helpful, it might clarify some ambiguities! |
https://www.nginx.com/resources/webinars/tls-1-3-new-features-nginx-plus-r17-nginx-open-source/ You can register there, my colleage did make a screencast but probably just as easy to sign up. (also the modsec section included nothing of worth, so just skip to the questions at the end - I specifically asked about response rules being excluded from their rollout of Nginx Waf) |
@GumpSun please don't hijack someone else's issue; please open your own. Thanks! |
@p0pr0ck5 any update on this issue ? -- Also you can see the user is trying to get the RESPONSE_BODY in the reverse proxy mode , may be i am wrong , waf is running only in the access phase , so it wont get response body? |
@nimafia body_filter_by_lua should be put below the proxy_pass. Same with header_filter_by_lua. But seems collections.lua would still need a small fix. |
@p0pr0ck5 Do you still accept PRs? Or too busy and not interested anymore? :-) |
Hello
I'm using lua-resty-waf with latest modsecurity crs rules only. But recently I realized that my response rules not working at all! It seems response body won't process! I tested this in reverse proxy mode. The rule exist but doesn't work. Can you please help me on this? Is it a source code issue?
nginx.conf :
server.conf :
Example scenario :
Request :
http://dvwa.com/vulnerabilities/sqli/?id=33%27&Submit=Submit#
request headers :
response :
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''33''' at line 1
response headers :
mod security rule for the attack :
Rule 951230 should deny the request by processing the response body but it doesn't do anything! Attack will done successfully!
I look forward for your respond! Thanks...
Regards,
The text was updated successfully, but these errors were encountered: