Hi Taco,
Thanks for the fixes, actually I had already found the <cfqueryparam> tag but the SP is a great option too. If I utilize the CFQUERYPARAM tag am I completely safe? Boy o boy do I have some search/replaces to do!
Also, do these exploits apply just to SELECTS or for INSERTS/UPDATES/DELETES/et
Increased pts for additional twists...
Really curious about the exploit that will work on my query though, I've found a bunch in Google but nothing seems to effect this statement. I would like to test it out and see what effect it has - I can't seem to punch through and it seems like it should be an easy task. If you have concerns, I'll assure you that this seriously is for nothing more than just testing my stuff!
Thanks for any additional ideas!
Main Topics
Browse All Topics





by: Tacobell777Posted on 2005-02-10 at 13:56:42ID: 13280645
<CFQUERY NAME="checklogin" DATASOURCE="..." USERNAME="..." PASSWORD="...">
/> AND />
/> AND />
SELECT COUNT(*) AS usrcount
FROM accounts
WHERE RTRIM( username ) = <cfqueryparam value="#username#" cfsqltype="CF_SQL_VARCHAR"
RTRIM( pass ) = <cfqueryparam value="#password#" cfsqltype="CF_SQL_VARCHAR"
GROUP BY username
</CFQUERY>
The above is how you overcome SQL injection.
Or use Stored Procedures.
Another good thing to do is actually check the returned value from the SELECT instead of checking for count
(By the way, not sure what your group by is doing in the above statement?)
DECLARE @username VARCHAR(20)
DECLARE @password VARCHAR(20)
SELECT @username = username, @password = password
FROM accounts
WHERE RTRIM( username ) = <cfqueryparam value="#username#" cfsqltype="CF_SQL_VARCHAR"
RTRIM( pass ) = <cfqueryparam value="#password#" cfsqltype="CF_SQL_VARCHAR"
IF @username = '#username#' AND @password = '#password#'
BEGIN
SELECT 1 AS isValid
END
ELSE
BEGIN
SELECT 0 AS isValid
END
I am not going to give a sample on how to exploit cf, but do a search in google and you will find enough examples - hint: it's easier when you use an integer in your example.