-
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
Modsecurity v3 : nginx POST data not printed into auditlog #2529
Comments
Hi @cello86, I'm not completely clear on the problem you are outlining. From your first sentence, it sounded like you were talking about an overall issue with section 'C' output not appearing in the audit log, but from the later pasted content it sounds like you are talking about only an error-page redirection scenario. I have just checked and section C output is generally available in v3.0.3. You are using older versions of both ModSecurity and the nginx connector. There are important fixes related to both logging and error-page redirects in more recent versions of both. My main suggestion would be to upgrade to v3.0.4 and v1.0.1 respectively. |
Hi @martinhsv, Marcello |
So, are you saying you are re-reporting the issue owasp-modsecurity/ModSecurity-nginx#176 that was closed as a duplicate? |
No there are two different issues. Into the nginx-connector 1.0.1 whole audit log didn't work and in this issue with the nginx-connector the C part doesn't work. |
Did you try using v1.0.1 of the connector with the fix owasp-modsecurity/ModSecurity-nginx#175 as suggested by @victorhora here: owasp-modsecurity/ModSecurity-nginx#176 ? |
I tried to replicate all the scenarion and I started with:
Scenario 1.Nginx basic configuration Curl result
Audit log
Scenario 2Nginx configuration with custom error page and fix reported to issue owasp-modsecurity/ModSecurity-nginx#76.
Curl result
Audit log
|
I tried to replicate all the scenarion and I started with:
Scenario 1.Nginx basic configuration Curl result
Audit log
Scenario 2Nginx configuration with custom error page and fix reported to issue owasp-modsecurity/ModSecurity-nginx#76.
Curl result
Audit log |
I tried to replicate all the scenarion and I started with:
Scenario 1.Nginx basic configuration Curl result
Audit log
Scenario 2Nginx configuration with custom error page and fix reported to issue owasp-modsecurity/ModSecurity-nginx#76.
Curl result
Audit log
The issue on versions 1.0.0 and 1.0.1 seems to be related to owasp-modsecurity/ModSecurity-nginx#182. Marcello |
Can you provide more of your configuration?
Content from debug log could also be helpful (at level 9). One thing in particular,is that the debug log should show the parts that are configured to report (and I suspect that it is not what you think you have configured). |
This is the configuration used:
|
Thanks for the additional detail. It looks like I am able to reproduce what you have reported -- even using v3.0.4 and the current version of the connector. I will take a closer look. |
As background, keep in mind that error redirects effectively create a second transaction. I.e. ModSecurity sees the original POST transaction and successfully parses the request body and triggers on any rules that examine these. The error redirect creates a second transaction that ModSecurity also sees. In your configuration, when processing the second transaction (the one processed within the 404_json location block), the request body is never processed. That is why there is no section 'C' output. I suspect that this may be expected behaviour given the way that you have configured the response to come directly from the configuration. In any case, I believe you can achieve the functionality you are looking for a couple of different ways. Perhaps the simplest is to actually create a 403.json file with your desired content, and then use configuration something like this:
|
Hi @martinhsv,
|
We tried to configure the logging of Request Body for blocked request via Nginx + modsecurity v3 but don't have the printed options H and C. The config of SecAuditLogParts is ABCIJDEFHZ and we noticed that this rule doesn't print the action options (suggested info owasp-modsecurity/ModSecurity-nginx#76).
Logs and dumps
N/A
Server (please complete the following information):
Rule Set (please complete the following information):
The text was updated successfully, but these errors were encountered: