<?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"
	>
<channel>
	<title>Comments on: HTML_AJAX 0.3.0 Released and new Website</title>
	<atom:link href="http://blog.joshuaeichorn.com/archives/2005/11/17/html_ajax-030-released-and-new-website/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.joshuaeichorn.com/archives/2005/11/17/html_ajax-030-released-and-new-website/</link>
	<description>The weblog of Joshua Eichorn, AJAX, PHP and Open Source</description>
	<pubDate>Thu, 04 Dec 2008 05:29:12 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: SitePoint Blogs &#187; unserialize Yahoo! search results</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/11/17/html_ajax-030-released-and-new-website/#comment-5813</link>
		<dc:creator>SitePoint Blogs &#187; unserialize Yahoo! search results</dc:creator>
		<pubDate>Thu, 23 Feb 2006 12:29:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/archives/2005/11/17/html_ajax-030-released-and-new-website/#comment-5813</guid>
		<description>[...] I&#8217;ve dealt with this before in JPSpan, which also used this format across the wire, and have mentioned it to Josh here. The solution I took was to screen the serialized string first with some regexes and I&#8217;m 99% sure this approach works&#8212;implementation here (JPSpan_Unserializer_PHP::getClasses) and unit tests here&#8212;see TestOfJPSpan_Unserializer_PHP_getClasses. [...]</description>
		<content:encoded><![CDATA[<p>[...] I&#8217;ve dealt with this before in JPSpan, which also used this format across the wire, and have mentioned it to Josh here. The solution I took was to screen the serialized string first with some regexes and I&#8217;m 99% sure this approach works&#8212;implementation here (JPSpan_Unserializer_PHP::getClasses) and unit tests here&#8212;see TestOfJPSpan_Unserializer_PHP_getClasses. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua Eichorn</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/11/17/html_ajax-030-released-and-new-website/#comment-5208</link>
		<dc:creator>Joshua Eichorn</dc:creator>
		<pubDate>Fri, 18 Nov 2005 17:07:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/archives/2005/11/17/html_ajax-030-released-and-new-website/#comment-5208</guid>
		<description>Thanks for the code examples, i actually had it on my list to look at those problems, I just haven't had the chance to do it yet.

I'll point this info to the guys who are working with the php Serializer.  I think we also need to detect the versions of php with exploitable bugs in unserialize and refuse to run.</description>
		<content:encoded><![CDATA[<p>Thanks for the code examples, i actually had it on my list to look at those problems, I just haven&#8217;t had the chance to do it yet.</p>
<p>I&#8217;ll point this info to the guys who are working with the php Serializer.  I think we also need to detect the versions of php with exploitable bugs in unserialize and refuse to run.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harry Fuecks</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/11/17/html_ajax-030-released-and-new-website/#comment-5206</link>
		<dc:creator>Harry Fuecks</dc:creator>
		<pubDate>Fri, 18 Nov 2005 09:16:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/archives/2005/11/17/html_ajax-030-released-and-new-website/#comment-5206</guid>
		<description>Cool to see HTML_Ajax is moving along. Would strongly recommend taking a close look at that PHP serializer though. There's two problems I can see with the current implementation.

First Javascript has a different concept of string length, being smarter than PHP in that area. What it means is if people attempt to send multi byte characters from Javascript to PHP, they will get errors from PHP's unserialize. I described the problem a little here: http://www.sitepoint.com/blogs/2004/10/31/how-long-is-a-piece-of-string/ - in JPSpan finally gave up on trying to support multibyte charaters via this approach, warned people off and had the PHP serializer strip anything non-ASCII. See the encodeString function here: http://cvs.sourceforge.net/viewcvs.py/jpspan/jpspan/JPSpan/js/encode/php.js?view=markup

Second and more serious is, on the PHP side it's blindly unserializing whatever it receives. Where that's a problem is someone could "inject" class names via the serialized string and PHP's unserialize will create an object from them, meaning the class constructor get's executed.

Whether that's a danger is will depend on the class itself - in PHP4 the risk / impact is probably quite low. You also can't pass arguments to the constructor. But in PHP5, where there are now alot of built-in classes registered by default, the chances of finding something where the constructor is "dangerous" is much higher plus autoload potentially widens the net.

Described that problem here http://www.php.net/manual/en/function.unserialize.php#45503 along with solution that pulls out class names from a serialized string which hasn't yet been unserialized. You'll find unit tests for that function in the "TestOfJPSpan_Unserializer_PHP_getClasses" class here: http://cvs.sourceforge.net/viewcvs.py/jpspan/jpspan/tests/php/unserializer_php.test.php?view=auto</description>
		<content:encoded><![CDATA[<p>Cool to see HTML_Ajax is moving along. Would strongly recommend taking a close look at that PHP serializer though. There&#8217;s two problems I can see with the current implementation.</p>
<p>First Javascript has a different concept of string length, being smarter than PHP in that area. What it means is if people attempt to send multi byte characters from Javascript to PHP, they will get errors from PHP&#8217;s unserialize. I described the problem a little here: <a href="http://www.sitepoint.com/blogs/2004/10/31/how-long-is-a-piece-of-string/" rel="nofollow">http://www.sitepoint.com/blogs/2004/10/31/how-long-is-a-piece-of-string/</a> - in JPSpan finally gave up on trying to support multibyte charaters via this approach, warned people off and had the PHP serializer strip anything non-ASCII. See the encodeString function here: <a href="http://cvs.sourceforge.net/viewcvs.py/jpspan/jpspan/JPSpan/js/encode/php.js?view=markup" rel="nofollow">http://cvs.sourceforge.net/viewcvs.py/jpspan/jpspan/JPSpan/js/encode/php.js?view=markup</a></p>
<p>Second and more serious is, on the PHP side it&#8217;s blindly unserializing whatever it receives. Where that&#8217;s a problem is someone could &#8220;inject&#8221; class names via the serialized string and PHP&#8217;s unserialize will create an object from them, meaning the class constructor get&#8217;s executed.</p>
<p>Whether that&#8217;s a danger is will depend on the class itself - in PHP4 the risk / impact is probably quite low. You also can&#8217;t pass arguments to the constructor. But in PHP5, where there are now alot of built-in classes registered by default, the chances of finding something where the constructor is &#8220;dangerous&#8221; is much higher plus autoload potentially widens the net.</p>
<p>Described that problem here <a href="http://www.php.net/manual/en/function.unserialize.php#45503" rel="nofollow">http://www.php.net/manual/en/function.unserialize.php#45503</a> along with solution that pulls out class names from a serialized string which hasn&#8217;t yet been unserialized. You&#8217;ll find unit tests for that function in the &#8220;TestOfJPSpan_Unserializer_PHP_getClasses&#8221; class here: <a href="http://cvs.sourceforge.net/viewcvs.py/jpspan/jpspan/tests/php/unserializer_php.test.php?view=auto" rel="nofollow">http://cvs.sourceforge.net/viewcvs.py/jpspan/jpspan/tests/php/unserializer_php.test.php?view=auto</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
