A Stop Gap Measure for Current SQL Injection
Okay, we all know the best way to secure a query is the use of a CFQueryParam statement. I sent off a quick IM to a friend of mine today telling him I had a few attacks on my site and it would behoove him to make sure he battens down all the hatches. I know he has quite a few sites and as he was in a panic attack I looked around to help him find a quick solution.
After reading Mark Kruger's article SQL Injection Part II (Make Sure You Are Sitting Down) I came up with something quick that is inelegant, but it works for this attack method.
Just add the following code to the top of your application.cfm file (or the appropriate section in application.cfc).
<cfif len(CGI.QUERY_STRING) AND findNoCase("declare",CGI.QUERY_STRING)>
-Insert some cheeky comments here-
<cfabort />
</cfif>
I DO NOT suggest using this for very long, but it could buy you some time if you need to update some queries.



The best way to avoid the situation altogether is using cfqueryparam. As I said it is a VERY inelegant solution but it does beat the alternative.
Thanks for pointing that out though Todd. Sharp as always.
A little play on words there. ;)
And thanks for the compliment :)
http://russ.michaels.me.uk/index.cfm/2008/7/24/SQL...
This protects the url and form scope, plus they can still have DECLARE in a textarea. :)