<?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: CSRF Protection Idea</title>
	<atom:link href="http://ajaxian.com/archives/csrf-protection-idea/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/csrf-protection-idea</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: Steve Marx</title>
		<link>http://ajaxian.com/archives/csrf-protection-idea/comment-page-1#comment-247089</link>
		<dc:creator>Steve Marx</dc:creator>
		<pubDate>Sat, 10 Feb 2007 04:59:37 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2100#comment-247089</guid>
		<description>I think we&#039;re missing the link to Joe&#039;s blog post about this: http://getahead.ltd.uk/blog/joe/2007/02/07/csrf_protection.html.

Sorry I&#039;m late to this thread, but this is one of the security mechanisms used by ASP.NET AJAX.  On all our async web service calls, we use the content-type &quot;application/json&quot;, so IFRAMEs and form POSTs are rejected long before they get to your web service.

This is also something I enforce in my &lt;a href=&quot;http://codeplex.com/phpmsajax&quot; rel=&quot;nofollow&quot;&gt;PHP for Microsoft AJAX Library&lt;/a&gt; project.

Joe, go for it!  I consider it a best practice for AJAX frameworks.</description>
		<content:encoded><![CDATA[<p>I think we&#8217;re missing the link to Joe&#8217;s blog post about this: <a href="http://getahead.ltd.uk/blog/joe/2007/02/07/csrf_protection.html" rel="nofollow">http://getahead.ltd.uk/blog/joe/2007/02/07/csrf_protection.html</a>.</p>
<p>Sorry I&#8217;m late to this thread, but this is one of the security mechanisms used by ASP.NET AJAX.  On all our async web service calls, we use the content-type &#8220;application/json&#8221;, so IFRAMEs and form POSTs are rejected long before they get to your web service.</p>
<p>This is also something I enforce in my <a href="http://codeplex.com/phpmsajax" rel="nofollow">PHP for Microsoft AJAX Library</a> project.</p>
<p>Joe, go for it!  I consider it a best practice for AJAX frameworks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Guinn</title>
		<link>http://ajaxian.com/archives/csrf-protection-idea/comment-page-1#comment-247020</link>
		<dc:creator>Mark Guinn</dc:creator>
		<pubDate>Thu, 08 Feb 2007 19:18:55 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2100#comment-247020</guid>
		<description>Isn&#039;t a bigger problem the fact that this makes your application unusable without Javascript enabled?  Maybe that is just assumed in this discussion...</description>
		<content:encoded><![CDATA[<p>Isn&#8217;t a bigger problem the fact that this makes your application unusable without Javascript enabled?  Maybe that is just assumed in this discussion&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ajax 2.0 Developer</title>
		<link>http://ajaxian.com/archives/csrf-protection-idea/comment-page-1#comment-247017</link>
		<dc:creator>Ajax 2.0 Developer</dc:creator>
		<pubDate>Thu, 08 Feb 2007 18:38:31 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2100#comment-247017</guid>
		<description>Joe - Couldn&#039;t we set a header on the XHR requests that identifies that it came from our site/XHR.  I believe that you can set headers with XHR, but that you can&#039;t set headers with form submissions.  Wouldn&#039;t that make it possible to do what you are suggesting?
clif - I think you might misunderstand what is CSRF. It is not general site-hacking, you might want to read the wikipedia entry. And in addition it not wise to allow any type of request (GET or POST), on requests with side-effects, GET requests should be only used for idempotent requests.
Kris</description>
		<content:encoded><![CDATA[<p>Joe &#8211; Couldn&#8217;t we set a header on the XHR requests that identifies that it came from our site/XHR.  I believe that you can set headers with XHR, but that you can&#8217;t set headers with form submissions.  Wouldn&#8217;t that make it possible to do what you are suggesting?<br />
clif &#8211; I think you might misunderstand what is CSRF. It is not general site-hacking, you might want to read the wikipedia entry. And in addition it not wise to allow any type of request (GET or POST), on requests with side-effects, GET requests should be only used for idempotent requests.<br />
Kris</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Coulter</title>
		<link>http://ajaxian.com/archives/csrf-protection-idea/comment-page-1#comment-247016</link>
		<dc:creator>Dan Coulter</dc:creator>
		<pubDate>Thu, 08 Feb 2007 18:02:48 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2100#comment-247016</guid>
		<description>Bear in mind that just because a pure post can send whatever headers it likes, that doesn&#039;t mean that a browser can do it in this case.  I don&#039;t know what the restrictions are on real-world browsers or if they&#039;ll let you specify any kind of ENCTYPE and send it along blindly.

You don&#039;t have to defend against pure posts from random hosts, but from a browser that&#039;s been hijacked, and that somewhat limits their avenues of attack.</description>
		<content:encoded><![CDATA[<p>Bear in mind that just because a pure post can send whatever headers it likes, that doesn&#8217;t mean that a browser can do it in this case.  I don&#8217;t know what the restrictions are on real-world browsers or if they&#8217;ll let you specify any kind of ENCTYPE and send it along blindly.</p>
<p>You don&#8217;t have to defend against pure posts from random hosts, but from a browser that&#8217;s been hijacked, and that somewhat limits their avenues of attack.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe Walker</title>
		<link>http://ajaxian.com/archives/csrf-protection-idea/comment-page-1#comment-247013</link>
		<dc:creator>Joe Walker</dc:creator>
		<pubDate>Thu, 08 Feb 2007 17:37:09 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2100#comment-247013</guid>
		<description>@Ajax 2.0 Developer: The idea was speculative - we have other CSRF protection in DWR. I&#039;d not thought about ENCTYPE, but yes we would need to ensure that the format was not one that could be emulated from a form post.

Joe.</description>
		<content:encoded><![CDATA[<p>@Ajax 2.0 Developer: The idea was speculative &#8211; we have other CSRF protection in DWR. I&#8217;d not thought about ENCTYPE, but yes we would need to ensure that the format was not one that could be emulated from a form post.</p>
<p>Joe.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: clif</title>
		<link>http://ajaxian.com/archives/csrf-protection-idea/comment-page-1#comment-247012</link>
		<dc:creator>clif</dc:creator>
		<pubDate>Thu, 08 Feb 2007 17:35:12 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2100#comment-247012</guid>
		<description>I&#039;m sorry but WTF???

Ok, it rejects one form of submission but not the other?  How the hell is that any more secure?  Oh noes!  I was about to hack this web app with a GET, but they want a POST....I guess I&#039;ll go to another easier to hack site.

I&#039;m sorry, but this just doesn&#039;t prevent anyone who knows what they are doing...nor will it help developers who actually know how to program and filter out the bad requests.

Most of my web apps SPECIFICALLY allow for any request.  Sometimes its easier to bookmark something if I use one as opposed to the other.  is it just that the majority of the &#039;web programmers&#039; out there have absolutely no real programming skills (I say after beating my head against a wall a week ago trying to explain to a friend how to prevent SQL Injection and not being able to get them to understand no matter how simplified I made it...luckily, they had a recent backup....)</description>
		<content:encoded><![CDATA[<p>I&#8217;m sorry but WTF???</p>
<p>Ok, it rejects one form of submission but not the other?  How the hell is that any more secure?  Oh noes!  I was about to hack this web app with a GET, but they want a POST&#8230;.I guess I&#8217;ll go to another easier to hack site.</p>
<p>I&#8217;m sorry, but this just doesn&#8217;t prevent anyone who knows what they are doing&#8230;nor will it help developers who actually know how to program and filter out the bad requests.</p>
<p>Most of my web apps SPECIFICALLY allow for any request.  Sometimes its easier to bookmark something if I use one as opposed to the other.  is it just that the majority of the &#8216;web programmers&#8217; out there have absolutely no real programming skills (I say after beating my head against a wall a week ago trying to explain to a friend how to prevent SQL Injection and not being able to get them to understand no matter how simplified I made it&#8230;luckily, they had a recent backup&#8230;.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Breen</title>
		<link>http://ajaxian.com/archives/csrf-protection-idea/comment-page-1#comment-247011</link>
		<dc:creator>Ryan Breen</dc:creator>
		<pubDate>Thu, 08 Feb 2007 17:32:57 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2100#comment-247011</guid>
		<description>On IE and probably others, you can also use a plaintext enctype.</description>
		<content:encoded><![CDATA[<p>On IE and probably others, you can also use a plaintext enctype.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ajax 2.0 Developer</title>
		<link>http://ajaxian.com/archives/csrf-protection-idea/comment-page-1#comment-247009</link>
		<dc:creator>Ajax 2.0 Developer</dc:creator>
		<pubDate>Thu, 08 Feb 2007 16:30:41 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2100#comment-247009</guid>
		<description>Forms can be submitted with the ENCTYPE parameter set to a value other than &quot;application/x-www-form-urlencoded&quot;. Most notably, you can set it to &quot;multipart/form-data&quot;, not sure if you can do others. Wouldn&#039;t that break your safeguard? Or maybe it is possible to have custom encoding type that forms can&#039;t emulate...
Also, I believe it is always good practice to insist on POST for all requests that have side effects.</description>
		<content:encoded><![CDATA[<p>Forms can be submitted with the ENCTYPE parameter set to a value other than &#8220;application/x-www-form-urlencoded&#8221;. Most notably, you can set it to &#8220;multipart/form-data&#8221;, not sure if you can do others. Wouldn&#8217;t that break your safeguard? Or maybe it is possible to have custom encoding type that forms can&#8217;t emulate&#8230;<br />
Also, I believe it is always good practice to insist on POST for all requests that have side effects.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reinier Zwitserloot</title>
		<link>http://ajaxian.com/archives/csrf-protection-idea/comment-page-1#comment-247008</link>
		<dc:creator>Reinier Zwitserloot</dc:creator>
		<pubDate>Thu, 08 Feb 2007 16:27:15 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2100#comment-247008</guid>
		<description>I do this already (deny all GET, and the server tries to read in arguments as JSON) and never realized the latent security benefits of that. Excellent!</description>
		<content:encoded><![CDATA[<p>I do this already (deny all GET, and the server tries to read in arguments as JSON) and never realized the latent security benefits of that. Excellent!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

