<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Exploit mysql_real_escape_string()</title>
        <description>The function mysql_real_escape_string() is used to add a \ in front of &amp;quot;dangerous characters&amp;quot; like single quote.

From ha.ckers.com:

&amp;lt;Evading escapes with backslashes (this assumes the application comments out a single quote with another single quote and by introducing a backslash before it, it comments out the singlequote that is added by the filter). This type of filter is applied by mySQL's mysql_real_escape_string()&amp;gt;

With an sql injection example:

\';

Using the follwing example it possible to get an error message because you end the statement but I wasnt able to create a correct one (blind sql)

admin\' or \'1\'=\'1


Gives me the follwing error:

 Error Executing Database Query.
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\''1\''=\''1' and password = 'IyVeVEwK' and extranetuser =' at line 3 

Any idee how I could make it works?</description>
        <link>http://sla.ckers.org/forum/read.php?16,32733,32733#msg-32733</link>
        <lastBuildDate>Tue, 18 Jun 2013 02:17:54 -0500</lastBuildDate>
        <generator>Phorum 5.2.15a</generator>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?16,32733,32736#msg-32736</guid>
            <title>Re: Exploit mysql_real_escape_string()</title>
            <link>http://sla.ckers.org/forum/read.php?16,32733,32736#msg-32736</link>
            <description><![CDATA[admin\' ; -- <br />
<br />
become<br />
<br />
admin\'' or 1=1 -- <br />
<br />
the first quote is escaped and the second one delimits the string so after that you can inject what you want. Seems reasonable to me. Maybe it's a multi-line query so the -- comment doesn't work.]]></description>
            <dc:creator>oniric</dc:creator>
            <category>SQL and Code Injection</category>
            <pubDate>Thu, 17 Dec 2009 05:30:45 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?16,32733,32735#msg-32735</guid>
            <title>Re: Exploit mysql_real_escape_string()</title>
            <link>http://sla.ckers.org/forum/read.php?16,32733,32735#msg-32735</link>
            <description><![CDATA[No because I only add one quote so there are a impair number of quote into the sentence.<br />
<br />
For example if we have something like:<br />
<br />
&quot;Select * from users where username='&quot; + $username + &quot;' and hash(&quot; + $password + &quot;)&quot;<br />
<br />
There are 2 singles quotes into the querry, if you add \' admin you will get three and get a sql error before it is processed.<br />
<br />
admin\' ; -- doen't work neither]]></description>
            <dc:creator>felixia</dc:creator>
            <category>SQL and Code Injection</category>
            <pubDate>Thu, 17 Dec 2009 05:12:21 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?16,32733,32734#msg-32734</guid>
            <title>Re: Exploit mysql_real_escape_string()</title>
            <link>http://sla.ckers.org/forum/read.php?16,32733,32734#msg-32734</link>
            <description><![CDATA[Can't you simply use<br />
<br />
admin\' or INJECT_HERE_WHAT_YOU_WANT_BUT_DONT_USE_QUOTES -- foo<br />
<br />
?]]></description>
            <dc:creator>oniric</dc:creator>
            <category>SQL and Code Injection</category>
            <pubDate>Thu, 17 Dec 2009 04:56:20 -0600</pubDate>
        </item>
        <item>
            <guid>http://sla.ckers.org/forum/read.php?16,32733,32733#msg-32733</guid>
            <title>Exploit mysql_real_escape_string()</title>
            <link>http://sla.ckers.org/forum/read.php?16,32733,32733#msg-32733</link>
            <description><![CDATA[The function mysql_real_escape_string() is used to add a \ in front of &quot;dangerous characters&quot; like single quote.<br />
<br />
From ha.ckers.com:<br />
<br />
&lt;Evading escapes with backslashes (this assumes the application comments out a single quote with another single quote and by introducing a backslash before it, it comments out the singlequote that is added by the filter). This type of filter is applied by mySQL's mysql_real_escape_string()&gt;<br />
<br />
With an sql injection example:<br />
<br />
\';<br />
<br />
Using the follwing example it possible to get an error message because you end the statement but I wasnt able to create a correct one (blind sql)<br />
<br />
admin\' or \'1\'=\'1<br />
<br />
<br />
Gives me the follwing error:<br />
<br />
 Error Executing Database Query.<br />
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\''1\''=\''1' and password = 'IyVeVEwK' and extranetuser =' at line 3 <br />
<br />
Any idee how I could make it works?]]></description>
            <dc:creator>felixia</dc:creator>
            <category>SQL and Code Injection</category>
            <pubDate>Thu, 17 Dec 2009 04:37:37 -0600</pubDate>
        </item>
    </channel>
</rss>
