ModSecurity: Apache-Error: [file "apache2_util.c"]
Hello Guys!
I install crs from github and update debian from 8 to 9. I have next software version:
Apache 2.4.25
ModSecurity 2.9.1
CRS 3.0.2
And after update(ModSecurity 2.8.0 -> ModSecurity 2.9.1) I see next string in every ModSecurity log line.
Apache-Error: [file "apache2_util.c"] [line 273] [level 3] [client %s] ModSecurity: %s%s [uri "%s"]%s
audit.log
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0
HTTP/1.1 403 Forbidden
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: ru,en-US;q=0.7,en;q=0.3
Content-Length: 301
Accept-Encoding: gzip, deflate, br
Message: Warning. Matched phrase "../" at REQUEST_URI. [file "/etc/apache2/modsecurity.d/owasp-modsecurity-crs/rules/REQUEST-930-APPLICATION-ATTACK-LFI.conf"] [line "77"] [id "930110"] [rev "1"] [msg "Path Traversal Attack (/../)"] [data "Matched Data: ../ found within REQUEST_URI: /search?utf8=\xe2\x9c\x93&q=..//..//../../12312312312312312312"] [severity "CRITICAL"] [ver "OWASP_CRS/3.0.0"] [maturity "9"] [accuracy "7"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-lfi"] [tag "OWASP_CRS/WEB_ATTACK/DIR_TRAVERSAL"]
Message: Access denied with code 403 (phase 2). Operator GE matched 5 at TX:anomaly_score. [file "/etc/apache2/modsecurity.d/owasp-modsecurity-crs/rules/REQUEST-949-BLOCKING-EVALUATION.conf"] [line "57"] [id "949110"] [msg "Inbound Anomaly Score Exceeded (Total Score: 15)"] [severity "CRITICAL"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-generic"]
Message: Warning. Operator GE matched 5 at TX:inbound_anomaly_score. [file "/etc/apache2/modsecurity.d/owasp-modsecurity-crs/rules/RESPONSE-980-CORRELATION.conf"] [line "73"] [id "980130"] [msg "Inbound Anomaly Score Exceeded (Total Inbound Score: 15 - SQLI=0,XSS=0,RFI=0,LFI=15,RCE=0,PHPI=0,HTTP=0,SESS=0): Path Traversal Attack (/../)"] [tag "event-correlation"]
Apache-Error: [file "apache2_util.c"] [line 273] [level 3] [client %s] ModSecurity: %s%s [uri "%s"]%s
Apache-Error: [file "apache2_util.c"] [line 273] [level 3] [client %s] ModSecurity: %s%s [uri "%s"]%s
Apache-Error: [file "apache2_util.c"] [line 273] [level 3] [client %s] ModSecurity: %s%s [uri "%s"]%s
Apache-Error: [file "apache2_util.c"] [line 273] [level 3] [client %s] ModSecurity: %s%s [uri "%s"]%s
Apache-Error: [file "apache2_util.c"] [line 273] [level 3] [client %s] ModSecurity: %s%s [uri "%s"]%s
Action: Intercepted (phase 2)
Apache-Handler: proxy-server
Stopwatch: 1497945553089390 44896 (- - -)
Stopwatch2: 1497945553089390 44896; combined=40604, p1=408, p2=40101, p3=0, p4=0, p5=95, sr=32, sw=0, l=0, gc=0
Response-Body-Transformed: Dechunked
Producer: ModSecurity for Apache/2.9.1 (http://www.modsecurity.org/); OWASP_CRS/3.0.2
.
Server: Apache/2.4.25 (Debian)
Engine-Mode: "ENABLED"
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 23 (9 by maintainers)
Hi Victor. All my packages are uploaded to Debian’s repositories. I’m also de maintainer of CRS. 😃
Hiya. I’ll build an updated package and upload it to sid ASAP. Once it gets into testing I’ll upload to backports.
Hi @ossie-git,
I was reviewing the code and specs I remembered that the “Apache-Error” message on the auditlogs is actually normal behaviour.
If you look at msc_logging.c you can see that the Apache-Error header is always added as part of Audit Log every time a log entry is sent to Apache error_log.
This is also written on to the ModSecurity Data Formats reference “The Apache-Error header contains Apache error log messages observed by ModSecurity, excluding those sent by ModSecurity itself”
So if you really don’t want the “Apache-Error” message showing on your audit logs you can either omit the “H” from the SecAuditLogParts (you might loose other information from the audit log as well) or maybe omit this in the code, but honestly the Apache-Error message is harmless and you can safely ignore it if you’re not interested in it.
Keeping this one closed as it’s not an issue.
@oleg9301 I see it on my side too. Here’s a reproducer for others looking into this issue.
Dockerfile:
In another terminal, watch the audit log:
Finally, send a naughty request (I used the one shown in @oleg9301 's output)
Back in the tail output:
I install 2.9.1 from debian repo(stretch)
error.log