<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: The OWASP Top Ten and ESAPI &#8211; Part 2 &#8211; Injection Flaws</title>
	<atom:link href="http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/</link>
	<description>Java, Security and Technology</description>
	<lastBuildDate>Wed, 25 Jan 2012 05:18:23 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: john</title>
		<link>http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/comment-page-1/#comment-37428</link>
		<dc:creator>john</dc:creator>
		<pubDate>Wed, 16 Mar 2011 06:13:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/#comment-37428</guid>
		<description>@Ram
Thanks for the kind words. Glad you found it helpful</description>
		<content:encoded><![CDATA[<p>@Ram<br />
Thanks for the kind words. Glad you found it helpful</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ram Guduputi</title>
		<link>http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/comment-page-1/#comment-37424</link>
		<dc:creator>Ram Guduputi</dc:creator>
		<pubDate>Wed, 16 Mar 2011 04:42:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/#comment-37424</guid>
		<description>What an excellent technical details on OWASP issues. This is the best place to learn about Application Security especially J2EE application.

Please continue writing such articles to help your fellow professionals.</description>
		<content:encoded><![CDATA[<p>What an excellent technical details on OWASP issues. This is the best place to learn about Application Security especially J2EE application.</p>
<p>Please continue writing such articles to help your fellow professionals.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jose</title>
		<link>http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/comment-page-1/#comment-1102</link>
		<dc:creator>jose</dc:creator>
		<pubDate>Tue, 13 Apr 2010 15:01:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/#comment-1102</guid>
		<description>Excellents articles!

I hope that you&#039;ll  still continue writting about that, because is a issue than there&#039;re not so much information about how can we used it. 

Good for you! and thank u</description>
		<content:encoded><![CDATA[<p>Excellents articles!</p>
<p>I hope that you&#8217;ll  still continue writting about that, because is a issue than there&#8217;re not so much information about how can we used it. </p>
<p>Good for you! and thank u</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KRvW</title>
		<link>http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/comment-page-1/#comment-14</link>
		<dc:creator>KRvW</dc:creator>
		<pubDate>Wed, 02 Dec 2009 13:13:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/#comment-14</guid>
		<description>Excellent series of articles--thanks for taking the time to write and post them.

Cheers,

Ken van Wyk</description>
		<content:encoded><![CDATA[<p>Excellent series of articles&#8211;thanks for taking the time to write and post them.</p>
<p>Cheers,</p>
<p>Ken van Wyk</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: john</title>
		<link>http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/comment-page-1/#comment-13</link>
		<dc:creator>john</dc:creator>
		<pubDate>Tue, 01 Dec 2009 17:17:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/#comment-13</guid>
		<description>@Jeff - thanks for the input - made a reference inline pointing to your comment and a statement hopefully better resembling the OWASP spirit.

@Ben - thanks for the great catch - updated the code referencing your comment.</description>
		<content:encoded><![CDATA[<p>@Jeff &#8211; thanks for the input &#8211; made a reference inline pointing to your comment and a statement hopefully better resembling the OWASP spirit.</p>
<p>@Ben &#8211; thanks for the great catch &#8211; updated the code referencing your comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/comment-page-1/#comment-12</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Tue, 01 Dec 2009 08:23:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/#comment-12</guid>
		<description>Hello,
thank you for the effort, cool series of articles. However, let me hint on a small mistake:

The example you use for SQL injection is one I see a lot:
Password: &#039; OR &#039;1 = 1
...making the resulting query:
...AND password = &#039;&#039; OR &#039;1 = 1&#039;

But this is NOT a correct statement, the &#039;1 = 1&#039; might be &quot;true&quot; for some databases but not necessarily always. For example, this will NOT work on Microsoft SQL Server.

On a side note, I have no idea where this strange wrong injection string is coming from but have even found it in scientific papers :)

A correct injection string would, for example, be:
Password: &#039; OR &#039;1&#039; = &#039;1
...making the resulting query:
...AND password = &#039;&#039; OR &#039;1&#039; = &#039;1&#039;

...which is a correct statement, no matter which database is used.

---
Nonetheless, your example shows that some databases accept strange things as &quot;true&quot;, which is a royal PITA when trying to filter input and shows that blacklisting is futile (think of signature-based IDSs, IPSs, WAFs,...).

For example, MySQL (and I guess this was used for &quot;finding&quot; the wrong injection string) accepts, probably among others, the following values as &quot;true&quot;:

any positive or negative number except 0:
where 1
where 2
where -34

any string starting with a positive or negative number except 0:
where &#039;1&#039;
where &#039;1 = 1&#039; -- looks familiar?
where &#039;2&#039;
where &#039;-34something&#039;

Kind regards,
Ben</description>
		<content:encoded><![CDATA[<p>Hello,<br />
thank you for the effort, cool series of articles. However, let me hint on a small mistake:</p>
<p>The example you use for SQL injection is one I see a lot:<br />
Password: &#8216; OR &#8217;1 = 1<br />
&#8230;making the resulting query:<br />
&#8230;AND password = &#8221; OR &#8217;1 = 1&#8242;</p>
<p>But this is NOT a correct statement, the &#8217;1 = 1&#8242; might be &#8220;true&#8221; for some databases but not necessarily always. For example, this will NOT work on Microsoft SQL Server.</p>
<p>On a side note, I have no idea where this strange wrong injection string is coming from but have even found it in scientific papers <img src='http://www.jtmelton.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>A correct injection string would, for example, be:<br />
Password: &#8216; OR &#8217;1&#8242; = &#8217;1<br />
&#8230;making the resulting query:<br />
&#8230;AND password = &#8221; OR &#8217;1&#8242; = &#8217;1&#8242;</p>
<p>&#8230;which is a correct statement, no matter which database is used.</p>
<p>&#8212;<br />
Nonetheless, your example shows that some databases accept strange things as &#8220;true&#8221;, which is a royal PITA when trying to filter input and shows that blacklisting is futile (think of signature-based IDSs, IPSs, WAFs,&#8230;).</p>
<p>For example, MySQL (and I guess this was used for &#8220;finding&#8221; the wrong injection string) accepts, probably among others, the following values as &#8220;true&#8221;:</p>
<p>any positive or negative number except 0:<br />
where 1<br />
where 2<br />
where -34</p>
<p>any string starting with a positive or negative number except 0:<br />
where &#8217;1&#8242;<br />
where &#8217;1 = 1&#8242; &#8212; looks familiar?<br />
where &#8217;2&#8242;<br />
where &#8216;-34something&#8217;</p>
<p>Kind regards,<br />
Ben</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Williams</title>
		<link>http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/comment-page-1/#comment-11</link>
		<dc:creator>Jeff Williams</dc:creator>
		<pubDate>Tue, 01 Dec 2009 04:28:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/#comment-11</guid>
		<description>The OWASP ESAPI Project absolutely does recommend that people use PreparedStatement as the first and best option (it&#039;s all over the javadoc and the swingset sample app).

However, ESAPI does provide database codecs because there are many situations when remediation is more easily done with an escaping method. There are also certain types of queries for which using PreparedStatement will cause significant performance problems (so be careful with those recommendations folks). Also, in some environments parameterized queries may not be available, so an escaping option is important.

I looked into this pretty deeply back in 2002/2003 (http://lists.virus.org/webappsec-0301/msg00003.html). The upshot is that the JDBC spec doesn&#039;t explicitly require that PreparedStatement prevents injection, so there&#039;s certainly some risk in relying exclusively on them. That&#039;s why input validation, escaping, and access reference maps are important security controls. And of course there are degenerate cases like PreparedStatement.executeQuery( &quot;exec ?&quot; );

I looked into the MySQL driver back then and decided that it wasn&#039;t obviously vulnerable.  I even took a swing at reversing the Oracle JDBC drivers, but I didn&#039;t get far enough to give anyone any confidence.  This is exactly the lack of visibility that makes it so difficult to make progress in application security.</description>
		<content:encoded><![CDATA[<p>The OWASP ESAPI Project absolutely does recommend that people use PreparedStatement as the first and best option (it&#8217;s all over the javadoc and the swingset sample app).</p>
<p>However, ESAPI does provide database codecs because there are many situations when remediation is more easily done with an escaping method. There are also certain types of queries for which using PreparedStatement will cause significant performance problems (so be careful with those recommendations folks). Also, in some environments parameterized queries may not be available, so an escaping option is important.</p>
<p>I looked into this pretty deeply back in 2002/2003 (<a href="http://lists.virus.org/webappsec-0301/msg00003.html" rel="nofollow">http://lists.virus.org/webappsec-0301/msg00003.html</a>). The upshot is that the JDBC spec doesn&#8217;t explicitly require that PreparedStatement prevents injection, so there&#8217;s certainly some risk in relying exclusively on them. That&#8217;s why input validation, escaping, and access reference maps are important security controls. And of course there are degenerate cases like PreparedStatement.executeQuery( &#8220;exec ?&#8221; );</p>
<p>I looked into the MySQL driver back then and decided that it wasn&#8217;t obviously vulnerable.  I even took a swing at reversing the Oracle JDBC drivers, but I didn&#8217;t get far enough to give anyone any confidence.  This is exactly the lack of visibility that makes it so difficult to make progress in application security.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/10 queries in 0.007 seconds using disk: basic
Object Caching 300/301 objects using disk: basic

Served from: www.jtmelton.com @ 2012-02-04 21:43:54 -->
