Please tell me how to exploit this query with a SQL injection attack!
I've been reading about such attacks and I want to lock down my code a bit better. But, for some reason I can't get my Coldfusion program to bite on the good old
' or '1'='1' --
as the password when I feed it in through a URL or the HTML form. The query it calls is as follows:
<CFQUERY NAME="checklogin" DATASOURCE="..." USERNAME="..." PASSWORD="...">
SELECT COUNT(*) AS usrcount
FROM accounts
WHERE RTRIM( username ) = '#username#' AND
RTRIM( pass ) = '#password#'
GROUP BY username
</CFQUERY>
Intuitively this query should be hackable, am I mistaken? Can anyone give me a SQLInjection hack that will break this SQL statement (it shouldn't be too hard to do?)
Also, any suggestions to sure-up my code would also be greatly appreciated (but mainly I want a hack example that works so I can fix my other sins ...)
Using MS SQL Server. Please, nothing that will do damage (the apps are still my babies!)
Thanks for your input and comments!
Start Free Trial