ModSecurity Question...

wineo

Active Member
Aug 30, 2003
27
0
151
Perth, Australia
I am monitoring the error logs on one of our servers and an entry that I keep seeing looks serious... and I just wanted to check with you guys if there is anything going on here and if there is anything that we should be doing to stop this. Here is the entry:

[Thu Aug 06 18:30:54 2009] [error] [client 122.162.154.231] ModSecurity: Access denied with code 406 (phase 2). Match of "rx ^OPTIONS$" against "REQUEST_METHOD" required. [file "/usr/local/apache/conf/modsecurity/modsecurity_crs_21_protocol_anomalies.conf"] [line "41"] [id "960015"] [msg "Request Missing an Accept Header"] [severity "CRITICAL"] [tag "PROTOCOL_VIOLATION/MISSING_HEADER"] [hostname "v___s.com.au"] [uri "/"] [unique_id "8CiXEXZ-DmgAACbYkXkAAAAR"]

Thanks.
 

Spiral

BANNED
Jun 24, 2005
2,020
8
193
... and if there is anything that we should be doing to stop this ...
You already have!

Your ModSecurity is simply notifying you that it already stopped the connection listed. ;)

If you want to take things a step further, you could block the IP at your firewall or drop the TCP packets with iptables but unless you are under some massive attack, it's really not necessary.
 
Last edited:

wineo

Active Member
Aug 30, 2003
27
0
151
Perth, Australia
Back to this...

This site has a rss feed (xml file) that keeps causing a 406 error. I added a catch page for this error and the details are forwarded to me. There is never a user-agent associated with the requests on this file (well once it was iTMS). So I can't really tell what the user is trying to view the feed with...

I can't replicate the situation, actually seeing this error 406 page, so I can't see if these viewers are atcually seeing the feed or podcasts.

I don't want to turn the filter off, but is there a way to set the filter to allow requests on .xml files (when "Request Missing an Accept Header") in the .htaccess file?

Thanks!
 

Spiral

BANNED
Jun 24, 2005
2,020
8
193
The answer is yes to your rule modifying question.

Also, you may find more what you are looking for in the raw log mod_security log file found in /usr/local/apache/logs
 

wineo

Active Member
Aug 30, 2003
27
0
151
Perth, Australia
Thanks Spiral,

I have tried using SecFilterEngine Off in the in the .htaccess file, but this seems to have no affect (doesn't seem to turn the filter off).

Is there another way?
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,545
12
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
To disable the filter you could either comment it in the configuration file mentioned in the log detail, or create a custom exclusion to prevent it from working for specific URIs or all sites.

You might try an entry like the following, as per your provided log detail:
Code:
<LocationMatch .*>
  # Exclude rule ID "960015" that breaks an RSS feed.
  SecRuleRemoveById 960015
</LocationMatch>
The above could be added to your mod_security user configuration file; this can be managed via the following menu path via your root WHM contorl panel:
WHM: Main >> Plugins >> Mod Security >> Edit Config