I have a cPanel server with suhosin + mod_security + asl-lite .
All the sites hosted at this server seen to have mod_security working fine. But my blog based in wordpress is having some really weird issues.
The suggested attack from the wiki isn't being blocked by mod_security for my blog. (no 403 error). I can see the block message in log file (saying 403) but I still can access the site. After a lot of testing, I discovered that the default rewrite rules from wordpress at .htaccess are messing with my mod_security setup. If I comment out the rewrite rules, the blocks (403) would work as they should but as soon as they are active my mod_security stops working as it should for this site.
.htaccess
Code: Select all
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Test attack
Code: Select all
# wget http://eduardosilva.eti.br/foo.php?foo=http://fakeattacker.com
--2011-05-24 23:04:24-- http://eduardosilva.eti.br/foo.php?foo=http://fakeattacker.com
Resolving eduardosilva.eti.br... 96.31.88.180
Connecting to eduardosilva.eti.br|96.31.88.180|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2011-05-24 23:04:24 ERROR 404: Not Found.
root@junglehunt [~/test]# wget http://eduardosilva.eti.br/wp-login.php?foo=http://fakeattacker.com
--2011-05-24 23:04:32-- http://eduardosilva.eti.br/wp-login.php?foo=http://fakeattacker.com
Resolving eduardosilva.eti.br... 96.31.88.180
Connecting to eduardosilva.eti.br|96.31.88.180|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4677 (4.6K) [text/html]
Saving to: `wp-login.php?foo=http:%2F%2Ffakeattacker.com'
100%[===============================================================>] 4,677 --.-K/s in 0s
2011-05-24 23:04:33 (558 MB/s) - `wp-login.php?foo=http:%2F%2Ffakeattacker.com' saved [4677/4677]
Code: Select all
[Tue May 24 23:03:03 2011] [error] [client 96.31.88.180] ModSecurity: Access denied with code 403 (phase 2). Match of "beginsWith http:/%{SERVER_NAME}/" against "MATCHED_VAR" required. [file "/usr/local/apache/conf/modsec_rules/10_asl_rules.conf"] [line "482"] [id "340162"] [rev "228"] [msg "Atomicorp.com WAF Rules: Remote File Injection attempt in ARGS (AE)"] [data "http:/"] [severity "CRITICAL"] [hostname "eduardosilva.eti.br"] [uri "/foo.php"] [unique_id "TdxjV2AfWLQAAC45Q6sAAAAE"]
[Tue May 24 23:04:24 2011] [error] [client 96.31.88.180] ModSecurity: Access denied with code 403 (phase 2). Match of "beginsWith http:/%{SERVER_NAME}/" against "MATCHED_VAR" required. [file "/usr/local/apache/conf/modsec_rules/10_asl_rules.conf"] [line "482"] [id "340162"] [rev "228"] [msg "Atomicorp.com WAF Rules: Remote File Injection attempt in ARGS (AE)"] [data "http:/"] [severity "CRITICAL"] [hostname "eduardosilva.eti.br"] [uri "/foo.php"] [unique_id "TdxjqGAfWLQAAC47SCQAAAAG"]
Is this normal? Is mod_security still protecting this blog?
Is index.php + mod_rewrite removing the malicious code?
Any other test that I could try to check if mod_security is doing the job properly?
As far as I understand, mod_security should filter the requests before going to mod_rewrite or even going to php files.
I'm feeling a bit lost and confused here, can someone give me any advice?
Thank you