Mike,
The basic question is where does "attributes.join" come from? If it's from a
form field (for example) a malicious user could pass in:
a string that does something naughty to your table for example if I passed
in:
inner join jointable j on (j.x = b.x)
truncate table b
return 0 --
The result would be
select b.*, j.columns
from basetable b
inner join jointable j on (j.x = b.x)
truncate table b
return 0 -- j on (j.x = b.x)
the result "might" be that table b is wiped out (I say might - lots of
factors here including syntax). Notice the comment tag at the end - the 2
slashes. This is one that folks sometimes forget about. Passing 2 slashes
in might "comment out" part of a query and allow it to run without some or
all of the "WHERE" clause.
For example, if you build a string as a where clause (as some folks do) and
your query looks like this:
select * from mytable where #mywherecluase#
I could get all the records from your table by passing in "1=1 --"
I would have to know the first parameter that is used in the where clause -
but with some evil guessing I might figure it out.
You would end up with
select * from mytable where 1 = 1 --the rest of the where clause is
commented out
SQL injection is possibly the biggest hole in most web sites. It needs
plugging. I've looked at code where someone has worked days protecting the
site from obscure cross scripting attacks while their data sits there
exposed and vulnerable. Most of the really valuable stuff on your web site
is in the database - right?
ASP sites are worse because they almost always use a string building kind of
syntax and no automatic escaping of single quotes. In CF the query is
"readable" and easier to work with.
-Mark
-----Original Message-----
From: Mike Soultanian [mailto:[EMAIL PROTECTED]
Sent: Monday, June 27, 2005 3:25 PM
To: CF-Talk
Subject: Re: cfqueryparam
> <cfparam name="attributes.join" default="left">
> <cfquery name="getStuff" ...>
> select b.*, j.columns
> from basetable b
> #attributes.join# jointable j on (j.x = b.x)
> </cfquery>
>
> I don't use this syntax because it's insecure... This is simplified to
Why is this insecure? Does it have something to do with you using the
attributes scope? Sorry if it's a stupid question, but I'm really not
sure why it is insecure and I figure it's a good thing to know ;)
Thanks,
Mike
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210673
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54