Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Security-Basics
[Top] [All Lists]

Re: why most sql injection is not occurred at mysql?

Subject: Re: why most sql injection is not occurred at mysql?
Date: Tue, 23 Oct 2007 14:18:19 -0400
On Tue, Oct 23, 2007 at 10:14:17AM -0700, Francois Larouche wrote:
Annyo MontyRee,

Funny you mention this because in my experience I found more sql
injections in mysql websites. But as you mention it's not related to the
database but how it has been implemented inside the web application
or/and inside the stored proc.


correct.

in php, if you do something like:

$sql = "select * from foo where bar={$bar}"

and you do not properly escape $bar, you are open to an sql-injection. there
was a "hack" put in place so that if I somehow get $bar to be equal to "1;
delete from foo" it will not work, but the "real" solution is to escape all
input that comes from a user (or a bot, or whathaveyou), and to do your
queries a little differently.

what I have been doing lately is using a module in PEAR called MDB2. 

$sql = "select * from foo where bar=?";

and then you make an array that has your data in it:

$dat = array($bar);

then you run the query...

if you use that technique for *every* query, you should not be vulnerable to
sql-injection any more. naturally there are other vectors to be concerned
about.

regards,
J
-- 
http://zoidtechnologies.com/ -- software that sucks less

<Prev in Thread] Current Thread [Next in Thread>