<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://keepitlocked.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>KeepItLocked.net : Software Security, CSRF</title><link>http://keepitlocked.net/archive/tags/Software+Security/CSRF/default.aspx</link><description>Tags: Software Security, CSRF</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP2 (Build: 20611.960)</generator><item><title>More ASP.NET CSRF Protection Options</title><link>http://keepitlocked.net/archive/2008/12/16/more-asp-net-csrf-protection-options.aspx</link><pubDate>Tue, 16 Dec 2008 21:39:00 GMT</pubDate><guid isPermaLink="false">a3f75fb5-0505-4d35-9795-aaa2ed659a71:63</guid><dc:creator>Alex</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://keepitlocked.net/rsscomments.aspx?PostID=63</wfw:commentRss><comments>http://keepitlocked.net/archive/2008/12/16/more-asp-net-csrf-protection-options.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://idunno.org/" mce_href="http://idunno.org/"&gt;Barry Dorrans&lt;/a&gt; created a filter for &lt;a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery" mce_href="http://en.wikipedia.org/wiki/Cross-site_request_forgery"&gt;CSRF&lt;/a&gt; protection in ASP.NET. It's inspired by the &lt;a href="http://blog.codeville.net/2008/09/01/prevent-cross-site-request-forgery-csrf-using-aspnet-mvcs-antiforgerytoken-helper/" mce_href="http://blog.codeville.net/2008/09/01/prevent-cross-site-request-forgery-csrf-using-aspnet-mvcs-antiforgerytoken-helper/"&gt;ASP.NET MVC CSRF token&lt;/a&gt; approach. It's a simple and effective protection mechanism when you can't use the &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.page.viewstateuserkey.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.web.ui.page.viewstateuserkey.aspx"&gt;ViewStateUserKey&lt;/a&gt; because you've disabled ViewState. It doesn't rely on sessions either. Now if I could only get him to support GET requests on an opt-in basis! Check out &lt;a href="http://idunno.org/archive/2008/12/14/announcing-anticsrf-for-asp.net.aspx" mce_href="http://idunno.org/archive/2008/12/14/announcing-anticsrf-for-asp.net.aspx"&gt;his blog post&lt;/a&gt; and the code on &lt;a href="http://www.codeplex.com/AntiCSRF/Release/ProjectReleases.aspx" mce_href="http://www.codeplex.com/AntiCSRF/Release/ProjectReleases.aspx"&gt;Codeplex&lt;/a&gt;.&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://keepitlocked.net/archive/2008/12/16/more-asp-net-csrf-protection-options.aspx&amp;amp;;subject=More+ASP.NET+CSRF+Protection+Options" target="_blank" title = "Post http://keepitlocked.net/archive/2008/12/16/more-asp-net-csrf-protection-options.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://keepitlocked.net/archive/2008/12/16/more-asp-net-csrf-protection-options.aspx&amp;amp;;title=More+ASP.NET+CSRF+Protection+Options" target="_blank" title = "Post http://keepitlocked.net/archive/2008/12/16/more-asp-net-csrf-protection-options.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://keepitlocked.net/archive/2008/12/16/more-asp-net-csrf-protection-options.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://keepitlocked.net/archive/2008/12/16/more-asp-net-csrf-protection-options.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://keepitlocked.net/archive/2008/12/16/more-asp-net-csrf-protection-options.aspx&amp;amp;title=More+ASP.NET+CSRF+Protection+Options" target="_blank" title = "Post http://keepitlocked.net/archive/2008/12/16/more-asp-net-csrf-protection-options.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://keepitlocked.net/archive/2008/12/16/more-asp-net-csrf-protection-options.aspx&amp;amp;;title=More+ASP.NET+CSRF+Protection+Options" target="_blank" title = "Post http://keepitlocked.net/archive/2008/12/16/more-asp-net-csrf-protection-options.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://keepitlocked.net/archive/2008/12/16/more-asp-net-csrf-protection-options.aspx&amp;amp;;title=More+ASP.NET+CSRF+Protection+Options&amp;amp;;top=1" target="_blank" title = "Post http://keepitlocked.net/archive/2008/12/16/more-asp-net-csrf-protection-options.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://keepitlocked.net/aggbug.aspx?PostID=63" width="1" height="1"&gt;</description><category domain="http://keepitlocked.net/archive/tags/Software+Security/default.aspx">Software Security</category><category domain="http://keepitlocked.net/archive/tags/CSRF/default.aspx">CSRF</category><category domain="http://keepitlocked.net/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Preventing CSRF with CsrfGuard</title><link>http://keepitlocked.net/archive/2008/10/17/preventing-csrf-the-right-way.aspx</link><pubDate>Fri, 17 Oct 2008 22:00:00 GMT</pubDate><guid isPermaLink="false">a3f75fb5-0505-4d35-9795-aaa2ed659a71:38</guid><dc:creator>Alex</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://keepitlocked.net/rsscomments.aspx?PostID=38</wfw:commentRss><comments>http://keepitlocked.net/archive/2008/10/17/preventing-csrf-the-right-way.aspx#comments</comments><description>&lt;p&gt;Edit: I realized I didn't mention the multitude of other ways to discourage CSRF including re-authentication, CAPTCHA, referrer checking, etc. This article deals only with the "secret token" approach to stopping CSRF.&lt;br&gt;&lt;/p&gt;&lt;p&gt;CSRF (&lt;a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery" mce_href="http://en.wikipedia.org/wiki/Cross-site_request_forgery"&gt;Cross-Site Request Forgery&lt;/a&gt;) attacks occur when an attacker forces a victim to perform an action unintentionally - "forging" a request from the victim, usually by using &amp;lt;img&amp;gt; tags (GET) or self-submitting forms (POST) in an attacker-controlled page the victim views.
&lt;/p&gt;&lt;p&gt;CSRF attacks work because the browser likes to "auto-authenticate" to sites. Session IDs in cookies, HTTP, and NTLM authentication tokens are all automatically sent by the browser when it makes a request to a site. Thus, when the victim makes a request to site unintentionally, they do so with their full privileges.
&lt;/p&gt;&lt;p&gt;A simple solution is to include an additional, unguessable token as a request argument. The application verifies this CSRF token against a server-side copy (or a cookie). If there's a mismatch, then a CSRF exception should be raised. This would prevent the attacker from forging the request because they can't set up a valid form without this secret value.
&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Courier New;"&gt;&amp;lt;form action="whatever.page" method="POST"&amp;gt;
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Courier New;"&gt;…
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Courier New;"&gt;&amp;lt;input type="hidden" name="CSRFToken" value="SomeSecretValue" /&amp;gt;
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Courier New;"&gt;&amp;lt;input type="Submit" value="Click Me"/&amp;gt;
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Courier New;"&gt;&amp;lt;/form&amp;gt;
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;This type of solution is suggested by some &lt;a href="http://www.gnucitizen.org/blog/preventing-csrf/" mce_href="http://www.gnucitizen.org/blog/preventing-csrf/"&gt;reputable&lt;/a&gt;
		&lt;a href="http://freedom-to-tinker.com/sites/default/files/csrf.pdf" mce_href="http://freedom-to-tinker.com/sites/default/files/csrf.pdf"&gt;sources&lt;/a&gt; in &lt;a href="http://shiflett.org/articles/cross-site-request-forgeries" mce_href="http://shiflett.org/articles/cross-site-request-forgeries"&gt;application&lt;/a&gt;
		&lt;a href="http://www.isecpartners.com/files/XSRF_Paper_0.pdf" mce_href="http://www.isecpartners.com/files/XSRF_Paper_0.pdf"&gt;security&lt;/a&gt;. In some cases, the CSRF token is the session ID.&lt;span style="font-family: Courier New;"&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;There are problems with this solution. The salient issue is the difference between GET and POST. According to &lt;a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html" mce_href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html"&gt;RFC 2616&lt;/a&gt;, GET requests should be idempotent, meaning that they should not cause observable state-change on the server-side. If there was an RFC for CSRF, it would prohibit CSRF attacks against GET targets for this reason – there would is no reason to forge idempotent request. However, this is simply not the way GET is used in the real-world – it is used directly (the application has non-idempotent hyperlinks) or indirectly (the application accepts GET arguments just like they were POST arguments).
&lt;/p&gt;&lt;p&gt;So, GET requests need to be protected, too. Easy enough:
&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.keepitlocked.net/whatever.page?CSRFToken=SomeSecretValue" mce_href="http://www.keepitlocked.net/whatever.page?CSRFToken=SomeSecretValue"&gt;&lt;span style="font-family: Courier New;"&gt;http://www.keepitlocked.net/whatever.page?CSRFToken=SomeSecretValue&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Courier New;"&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;This works, but it's inelegant. It ruins bookmarking. Furthermore, if the CSRF token is the session ID, then placing it into a GET argument will cause it to be stored in server and proxy logs and browser history, which makes the session identifier secret more difficult to keep.
&lt;/p&gt;&lt;p&gt;So, a full-featured CSRF solution is more difficult than it seems.
&lt;/p&gt;&lt;p&gt;The &lt;a href="http://www.owasp.org/index.php/CSRF_Guard" mce_href="http://www.owasp.org/index.php/CSRF_Guard"&gt;CsrfGuard&lt;/a&gt; project is a fairly compelling solution – it overwrites all forms (POST) with an additional CSRF token argument, and it also overwrites links (GET). But, there are cases where links do not get a token:
&lt;/p&gt;&lt;ol&gt;&lt;li&gt;The link doesn't have any arguments (in which case it's likely idempotent).
&lt;/li&gt;&lt;li&gt;The link is to a .gif or other whitelisted extension.
&lt;/li&gt;&lt;li&gt;The link is in a configurable whitelist of URLs (for pages which are known to be idempotent).
&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;I like this approach because it offers the maximum amount of protection, not simply relying on developers to follow the standard and penalizing them with vulnerabilities if they don't.
&lt;/p&gt;&lt;p&gt;That's why I'm integrating the &lt;a href="http://www.owasp.org/index.php/.Net_CSRF_Guard" mce_href="http://www.owasp.org/index.php/.Net_CSRF_Guard"&gt;.NET CsrfGuard&lt;/a&gt; project into OWASP &lt;a href="https://www.owasp.org/index.php/.NET_ESAPI" mce_href="https://www.owasp.org/index.php/.NET_ESAPI"&gt;.NET ESAPI&lt;/a&gt;. It will require some tweaking, but it's the most comprehensive functionality preventing CSRF I've seen.
&lt;/p&gt;&lt;p&gt;One tweak is that the CSRF token should not be the session ID, because it increases the risk of exposure. Instead, I'll use the hash(Session ID + Salt).  This is all easily configurable with CsrfGuard.
&lt;/p&gt;&lt;p&gt;Oh yeah, what about &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.page.viewstateuserkey.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.web.ui.page.viewstateuserkey.aspx"&gt;ViewStateUserKey&lt;/a&gt;? Well, it's still there, with the weaknesses &lt;a href="http://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx" mce_href="http://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx"&gt;I've written about before&lt;/a&gt;. To me, it's like &lt;a href="http://keepitlocked.net/archive/2007/10/30/asp-net-validaterequest-and-the-html-attribute-based-cross-site-scripting.aspx" mce_href="http://keepitlocked.net/archive/2007/10/30/asp-net-validaterequest-and-the-html-attribute-based-cross-site-scripting.aspx"&gt;ValidateRequest&lt;/a&gt; – use it, but don't rely on it.&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://keepitlocked.net/archive/2008/10/17/preventing-csrf-the-right-way.aspx&amp;amp;;subject=Preventing+CSRF+with+CsrfGuard" target="_blank" title = "Post http://keepitlocked.net/archive/2008/10/17/preventing-csrf-the-right-way.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://keepitlocked.net/archive/2008/10/17/preventing-csrf-the-right-way.aspx&amp;amp;;title=Preventing+CSRF+with+CsrfGuard" target="_blank" title = "Post http://keepitlocked.net/archive/2008/10/17/preventing-csrf-the-right-way.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://keepitlocked.net/archive/2008/10/17/preventing-csrf-the-right-way.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://keepitlocked.net/archive/2008/10/17/preventing-csrf-the-right-way.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://keepitlocked.net/archive/2008/10/17/preventing-csrf-the-right-way.aspx&amp;amp;title=Preventing+CSRF+with+CsrfGuard" target="_blank" title = "Post http://keepitlocked.net/archive/2008/10/17/preventing-csrf-the-right-way.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://keepitlocked.net/archive/2008/10/17/preventing-csrf-the-right-way.aspx&amp;amp;;title=Preventing+CSRF+with+CsrfGuard" target="_blank" title = "Post http://keepitlocked.net/archive/2008/10/17/preventing-csrf-the-right-way.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://keepitlocked.net/archive/2008/10/17/preventing-csrf-the-right-way.aspx&amp;amp;;title=Preventing+CSRF+with+CsrfGuard&amp;amp;;top=1" target="_blank" title = "Post http://keepitlocked.net/archive/2008/10/17/preventing-csrf-the-right-way.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://keepitlocked.net/aggbug.aspx?PostID=38" width="1" height="1"&gt;</description><category domain="http://keepitlocked.net/archive/tags/Software+Security/default.aspx">Software Security</category><category domain="http://keepitlocked.net/archive/tags/CSRF/default.aspx">CSRF</category><category domain="http://keepitlocked.net/archive/tags/.NET+ESAPI/default.aspx">.NET ESAPI</category><category domain="http://keepitlocked.net/archive/tags/OWASP/default.aspx">OWASP</category></item><item><title>ViewStateUserKey Doesn’t Prevent Cross-Site Request Forgery</title><link>http://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx</link><pubDate>Thu, 29 May 2008 21:30:00 GMT</pubDate><guid isPermaLink="false">a3f75fb5-0505-4d35-9795-aaa2ed659a71:26</guid><dc:creator>Alex</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://keepitlocked.net/rsscomments.aspx?PostID=26</wfw:commentRss><comments>http://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx#comments</comments><description>&lt;p&gt;ViewStateUserKey is not a completely effective mitigation against Cross-Site Request Forgery. It doesn't work for non post-backs (I.e. GET requests), and it doesn't work if the ViewState MAC is turned off.
&lt;/p&gt;&lt;p&gt;In &lt;a href="http://msdn.microsoft.com/en-us/library/ms972969.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms972969.aspx"&gt;several&lt;/a&gt;
		&lt;a href="http://www.guidanceshare.com/wiki/ASP.NET_2.0_Security_Guidelines_-_Parameter_Manipulation" mce_href="http://www.guidanceshare.com/wiki/ASP.NET_2.0_Security_Guidelines_-_Parameter_Manipulation"&gt;different&lt;/a&gt;
		&lt;a href="http://channel9.msdn.com/wiki/default.aspx/Channel9.ASPNETSecurityGuidelines" mce_href="http://channel9.msdn.com/wiki/default.aspx/Channel9.ASPNETSecurityGuidelines"&gt;places&lt;/a&gt;, we see a piece of advice repeated - use the ViewStateUserKey property to prevent One-Click Attacks. Often, this piece of advice is accompanied by the following code:
&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;
			&lt;span style="color: blue;"&gt;void&lt;/span&gt; Page_Init(&lt;span style="color: blue;"&gt;object&lt;/span&gt; sender, &lt;span style="color: teal;"&gt;EventArgs&lt;/span&gt; e)
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;    {
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;        ViewStateUserKey = Session.SessionID;
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;    }
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;What exactly does this code do? To understand it, we first need to look at the ViewState mechanism itself. The ViewState is an ASP.NET mechanism used to persist the value of web controls between post-backs. This allows a lot of the drag and drop, UI-driven ASP.NET architecture to function "auto-magically" by serializing and de-serializing data automatically on the fly.
&lt;/p&gt;&lt;p&gt;The ViewState is encoded and stored as a hidden field. This introduces security issues, because the value is under the control of the client. There may be a value stored in a field that you do not want someone to see and modify, like an admin-only control with the visible property set to false.
&lt;/p&gt;&lt;p&gt;ASP.NET helps us out by introducing two mechanisms to help protect the ViewState. ViewState MAC prevents tampering with the ViewState by introducing a separate Message Authentication Code that is verified when the ViewState is submitted. ViewState Encryption protects the ViewState confidentially by encrypting the ViewState value. By default, the ViewState MAC is enabled, and ViewState Encryption is not.
&lt;/p&gt;&lt;p&gt;The ViewStateUserKey property is an optional addition to the data used in ViewState MAC calculation. If that value changes between post-backs, the ViewState MAC calculation will fail and the page will cause an error.
&lt;/p&gt;&lt;p&gt;When we set the value of ViewStateUserKey to something associated with a particular user (like a Session ID or a Username), we are making sure that the ViewState is valid &lt;i&gt;only for that user.&lt;/i&gt;
	&lt;/p&gt;&lt;p&gt;Back to One-Click Attacks. One-Click Attack is sometimes incorrectly referred to as Microsoft's name for Cross-Site Request Forgery. However, this is not entirely correct.
&lt;/p&gt;&lt;p&gt;One-Click Attacks refer to CSRF attacks that use a malicious ViewState to perform the request. Because web forms developed with ASP.NET use ViewState for post-backs, the attacker can perform the post-back they want the user to perform unknowingly, and record the ViewState. Due to the way that ASP.NET ignores HTTP verbs when using &lt;span style="font-family: Courier New;"&gt;Request.Params&lt;/span&gt; versus &lt;span style="font-family: Courier New;"&gt;Request.Form&lt;/span&gt;, and in web controls, this request can often be made via GET.
&lt;/p&gt;&lt;p&gt;Example:
&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Courier New;"&gt;http://site/Default.aspx?__VIEWSTATE=%2FwEPDwULLTExOTcyMDExODNkZAShpi32DKvqCd4uvHuQ%2FmmnBcdY&amp;amp;TextBox1=&lt;span style="color: red;"&gt;&lt;b&gt;&amp;lt;MALICIOUS_CONTROL_DATA_GOES_HERE&amp;gt;&lt;/b&gt;&lt;/span&gt;&amp;amp;Button1=Button&amp;amp;__EVENTVALIDATION=%2FwEWAwKEyYGZBwLs0bLrBgKM54rG3sCHijug9ibUUfHX808cCvcppg1i
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;This link can be used in a CSRF attack. It is then known as a one-click attack, because it uses the ViewState. This, however, is not:
&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Courier New;"&gt;http://site/DeleteUser.aspx?user_id=123456789
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;If the page is not a post-back (as in the case of a direct link), the ViewState MAC is never checked. Several ASP.NET applications allow you to modify data without submitting a form. Consider &lt;a href="http://www.asp.net/mvc/" mce_href="http://www.asp.net/mvc/"&gt;ASP.NET MVC&lt;/a&gt; - it doesn't even use post-backs.
&lt;/p&gt;&lt;p&gt;Furthermore, the ViewState MAC can be disabled at the page level:
&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="background-color: yellow;"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue;"&gt;@&lt;/span&gt;
			&lt;span style="color: maroon;"&gt;Page&lt;/span&gt;
			&lt;span style="color: red;"&gt;Language&lt;/span&gt;&lt;span style="color: blue;"&gt;="C#"&lt;/span&gt;
			&lt;span style="color: red;"&gt;EnableViewStateMac&lt;/span&gt;&lt;span style="color: blue;"&gt;="false"&lt;/span&gt;&lt;span style="background-color: yellow;"&gt;%&amp;gt;&lt;/span&gt;
		&lt;/span&gt;&lt;/p&gt;&lt;p&gt;or in &lt;span style="font-family: Courier New;"&gt;web.config&lt;/span&gt;.:
&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;pages&lt;/span&gt;&lt;span style="color: blue;"&gt;
			&lt;/span&gt;&lt;span style="color: red;"&gt;enableViewStateMac&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;false&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;      
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;pages&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;ViewState MAC is often disabled for (perceived) performance reason, or (more likely) if there is some functionality in the application that causes the ViewState MAC to cause error.
&lt;/p&gt;&lt;p&gt;This reminds of &lt;a href="http://keepitlocked.net/archive/2007/10/30/asp-net-validaterequest-and-the-html-attribute-based-cross-site-scripting.aspx" mce_href="http://keepitlocked.net/archive/2007/10/30/asp-net-validaterequest-and-the-html-attribute-based-cross-site-scripting.aspx"&gt;problems with Request Validation is ASP.NET&lt;/a&gt; - the mechanism works, sometimes. This can be dangerous, because people rely on it and can get burned. The solution is to write something similar to&lt;a href="http://www.owasp.org/index.php/Category:OWASP_CSRFGuard_Project" mce_href="http://www.owasp.org/index.php/Category:OWASP_CSRFGuard_Project"&gt; CSRFGuard&lt;/a&gt; from &lt;a href="http://www.owasp.org/index.php/Main_Page" mce_href="http://www.owasp.org/index.php/Main_Page"&gt;OWASP&lt;/a&gt; in .NET. I have a feeling that the newly resurgent &lt;a href="http://www.owasp.org/index.php/Category:OWASP_.NET_Project" mce_href="http://www.owasp.org/index.php/Category:OWASP_.NET_Project"&gt;OWASP .NET project&lt;/a&gt; will add this to their to-do list.&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx&amp;amp;;subject=ViewStateUserKey+Doesn%e2%80%99t+Prevent+Cross-Site+Request+Forgery" target="_blank" title = "Post http://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx&amp;amp;;title=ViewStateUserKey+Doesn%e2%80%99t+Prevent+Cross-Site+Request+Forgery" target="_blank" title = "Post http://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx&amp;amp;title=ViewStateUserKey+Doesn%e2%80%99t+Prevent+Cross-Site+Request+Forgery" target="_blank" title = "Post http://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx&amp;amp;;title=ViewStateUserKey+Doesn%e2%80%99t+Prevent+Cross-Site+Request+Forgery" target="_blank" title = "Post http://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx&amp;amp;;title=ViewStateUserKey+Doesn%e2%80%99t+Prevent+Cross-Site+Request+Forgery&amp;amp;;top=1" target="_blank" title = "Post http://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://keepitlocked.net/aggbug.aspx?PostID=26" width="1" height="1"&gt;</description><category domain="http://keepitlocked.net/archive/tags/Software+Security/default.aspx">Software Security</category><category domain="http://keepitlocked.net/archive/tags/CSRF/default.aspx">CSRF</category><category domain="http://keepitlocked.net/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item></channel></rss>