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 Pen-Test
[Top] [All Lists]

Re: Magic Quotes question

Subject: Re: Magic Quotes question
Date: Fri, 19 Jan 2007 11:43:14 +0200
I posted this earlier to webappsec@securityfocus.com with no luck ,
does anyone know how to bypass magic quotes? a proven working way .

example is, in such a simple SQL like
 "SELECT * from USERS WHERE id =$id";

Magic quotes, as well as the correct db-specific escaping functions
(like mysql_real_escape_string() for MySQL) will not work if the query
itself is written badly, as in your example. Here is the correct
syntax, which cannot be exploited if the input was escaped, or if
magic quotes are enabled:

SELECT * from USERS WHERE id='$id'

I am looking for ways to by pass magic quotes to inject this
INTO OUTFILE '/home/z.php'

That said, INTO OUTFILE will only work with a literal string (at least
in MySQL, not sure of others), which means you have to use ' or ",
which are escaped by magic quotes.

In other situations where a value is unquoted in the query, you use
CHAR(39,....,39) to represent quotes. To use the above vulnerability
you can try $id=id, $id=1 or 1, $id>4, unions with another table, etc.
and see if any of the selected data is displayed. If not, you'll have
to do with blind sql injection techniques.

Mordred


------------------------------------------------------------------------
This List Sponsored by: Cenzic

Need to secure your web apps?
Cenzic Hailstorm finds vulnerabilities fast.
Click the link to buy it, try it or download Hailstorm for FREE.

http://www.cenzic.com/products_services/download_hailstorm.php?camp=701600000008bOW
------------------------------------------------------------------------

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