<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Thu Jun 20 12:05:37 UTC 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://www.doctrine-project.org/jira/si/jira.issueviews:issue-xml/DBAL-111/DBAL-111.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Doctrine Project</title>
    <link>http://www.doctrine-project.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>5.2.7</version>
        <build-number>850</build-number>
        <build-date>21-02-2013</build-date>
    </build-info>

<item>
            <title>[DBAL-111] MySQL Driver possibly subject to sql injections with PDO::quote()</title>
                <link>http://www.doctrine-project.org/jira/browse/DBAL-111</link>
                <project id="10040" key="DBAL">Doctrine DBAL</project>
                        <description>&lt;p&gt;Prior to 5.3.6, the MySQL PDO driver ignored the character set parameter to options.  Due to MySQL&apos;s C api (and MySQLND), this is required for the proper function of mysql_real_escape_string() (the C API call).  Since PDO uses the mres() C call for PDO::quote(), this means that the quoted string does not take into account the connection character set.&lt;/p&gt;

&lt;p&gt;Starting with 5.3.6, that was fixed.  So now if you pass the proper character set to PDO via driver options, sql injection is impossible while using the PDO::quote() api call.&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;PDO proof of concept&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$dsn = &apos;mysql:dbname=INFORMATION_SCHEMA;host=127.0.0.1;charset=GBK;&apos;;
$pdo = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; PDO($dsn, $user, $pass);
$pdo-&amp;gt;exec(&apos;SET NAMES GBK&apos;);
$string = chr(0xbf) . chr(0x27) . &apos; OR 1 = 1; /*&apos;;
$sql = &quot;SELECT TABLE_NAME
            FROM INFORMATION_SCHEMA.TABLES
            WHERE TABLE_NAME LIKE &lt;span class=&quot;code-quote&quot;&gt;&quot;.$pdo-&amp;gt;quote($string).&quot;&lt;/span&gt; LIMIT 1;&quot;;
$stmt = $pdo-&amp;gt;query($sql);
var_dump($stmt-&amp;gt;rowCount());
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Expected Result: `int(0)`.&lt;br/&gt;
Actual Result: `int(1)`.&lt;/p&gt;

&lt;p&gt;There are 2 issues to fix.  First, the documentation does not indicate that you can pass the `charset` option to the MySQL Driver.  This should be fixed so that users are given the proper option to set character sets.&lt;/p&gt;

&lt;p&gt;Secondly, `Connection::setCharset()` should be modified for MySQL to throw an exception, since the character set is only safely setable using the DSN with PDO.  This is a limitation of the driver and could be asked as a feature request for the PHP core.  Either that, or a big warning should be put on the documentation of the API to indicate the unsafe character set change&lt;/p&gt;</description>
                <environment>MySQL Drivers</environment>
            <key id="12569">DBAL-111</key>
            <summary>MySQL Driver possibly subject to sql injections with PDO::quote()</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/critical.png">Critical</priority>
                    <status id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/resolved.png">Resolved</status>
                    <resolution id="1">Fixed</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="ircmaxell">Anthony Ferrara</reporter>
                        <labels>
                    </labels>
                <created>Mon, 18 Apr 2011 18:52:18 +0000</created>
                <updated>Sat, 14 May 2011 07:24:48 +0000</updated>
                    <resolved>Sat, 14 May 2011 07:24:48 +0000</resolved>
                            <version>2.0.0-BETA2</version>
                <version>2.0.0-BETA3</version>
                <version>2.0.0-BETA4</version>
                <version>2.0.0-RC1-RC3</version>
                <version>2.0-RC4</version>
                <version>2.0-RC5</version>
                <version>2.0</version>
                <version>2.0.1</version>
                <version>2.0.2</version>
                <version>2.0.3</version>
                <version>2.0.4</version>
                <version>2.0.5</version>
                <version>2.1</version>
                                <fixVersion>2.0.4</fixVersion>
                <fixVersion>2.0.5</fixVersion>
                <fixVersion>2.1</fixVersion>
                                <component>Drivers</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="15740" author="ircmaxell" created="Tue, 19 Apr 2011 13:30:41 +0000"  >&lt;p&gt;Note: issued same bug report for Doctrine1 as it&apos;s also affected: &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-998&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-998&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="15753" author="ircmaxell" created="Fri, 29 Apr 2011 20:39:41 +0000"  >&lt;p&gt;Also note that prepared statements in PDO will suffer the same bug since PDO always emulates prepared statements for the mysql driver (even though it fully supports them in the source).  See: &lt;a href=&quot;http://bugs.php.net/bug.php?id=54638&quot; class=&quot;external-link&quot;&gt;http://bugs.php.net/bug.php?id=54638&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="15845" author="beberlei" created="Sat, 14 May 2011 07:24:48 +0000"  >&lt;p&gt;Fixed, updated the docs&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>