Home page logo

fulldisclosure logo Full Disclosure mailing list archives

Re: Antitoxin for "SQL Injection" (?)
From: Jan Muenther <jan.muenther () nruns com>
Date: Tue, 03 Jan 2006 16:23:35 +0100


Do STORED PROCEDURES really protect against any kind of SQL Injection? I
have read many articles about, some say they are and some say they are

Isn't there any way to do code injection into a SP or are they
fully-secure against Injections?

just to quickly sum things up: Using stored procedures does not protect you from SQL injection - you may decrease the amount of points where things can be altered, but that's about it. In general, you end up with a faster SQL injection :P What you want to use a parameterized prepared statements, which take over the task of escaping special characters for you, so e.g. the single tick does not get processed as an active component of the SQL statement.

As a general rule - if you find yourself concatenating strings containing user input to create your SQL query, you're doing something substantially wrong. I'd still advise you to filter input generically using a whitelist (blacklisting is fairly dangerous with databases, see e.g. the CHAR(0xXX) thingy), and also to use stored procedures, simply since it's best practice and may help to prevent clusterf**cks deriving from combinations of smaller issues.

Hope that helps,
Cheers, j.
Full-Disclosure - We believe in it.
Charter: http://lists.grok.org.uk/full-disclosure-charter.html
Hosted and sponsored by Secunia - http://secunia.com/

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]