<?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: Simon Willison, @Media Ajax</title>
	<atom:link href="http://ajaxian.com/archives/simon-willison-media-ajax/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/simon-willison-media-ajax</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 09 Feb 2012 06:55:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: rbondi</title>
		<link>http://ajaxian.com/archives/simon-willison-media-ajax/comment-page-1#comment-267722</link>
		<dc:creator>rbondi</dc:creator>
		<pubDate>Sun, 28 Sep 2008 13:48:42 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=4486#comment-267722</guid>
		<description>Simon suggests making the crumb an MD5 hash of the session id. Obviously though an attacker could just get a session id by loading any page, and MD5 it themselves. In other words, an MD5 hash of the session id is very guessable.

A better way is to use a MAC = Message Authentication Code. This is a hash that uses a cryptographic key. There are many kinds of MACs, but a simple and very effective is just to encrypt your input with a block cipher and use the last block as your crumb (a session id is so small you could use the whole cipher text, not just the last block). Now an attacker can&#039;t figure out what your crumb is unless she knows your encryption key (which you&#039;ll keep on the server, not on the page). To minimize replay attacks, change the key frequently.

For more information, see Bruce Schneier&#039;s classic Applied Cryptography (although many  MACs were invented after the last edition, including HMAC). A perfectly good block cipher to use would be RC2.</description>
		<content:encoded><![CDATA[<p>Simon suggests making the crumb an MD5 hash of the session id. Obviously though an attacker could just get a session id by loading any page, and MD5 it themselves. In other words, an MD5 hash of the session id is very guessable.</p>
<p>A better way is to use a MAC = Message Authentication Code. This is a hash that uses a cryptographic key. There are many kinds of MACs, but a simple and very effective is just to encrypt your input with a block cipher and use the last block as your crumb (a session id is so small you could use the whole cipher text, not just the last block). Now an attacker can&#8217;t figure out what your crumb is unless she knows your encryption key (which you&#8217;ll keep on the server, not on the page). To minimize replay attacks, change the key frequently.</p>
<p>For more information, see Bruce Schneier&#8217;s classic Applied Cryptography (although many  MACs were invented after the last edition, including HMAC). A perfectly good block cipher to use would be RC2.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Hendrickx</title>
		<link>http://ajaxian.com/archives/simon-willison-media-ajax/comment-page-1#comment-267527</link>
		<dc:creator>Michael Hendrickx</dc:creator>
		<pubDate>Fri, 19 Sep 2008 13:54:59 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=4486#comment-267527</guid>
		<description>You mispelled the link to Simon&#039;s website, it should be: http://simonwillison.net/tags/security/</description>
		<content:encoded><![CDATA[<p>You mispelled the link to Simon&#8217;s website, it should be: <a href="http://simonwillison.net/tags/security/" rel="nofollow">http://simonwillison.net/tags/security/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: x00mario</title>
		<link>http://ajaxian.com/archives/simon-willison-media-ajax/comment-page-1#comment-267433</link>
		<dc:creator>x00mario</dc:creator>
		<pubDate>Tue, 16 Sep 2008 16:21:58 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=4486#comment-267433</guid>
		<description>1/5

&lt;q&gt;Another solution with Ajax - X-Requested-By: XMLHttpRequest tells you its an XHR call, which means it came from the same domain.&lt;/q&gt;
You must never rely on HTTP header fields as security measurement.

&lt;q&gt;httpOnly cookies also not so useful because many attacks don’t rely on attacker seeing cookie.&lt;/q&gt;
Plus you can read out httpOnly cookies via XHR

&lt;q&gt;Crumb is specific to the user and could be a cookie value, in the simplest case.&lt;/q&gt;
Don&#039;t encourage users to use solutions that can be easily circumvented. Also one single XSS makes ANY token based protection useless on the whole site (domain).</description>
		<content:encoded><![CDATA[<p>1/5</p>
<p><q>Another solution with Ajax &#8211; X-Requested-By: XMLHttpRequest tells you its an XHR call, which means it came from the same domain.</q><br />
You must never rely on HTTP header fields as security measurement.</p>
<p><q>httpOnly cookies also not so useful because many attacks don’t rely on attacker seeing cookie.</q><br />
Plus you can read out httpOnly cookies via XHR</p>
<p><q>Crumb is specific to the user and could be a cookie value, in the simplest case.</q><br />
Don&#8217;t encourage users to use solutions that can be easily circumvented. Also one single XSS makes ANY token based protection useless on the whole site (domain).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kriszyp</title>
		<link>http://ajaxian.com/archives/simon-willison-media-ajax/comment-page-1#comment-267432</link>
		<dc:creator>kriszyp</dc:creator>
		<pubDate>Tue, 16 Sep 2008 15:50:37 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=4486#comment-267432</guid>
		<description>The &lt;a href=&quot;http://www.sitepen.com/blog/2008/07/22/windowname-transport/&quot; rel=&quot;nofollow&quot;&gt;window.name technique&lt;/a&gt; is a great alternative to JSONP because it is secure for the consumer and allows the provider to &lt;a href=&quot;http://www.sitepen.com/blog/2008/08/18/protected-cross-domain-access-with-dojos-windowname/&quot; rel=&quot;nofollow&quot;&gt;authorize access&lt;/a&gt;. Dojo uses this for a &lt;a href=&quot;http://www.sitepen.com/blog/2008/08/01/secure-mashups-with-dojoxsecure/&quot; rel=&quot;nofollow&quot;&gt;full framework&lt;/a&gt; for loading untrusted widgets.
Also, for JSON, if you are using proper authorization (like tokens), hijacking is impossible, but if you insist on relying on the browser to provide security for you, it is better to prefix your JSON with {}&amp;&amp; rather than \* or while(true), because it doesn&#039;t require any stripping in the JSON eval, but is still an invalid script on it&#039;s own.</description>
		<content:encoded><![CDATA[<p>The <a href="http://www.sitepen.com/blog/2008/07/22/windowname-transport/" rel="nofollow">window.name technique</a> is a great alternative to JSONP because it is secure for the consumer and allows the provider to <a href="http://www.sitepen.com/blog/2008/08/18/protected-cross-domain-access-with-dojos-windowname/" rel="nofollow">authorize access</a>. Dojo uses this for a <a href="http://www.sitepen.com/blog/2008/08/01/secure-mashups-with-dojoxsecure/" rel="nofollow">full framework</a> for loading untrusted widgets.<br />
Also, for JSON, if you are using proper authorization (like tokens), hijacking is impossible, but if you insist on relying on the browser to provide security for you, it is better to prefix your JSON with {}&amp;&amp; rather than \* or while(true), because it doesn&#8217;t require any stripping in the JSON eval, but is still an invalid script on it&#8217;s own.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

