-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Access log include double quote at the user-agent field #1453
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
Hi @Pjack, Is this the nginx log or the audit log? For the auditlogs you can use straight the JSON. If that is on nginx logs, we may have a bug. |
Hi @zimmerle , It is the index of audit log, sorry that I did not use precise wording. The log is generated by std::string Transaction::toOldAuditLogFormatIndex We hopes to parse it into Elasticsearch server. Thanks! |
@Pjack Can you confirm if the issue also happens if you enable JSON audit logs? (SecAuditLogFormat) |
Hi @victorhora , SecAuditLogFormat is invalid in v3. SecAuditEngine RelevantOnly Transaction::toOldAuditLogFormatIndex is only invoked under parallel mode. |
Ah right you're using v3 @Pjack ! My bad :) Well, afaik, the only way I can think of now to avoid plain double quotes for going to the logs would be using the sanitize directives but I'm not sure if it would work well for you and these aren't currently implemented on v3 so this might be needed to be implemented as a new feature altogether. Unless I'm missing something and someone else comes up with a better idea :) |
Hi @victorhora , Sorry that I don't know what is sanitize directive that I can't answer you. Thanks for your response and please consider to implement it in near future. |
Support for AuditLogFormat was added as of 63bef3d. Enabling JSON audit logging should solve this issue. |
Hi
I use some tool to do penetration test and see if modsecurity v3 will block the request successful.
In some testing case, user-agent includes double-quote in it, ie:
int2.diamond.trendmicro.com 118.163.170.73 - - [24/May/2017:07:38:35 +0000] "POST /api/v1/logs/ HTTP/1.1" 403 0- "'"<script>alert(1);</script>" 14956115151.000000 - /var/log/modsec/20170524/20170524-0738/20170524-073835-14956115151.000000 0 9454.000000 md5:d87287f684b5e55193b7402d421835bd
Modsecurity blocked the request succesfully, however, it will output the origin user-agent string into the access log too.
It cause our log parser (fluentd + elastisearch) failed in this case, and we don't have good solution for it.
I would like to support libmodsecurity can convert the double-quote as \x22 , so does other character between 0x7F-0x1F. I see this idea in nginx's access log.
https://serverfault.com/questions/584881/parseable-nginx-accesslog-files-with-delimiters
Thanks!
The text was updated successfully, but these errors were encountered: