August 31, 2009

Prevent sql injection attacks in Coldfusion

Posted in SQL Injection Attacks at 4:07 pm by borawlings

Ben Forta, my guru, has a fantastic article on the prevention of SQL Injection attacks.  In case you don’t know what what a SQL Injection attack is, it is a very insidious code injection technique that allows someone to embed sql statements within your code. 

I like to check my parameters before passing them to the database as suggested by Ben.  Here’s an example that validates a paramater being passed by a URL:

<cfquery …>
SELECT *
FROM Customers
WHERE CustID=<cfqueryparam value=“#URL.CustID#” cfsqltype=“CF_SQL_INTEGER”>
</cfquery>
  
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.