Penetration Testing mailing list archives
Re: Magic Quotes question
From: Sir Mordred <sir.mordred.lists () gmail com>
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 ------------------------------------------------------------------------
Current thread:
- Announcement: The Cross-site Request Forgery FAQ bugtraq (Jan 16)
- Magic Quotes question DokFLeed (Jan 18)
- Re: Magic Quotes question Lynx (Jan 18)
- Re: Magic Quotes question Sir Mordred (Jan 19)
- Re: Magic Quotes question Ronald Chmara (Jan 19)
- Re: Magic Quotes question Justin Ferguson (Jan 19)
- Re: Magic Quotes question Tim (Jan 22)
- Re: Magic Quotes question Sanjay R (Jan 22)
- Wikto and googling Nicolás F . Iglesias (Jan 22)
- Re: Wikto and googling Adviser (Jan 23)
- Re: Wikto and googling Sels, Roger (Jan 23)
- RE: Wikto and googling Michael Starr (Jan 23)
- Re: Wikto and googling David Jacoby (Jan 23)
- RE: Wikto and googling Steve Armstrong (Jan 23)
- Magic Quotes question DokFLeed (Jan 18)