I'm implementing this in the .htaccess of one of the WordPress blogs I'm helping recently, to avoid from getting the injection hacking method being exploited: RewriteEngine on RewriteCond %{QUERY_STRING} http[:%] [NC] RewriteRule .* /------------http----------- [F,NC] RewriteRule http: /---------http----------- [F,NC] Found this method via http://www.whyron.com/http.htm I'm pretty new to .htaccess, so could anyone explain to me what's actually happening here? And will this really block script injection exploits in the future? (I'm betting this has NOTHING to do with SQL injections?)
i dont know mod_rewrite enough to know if those will help or not, but have you thought about using Mod_secruity, or if you are not on a dedicated/VPS, using BadBehavior? BadBehavior out of the box will block most of not all of inection exploits, and mod_security WILL block everything (and much more) when properly configured - and it's easier than messing with .HTACCESS..
Thanks for the feedback, I'll check out BadBehavior and mod_security. I'm still curious about what those mod_rewrite code does, though.
@lvtim: You are right. This code has nothing to do with SQL injections. It only protects from one particular remote script injection exploit (which I believe latest versions of WordPress are not vulnerable to). This trick assumes that your scripts include remote scripts passed in URL parameters and legitimate remote scripts never contain "http:" in them. The rewrite code checks if a QUERY_STRING of the requested URL contains "http:" or "http%" then the 403 error is returned. Note that this code will also block all legitimate requests with "http:" in the query string.
Thank you so much for the explanation. I suspected as much that this may block even the site's own http query, and I have mentioned this suspicion to the owner of the site. I dealt with a hacked WordPress site recently, which was caused by not updating to the latest version, making it vulnerable to attacks. Your Unmask Parasites site tools looks great, BTW
follow this tutorial to install mod_security in apache. to prevent mysql injections you can also use mysql_real_escape_string() function from php.