Sorry for bring up an old thread, but we do have the same issue as many of the people above. I have dropped an email into support but i was interested in what others may think.
We have many clients who hit security rules, and have no idea about error_logs and the such, to them they are getting thrown of the server for no reason whatsoever and there impression is that the server is unreliable and therefor they go looking for a new host. We all know that getting business is hard, so loosing a client simply because they have hit a security rule is tough.
Ive been looking through the modsecurity documentation and came across the "redirect" action, this can be easily used to make it so that when someone triggers a security rule it will take them to a page on a different server that tells them whatever you want, ie just a small html file saying "You have hit a security rule, please contact support - your access to the server has been blocked due to this"
All you need to do is to alter the rule to have this redirect in it.
If we take a sample rule from eg
/etc/httpd/modsecurity.d/50_asl_rootkits.conf
Code:
#Known rootkit
SecRule ARGS:cmd|ARGS:act|ARGS:command|ARGS:action "(?:ls(?: -|\&)|find /|mysqldump |ifconfig |php |echo |perl |killall |kill |python |rpm |yum |apt-get |emerge |lynx |links |mkdir |elinks |wget |lwp-(?:download|request|mirror|rget) |uname |cvs |svn |(?:s|r)(?:cp|sh) |net(?:stat|cat) |rexec |smbclient |t?ftp |ncftp |curl |telnet |g?cc |cpp |g\+\+ |/s?bin/(?:xterm|id|bash|sh|echo|kill|chmod|ch?sh|python|perl|nasm|ping|mail|ssh|netstat|php|route)|mv |unzip |tar |rm |cat |rar |selfremove)" \
"capture,id:390904,rev:7,severity:2,msg:'Atomicorp.com WAF Rules: Possible Shell Command Attempt',logdata:'%{TX.0}'"
change this to eg
Code:
#Known rootkit
SecRule ARGS:cmd|ARGS:act|ARGS:command|ARGS:action "(?:ls(?: -|\&)|find /|mysqldump |ifconfig |php |echo |perl |killall |kill |python |rpm |yum |apt-get |emerge |lynx |links |mkdir |elinks |wget |lwp-(?:download|request|mirror|rget) |uname |cvs |svn |(?:s|r)(?:cp|sh) |net(?:stat|cat) |rexec |smbclient |t?ftp |ncftp |curl |telnet |g?cc |cpp |g\+\+ |/s?bin/(?:xterm|id|bash|sh|echo|kill|chmod|ch?sh|python|perl|nasm|ping|mail|ssh|netstat|php|route)|mv |unzip |tar |rm |cat |rar |selfremove)" \
"capture,id:390904,rev:7,severity:2,redirect:http://www.google.com,msg:'Atomicorp.com WAF Rules: Possible Shell Command Attempt',logdata:'%{TX.0}'"
Then give apache a restart, you can then trigger this rule by going to eg
Code:
http://SERVERNAME?cmd=wget http://blah
But instead of just being confronted with a server not responded, you would in this case go to googles homepage, which of course could be any webpage that we elect.
Having some user variable in /etc/asl/config where this is configurable and then it being used to inject into the rules after an "asl -u" i personally think would save us loosing a lot of customers and would be highly informative.
Would like to know others views on this?
--
Ian
34SP.com