<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SquaredRoot &#187; security</title>
	<atom:link href="http://www.squaredroot.com/tag/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.squaredroot.com</link>
	<description>.Net Development in DC</description>
	<lastBuildDate>Sun, 16 Aug 2009 01:30:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>MVC Controller Action Security Hole</title>
		<link>http://www.squaredroot.com/2008/07/08/mvc-controller-action-security-hole/</link>
		<comments>http://www.squaredroot.com/2008/07/08/mvc-controller-action-security-hole/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 22:14:00 +0000</pubDate>
		<dc:creator>Troy Goode</dc:creator>
				<category><![CDATA[MVC]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">/post/2008/07/08/MVC-Controller-Action-Security-Hole.aspx</guid>
		<description><![CDATA[The latest of Stephen Walther&#8216;s invaluable ASP.Net MVC Tip series points out a MVC scenario that was previously unknown to me: passing cookies and server variables into controllers as action parameters. While the idea is neat, a comment left by Francois Ward echoed my immediate skepticism over whether this could be safe. After playing around [...]]]></description>
			<content:encoded><![CDATA[<p>The latest of <a href="http://weblogs.asp.net/stephenwalther/">Stephen Walther</a>&#8216;s invaluable <a href="http://weblogs.asp.net/stephenwalther/archive/tags/Tips/default.aspx">ASP.Net MVC Tip series</a> points out a MVC scenario that was previously unknown to me: <a href="http://weblogs.asp.net/stephenwalther/archive/2008/07/08/asp-net-mvc-tip-15-pass-browser-cookies-and-server-variables-as-action-parameters.aspx">passing cookies and server variables into controllers as action parameters</a>. While the idea is neat, <a href="http://weblogs.asp.net/stephenwalther/archive/2008/07/08/asp-net-mvc-tip-15-pass-browser-cookies-and-server-variables-as-action-parameters.aspx#6377484">a comment left by Francois Ward</a> echoed my immediate skepticism over whether this could be safe. After playing around I believe I have confirmed my suspicions that making use of this capability is a Very Bad Idea.<span id="more-13"></span></p>
<p>I&#8217;ll let Francois&#8217; comment explain the problem (emphasis mine):</p>
<blockquote><p>Tuesday, July 08, 2008 4:16 PM by Francois Ward</p>
<p>Hmm, I didn&#8217;t look into it much, but is that -safe-? I mean, if the variables in the index function are filled up automatically&#8230; it would be ok if it was only one type (all cookies, or all server variables), but since you can mix and match, <strong>whats to present me from forging a request with a cookie with the same name as the server variables</strong>?</p>
<p>I mean, it is already possible to forge anything client-related, for obvious reason&#8230; but <strong>forging info that potentially come from the server</strong>? That seems&#8230;awkward&#8230;</p>
<p>(again, keep in mind this is just my first reaction, maybe if I think it through I&#8217;ll realise what I just said is totally stupid <img src='http://www.squaredroot.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p></blockquote>
<p>Like Francois said, cookies are easily forged client-side anyway, but most developers tend to rely on the <a href="http://en.wikipedia.org/wiki/Truthiness">truthiness</a> of our server variables, specifically those that don&#8217;t come over in the HTTP request. Let me demonstrate how the issue plays out.</p>
<p>For our example I have created a method on the HomeController named Test that takes four parameters that match server variable names. Below are the descriptions of each from MSDN&#8217;s <a href="http://msdn.microsoft.com/en-us/library/ms524602.aspx">IIS Server Variables</a> article:</p>
<ul>
<li><strong>REMOTE_ADDR<br />
</strong>MSDN Says, &#8220;The IP address of the remote host that is making the request.&#8221;</li>
<li><strong>LOGON_USER</strong><br />
MSDN Says, &#8220;The Windows account that the user is impersonating while connected to your Web server. Use REMOTE_USER, UNMAPPED_REMOTE_USER, or AUTH_USER to view the raw user name that is contained in the request header. The only time LOGON_USER holds a different value than these other variables is if you have an authentication filter installed.&#8221;</li>
<li><strong>REQUEST_METHOD</strong><br />
MSDN Says, &#8220;The method used to make the request. For HTTP, this can be <strong>GET</strong>, <strong>HEAD</strong>, <strong>POST</strong>, and so on.&#8221;</li>
<li><strong>SERVER_NAME</strong><br />
The server&#8217;s host name, DNS alias, or IP address as it would appear in self-referencing URLs.</li>
</ul>
<p>My biggest concern is <strong>LOGON_USER</strong>. As described by MSDN this variable normally stores whatever the value of REMOTE_USER, UNMAPPED_REMOTE_USER, or AUTH_USER is, except when you have a third party authentication filter installed. The purpose of these authentication filters is to map the value of one of the above three request variables to a different local name. For example, you may be using a filter to map &#8220;DOMAINTroyGoode&#8221; to &#8220;DOMAIN-DMZStandardUser&#8221; and to map &#8220;DOMAINScottGuthrie&#8221; to &#8220;DOMAIN-DMZAdministrator&#8221;. If you are using such a filter and then add LOGON_USER as a parameter to one of your actions, you are suddenly opening up the ability for anyone to circumvent that authentication filter.</p>
<p>Here is the action I have created:</p>
<div class="csharpcode-wrapper">
<div class="csharpcode">
<pre class="alt"><span class="lnum">   1:</span> <span class="kwrd">public</span> <span class="kwrd">void</span> Test(   <span class="kwrd">string</span> REMOTE_ADDR,</pre>
<pre class="alteven"><span class="lnum">   2:</span>                     <span class="kwrd">string</span> LOGON_USER,</pre>
<pre class="alt"><span class="lnum">   3:</span>                     <span class="kwrd">string</span> REQUEST_METHOD,</pre>
<pre class="alteven"><span class="lnum">   4:</span>                     <span class="kwrd">string</span> SERVER_NAME )</pre>
<pre class="alt"><span class="lnum">   5:</span> {</pre>
<pre class="alteven"><span class="lnum">   6:</span>     Response.Write(</pre>
<pre class="alt"><span class="lnum">   7:</span>         <span class="kwrd">string</span>.Format(  <span class="str">"&lt;div&gt;Remote IP: {0}&lt;/div&gt;"</span> +</pre>
<pre class="alteven"><span class="lnum">   8:</span>                         <span class="str">"&lt;div&gt;User: {1}&lt;/div&gt;"</span> +</pre>
<pre class="alt"><span class="lnum">   9:</span>                         <span class="str">"&lt;div&gt;Request Method: {2}&lt;/div&gt;"</span> +</pre>
<pre class="alteven"><span class="lnum">  10:</span>                         <span class="str">"&lt;div&gt;Server Name: {3}&lt;/div&gt;"</span>,</pre>
<pre class="alt"><span class="lnum">  11:</span>             REMOTE_ADDR,</pre>
<pre class="alteven"><span class="lnum">  12:</span>             LOGON_USER,</pre>
<pre class="alt"><span class="lnum">  13:</span>             REQUEST_METHOD,</pre>
<pre class="alteven"><span class="lnum">  14:</span>             SERVER_NAME</pre>
<pre class="alt"><span class="lnum">  15:</span>         )</pre>
<pre class="alteven"><span class="lnum">  16:</span>     );</pre>
<pre class="alt"><span class="lnum">  17:</span> }</pre>
</div>
</div>
<p>And here is what this action will output without any fiddling:</p>
<p><a href="/image.axd?picture=WindowsLiveWriter/MVCRoutingSecurityHole_F8B7/Unhacked_2.jpg"><img style="border-width: 0px" src="/image.axd?picture=WindowsLiveWriter/MVCRoutingSecurityHole_F8B7/Unhacked_thumb.jpg" border="0" alt="Unhacked" width="462" height="145" /></a></p>
<p>Now I&#8217;ll tweak the Url a bit:</p>
<blockquote><p>First Url:</p>
<p><a title="http://localhost:63260/Home/Test" href="http://localhost:63260/Home/Test">http://localhost:63260/Home/Test</a></p>
<p>Second Url:</p>
<p><a title="http://localhost:63260/Home/Test?REMOTE_ADDR=Any.IP.I.Want&amp;LOGON_USER=YourDomainAdministrator&amp;REQUEST_METHOD=POST&amp;SERVER_NAME=microsoft.com" href="http://localhost:63260/Home/Test?REMOTE_ADDR=Any.IP.I.Want&amp;LOGON_USER=YourDomainAdministrator&amp;REQUEST_METHOD=POST&amp;SERVER_NAME=microsoft.com">http://localhost:63260/Home/Test?REMOTE_ADDR=Any.IP.I.Want&amp;LOGON_USER=YourDomainAdministrator&amp;REQUEST_METHOD=POST&amp;SERVER_NAME=microsoft.com</a></p></blockquote>
<p>And voilà, mischief achieved:</p>
<p><a href="/image.axd?picture=WindowsLiveWriter/MVCRoutingSecurityHole_F8B7/TotallyHaxxored_2.jpg"><img style="border-width: 0px" src="/image.axd?picture=WindowsLiveWriter/MVCRoutingSecurityHole_F8B7/TotallyHaxxored_thumb.jpg" border="0" alt="Totally Haxxored" width="462" height="145" /></a></p>
<p>Now I&#8217;m no Kevin Mitnick, but I can assure you that if I can come up with something like this in an hour or so, a dedicated hacker that is probably far smarter than I will likely give you a lot of heartache if you make use of this feature. Have any &#8220;developer mode checks&#8221; that check for 127.0.0.1 or localhost? Have any filters to try and prevent GETs on certain actions? Relying on server variables passed in to your actions would make those scenarios (and many others) unwise.  Just say no.</p>
<p>In my opinion this feature (the server variable portion) should just be removed from the MVC framework entirely or something should be put in place to prevent overwriting parameters named the same as a server variable. </p>
<div style="text-align: center;"><a href="http://www.dotnetkicks.com/kick/?url=http://www.squaredroot.com/2008/07/08/mvc-controller-action-security-hole/" style="border:0; position: relative; top: -2px;"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.squaredroot.com/2008/07/08/mvc-controller-action-security-hole/" style="border:0;" alt="Kick It on DotNetKicks.com" /></a><a href="http://dotnetshoutout.com/Submit?url=http://www.squaredroot.com/2008/07/08/mvc-controller-action-security-hole/" style="border: 0;"><img src="http://dotnetshoutout.com/image.axd?url=http://www.squaredroot.com/2008/07/08/mvc-controller-action-security-hole/" style="border:0px" alt="Shout It on DotNetShoutOuts.com" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.squaredroot.com/2008/07/08/mvc-controller-action-security-hole/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Massive BlogEngine.net Security Hole</title>
		<link>http://www.squaredroot.com/2008/04/13/massive-blogenginedotnet-security-hole/</link>
		<comments>http://www.squaredroot.com/2008/04/13/massive-blogenginedotnet-security-hole/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 02:34:00 +0000</pubDate>
		<dc:creator>Troy Goode</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[BlogEngine.net]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">/post/2008/04/13/Massive-BlogEngineDotNet-Security-Hole.aspx</guid>
		<description><![CDATA[A massive security hole in BlogEngine.net was just revealed that allows anyone to see your passwords&#8230; Danny Douglass just added a post to his blog where he explains the issue and provides a patched BlogEngine.Core assembly to resolve the issue until the next release of BlogEngine is available. I would advise anyone running BlogEngine.net to [...]]]></description>
			<content:encoded><![CDATA[<p>A massive security hole in BlogEngine.net was just revealed that allows anyone to see your passwords&#8230; Danny Douglass just added a post to his blog where he explains the issue and provides a patched BlogEngine.Core assembly to resolve the issue until the next release of BlogEngine is available.</p>
<p>
I would advise anyone running BlogEngine.net to immediately <a href="http://dannydouglass.com/post/2008/04/BlogEngine-and-the-JavaScript-HttpHandler-Serious-Security-Issue.aspx">go to Danny&#39;s blog and download &amp; install the fix</a>.
</p>
<p>
The faster we can get word out about this, the faster we can shut down this particular attack vector, so please try and get the word out to any BlogEngine.net users you are aware of and please <a href="http://www.dotnetkicks.com/security/Massive_BlogEngine_Net_Security_Hole_Fix_Provided">kick Danny&#39;s post at DotNetKicks</a>.
</p>
<p>
Thanks Danny!</p>
<div style="text-align: center;"><a href="http://www.dotnetkicks.com/kick/?url=http://www.squaredroot.com/2008/04/13/massive-blogenginedotnet-security-hole/" style="border:0; position: relative; top: -2px;"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.squaredroot.com/2008/04/13/massive-blogenginedotnet-security-hole/" style="border:0;" alt="Kick It on DotNetKicks.com" /></a><a href="http://dotnetshoutout.com/Submit?url=http://www.squaredroot.com/2008/04/13/massive-blogenginedotnet-security-hole/" style="border: 0;"><img src="http://dotnetshoutout.com/image.axd?url=http://www.squaredroot.com/2008/04/13/massive-blogenginedotnet-security-hole/" style="border:0px" alt="Shout It on DotNetShoutOuts.com" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.squaredroot.com/2008/04/13/massive-blogenginedotnet-security-hole/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
