<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>GDS Security Blog</title>
	
	<link>http://www.gdssecurity.com/l/b</link>
	<description>Gotham Digital Science Security Blog</description>
	<pubDate>Wed, 08 Apr 2009 14:46:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/GdsSecurityBlog" type="application/rss+xml" /><item>
		<title>Creating a Patch for Human Stupidity</title>
		<link>http://feedproxy.google.com/~r/GdsSecurityBlog/~3/ed3hRZItei0/</link>
		<comments>http://www.gdssecurity.com/l/b/2009/04/08/creating-a-patch-for-human-stupidity/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 14:39:43 +0000</pubDate>
		<dc:creator>Alex Bayly</dc:creator>
		
		<category><![CDATA[General Security]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/?p=102</guid>
		<description><![CDATA[Social engineers use old tricks and new to bypass firewalls and other conventional IT security defences by taking advantage of human weakness or kindness to attack secure buildings, machine rooms, or trading floors from inside. This gives them access to information and data that they simply couldn&#8217;t get by hacking a web site. They don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Social engineers use old tricks and new to bypass firewalls and other conventional IT security defences by taking advantage of human weakness or kindness to attack secure buildings, machine rooms, or trading floors from inside. This gives them access to information and data that they simply couldn&#8217;t get by hacking a web site. They don&#8217;t have to pick locks or break windows as it’s usually easier not to. They use research, a plausible “story”, and a winning smile. A high-profile <a href="http://www.timesonline.co.uk/tol/news/uk/crime/article5563001.ece">example</a> of this type of attack was prosecuted in the UK in March 2009.</p>
<p>In September 2004, security procedures at The Sumitomo Mitsui Banking Corporation failed it when one of its security guards let friends in to play cards. The hackers installed software that recorded pictures of information on computer screens, details of keystrokes and of users&#8217; security details. They were caught when they tried to collect on the information they had harvested.</p>
<p>In 2007, a conman gained access to the safety deposit boxes at an ABN Amro bank in Antwerp&#8217;s diamond quarter, in what is thought to have been the biggest robbery ever committed by one person. The thief used no violence, <a href="http://www.independent.co.uk/news/world/europe/thief-woos-bank-staff-with-chocolates--then-steals-diamonds-worth-16314m-440755.html">just his charm</a>, to gain entry and steal gems worth €21 million. </p>
<p>&#8220;He bought chocolates for the personnel, he was a nice guy, he charmed them, got the original of keys to make copies and got information on where the diamonds were,&#8221; said Philip Claes, spokesman for the Diamond High Council in Antwerp.</p>
<p>Many people who work in offices will know that passwords, key codes, and SecureID tokens can often be simply picked up off the desks around them. If a social engineer can gain access to an office, any of this information is potentially up for grabs. The data that can be accessed using these items is very likely to be critical to the company, otherwise why defend it? </p>
<p>So how do you defend your company against an attacker who uses his knowledge of your staff to simply walk into the building? </p>
<p>The patch for human weakness is simple: education. An informed workforce is safer than one left in the dark. Managers should try to create a corporate culture in which security is everybody’s business, not just that of the IT department or the security guard. An organisation’s technological security may identify some attacks, but if the staff and organisational culture are on your side as well, then your systems will be far more secure.</p>
<p>For example, employees should understand that if legitimate IT staff need access to a machine, they should not need the employee&#8217;s help, or username and password, to do so. But if the company&#8217;s employees treat technology as a feared and mysterious thing, it leaves a hole through which a social engineer can attack. The social engineer may be given access to critical systems, simply by posing as one of the IT staff. During social engineering engagements we have had instances where employees have logged in for the social engineering team, believing them to be IT staff, and left them in charge of critical systems.</p>
<p>Since we started testing how companies&#8217; systems hold up against social engineering attacks, we have been surprised by how easy it is to operate in a crowded room. We have even worked in restricted access areas and never been challenged. Looking like you belong and are busy can make people leave you alone. Why does this work? </p>
<p>Most organisations&#8217; security policies require that staff ask people who they do not recognise for company ID. But especially in Britain, asking for ID is seen as confrontational behaviour and those who do it may meet more outrage than praise for their understanding of the need to challenge strangers. You need more that just a policy to resolve this problem; you need to teach people that social engineering actually happens, and that they can make a difference. </p>
<p>In the UK we are lucky enough to have a TV show called the <a href="http://www.youtube.com/watch?v=Ewo73NtwNKg">Real Hustle</a>. This show purports to teach people about the way con men work and protect them from getting hustled. If it can work for keeping peoples money in their wallets, couldn’t staff education in a similar vain keep corporate data safe? </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2009/04/08/creating-a-patch-for-human-stupidity/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.gdssecurity.com/l/b/2009/04/08/creating-a-patch-for-human-stupidity/</feedburner:origLink></item>
		<item>
		<title>When ASP.NET EventValidation Doesn’t Work</title>
		<link>http://feedproxy.google.com/~r/GdsSecurityBlog/~3/0bUu0vBCxDg/</link>
		<comments>http://www.gdssecurity.com/l/b/2009/03/19/when-aspnet-eventvalidation-doesnt-work/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 15:07:35 +0000</pubDate>
		<dc:creator>Brian Holyfield</dc:creator>
		
		<category><![CDATA[Application Security]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/?p=80</guid>
		<description><![CDATA[As a developer or security tester, it is important to know how built-in security mechanisms like EventValidation work.   Starting with version 2.0 of the .NET Framework, Microsoft introduced the concept of “EventValidation” for validating PostBack data.  The principal behind EventValidation is fairly simple &#8212; if the framework sees certain values within a [...]]]></description>
			<content:encoded><![CDATA[<p>As a developer or security tester, it is important to know how built-in security mechanisms like EventValidation work.   Starting with version 2.0 of the .NET Framework, Microsoft introduced the concept of “EventValidation” for validating PostBack data.  The principal behind EventValidation is fairly simple &#8212; if the framework sees certain values within a PostBack that it doesn’t know about, it throws an exception.  The official explanation from MSDN is included below:</p>
<blockquote><p>The event validation mechanism reduces the risk of unauthorized postback requests and callbacks. When the EnableEventValidation property is set to true, ASP.NET allows only the events that can be raised by the control during a postback request or callback.</p>
<p style="text-align: right;">&#8211; MSDN</p>
</blockquote>
<p>From a security point of view, this sounds like a great feature.  EventValidation actually does go a long way in protecting many non-editable application inputs (such as drop-down lists, etc) from parameter manipulation attacks.</p>
<p>Unfortunately there is very little documentation on how EventValidation works underneath the hood (you can find one attempt at an explanation <a href="http://odetocode.com/Blogs/scott/archive/2006/03/20/3145.aspx">here</a>).  One thing I have noticed is that there are some inconsistencies in how EventValidation gets enforced.  Specifically, there are certain scenarios that seemingly *should* result in a validation exception but do not.  Let’s look at a few…</p>
<p><strong>The First Scenario</strong></p>
<p>In the first scenario, we have an account maintenance page that allows users to view and potentially update their account information.  Updates are submitted by pressing the “Update” image button on the account maintenance page.  This button is a standard ASP.NET ImageButton control as shown by the code below:</p>
<p><span style="font-size: 10pt; line-height: 115%; font-family: Consolas; color: blue;">&lt;</span><span style="font-size: 10pt; line-height: 115%; font-family: Consolas; color: #a31515;">asp</span><span style="font-size: 10pt; line-height: 115%; font-family: Consolas; color: blue;">:</span><span style="font-size: 10pt; line-height: 115%; font-family: Consolas; color: #a31515;">ImageButton</span><span style="font-size: 10pt; line-height: 115%; font-family: Consolas;"> <span style="color: red;">ID</span><span style="color: blue;">=&quot;ImageButton1&quot;</span> <span style="color: red;">runat</span><span style="color: blue;">=&quot;server&quot;</span> <span style="color: red;">OnClick</span><span style="color: blue;">=&quot;ImageButton1_Click&quot;</span><span> </span><span style="color: red;">ImageUrl</span><span style="color: blue;">=&quot;/images/UpdateProfile.gif&quot;</span> <span style="color: blue;">/&gt;</span></span></p>
<p>As you can see, the image button triggers the <strong>ImageButton1_Click </strong> method within the codebehind when clicked, which will process the update.  Based on application business rules, users within certain groups are not permitted to update their profile.  As such, the developer took the following route to disable this feature:</p>
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="color: blue;">if</span> (<span style="color: #2b91af;">HttpContext</span>.Current.User.IsInRole(<span style="color: #a31515;">&quot;GUEST&quot;</span>))</span></p>
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;">{</span></p>
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;">&nbsp;&nbsp;ImageButton1.Enabled = <span style="color: blue;">false</span>;</span></p>
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;">&nbsp;&nbsp;ImageButton1.ImageUrl = <span style="color: #a31515;">&quot;/images/UpdateProfileDisabled.gif&quot;</span>;</span></p>
<p><span style="font-size: 10pt; line-height: 115%; font-family: Consolas;">}</span></p>
<p>As you can see, if the user is in the “Guest” role, the button will be disabled and a grayed out image button will be displayed instead.  For reference, the HTML generated by this code is shown below:</p>
<p><span style="font-size: 10pt; line-height: 115%; font-family: Consolas; color: blue;">&lt;</span><span style="font-size: 10pt; line-height: 115%; font-family: Consolas; color: #a31515;">input</span><span style="font-size: 10pt; line-height: 115%; font-family: Consolas;"> <span style="color: red;">type</span><span style="color: blue;">=&quot;image&quot;</span> <span style="color: red;">name</span><span style="color: blue;">=&quot;ImageButton1&quot;</span> <span style="color: red;">id</span><span style="color: blue;">=&quot;Image1&quot;</span> <span style="color: red;">disabled</span><span style="color: blue;">=&quot;disabled&quot;</span> <span style="color: red;">src</span><span style="color: blue;">=&quot;/images/UpdateProfile.gif&quot;</span><span style="color: blue;">/&gt;</span></span></p>
<p>At this point, some of you are undoubtedly thinking about a possible attack here.  The ImageButton control is disabled, but if the logic within the associated OnClick method (ImageButton1_Click) doesn’t perform the same role check, then the user can still submit a request to update their profile by forcing the request (even though the button has been disabled).   Those of you familiar with how HTML works know that simply removing the <em>disabled=”disabled”</em> portion of the HTML INPUT tag shown above will enable the button within the browser.  Once the enabled button is clicked, the <strong>ImageButton1_Click</strong> method will be invoked.</p>
<p>This is clearly bad coding on the part of the developer, however that is not the interesting part here. Based on the concept behind EventValidation, you would think that this scenario should throw an exception.  In fact, if the control were a LinkButton instead of an ImageButton, a validation exception <span style="text-decoration: underline;">would</span> be thrown.  So why doesn’t EventValidation catch this?  I’m not 100% certain but my guess is that it&#8217;s because a LinkButton controls use the EventTarget parameter to pass in the “clicked” control name whereas with an ImageButton, the actual control name is passed as the name of an input parameter (along with its .x and .y coordinates) and the EventTarget is left blank.</p>
<p><strong>Another Scenario</strong></p>
<p>Now let’s look at another scenario.  This time the page uses the <strong>OnTextChanged</strong> event of a TextBox control to determine whether the value was modified and, if so, will update the database with the new value.  As you can see from the excerpt below, the <strong>TBUserName_TextChanged</strong> method will be called when the TextBox value is changed.</p>
<p><span style="font-size: 10pt; line-height: 115%; font-family: Consolas; color: blue;">&lt;</span><span style="font-size: 10pt; line-height: 115%; font-family: Consolas; color: #a31515;">asp</span><span style="font-size: 10pt; line-height: 115%; font-family: Consolas; color: blue;">:</span><span style="font-size: 10pt; line-height: 115%; font-family: Consolas; color: #a31515;">TextBox</span><span style="font-size: 10pt; line-height: 115%; font-family: Consolas;"> <span style="color: red;">ID</span><span style="color: blue;">=&quot;TBUserName&quot;</span> <span style="color: red;">runat</span><span style="color: blue;">=&quot;server&quot;</span> <span style="color: red;">OnTextChanged</span><span style="color: blue;">=&quot;TBUserName_TextChanged&quot; /&gt;</span></span></p>
<p>Like the previous scenario, the developer uses a similar technique to prevent users outside of the “Administrators” role from updating their user name.   If the user is not in the “Admins” role, the text box will be disabled within the browser so that the user will not be permitted to update the value.</p>
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;"><span style="color: blue;">if</span> (!<span style="color: #2b91af;">HttpContext</span>.Current.User.IsInRole(<span style="color: #a31515;">&quot;ADMINS&quot;</span>))</span></p>
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;">{</span></p>
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt; font-family: Consolas;">&nbsp;&nbsp;TBUserName.Enabled = <span style="color: blue;">false</span>;</span></p>
<p><span style="font-size: 10pt; line-height: 115%; font-family: Consolas;">}</span></p>
<p>Once again, the method associated with the <strong>OnTextChanged</strong> event (TBUserName_TextChanged) needs to also perform the same role check to prevent a malicious user from bypassing the “disabled” HTML attribute.  This is another scenario where EventValidation should seemingly prevent such an attack from working since the control is not enabled, however it doesn’t.</p>
<p><strong>Other Notable Points</strong></p>
<p>Both of the scenarios outlined here will not be exploitable if the controls have their respective <em>.Visible</em> attributes set to false.  Forcing a request that uses a non-visible control (one where <em>.Visible</em> is explicitly set to “false”) will generally always trigger an EventValidation exception.  However, as you can see from the above two examples this is not always the case when only the .Enabled attribute is set to false.</p>
<p>A few other points of interest that I noticed with respect to the above scenarios:</p>
<ul>
<li>EventValidation DOES prevent users from submitting a LinkButton button when .Enabled is set to “false”</li>
<li>The OnTextChanged event will not be raised when the .ReadOnly attribute on a TextBox control is set to “false”</li>
</ul>
<p>So to summarize, Event Validation is a great feature of ASP.NET that can potentially thwart exploits where the developer may be incidentally relying on client-side controls (like the Browser) to prevent users from performing certain actions. Unfortunately, however, there is some inconsistency on how controls are treated when they are “Disabled” rather than not “Visible”.</p>
<p>The funny part is that based on the terminology alone, when asked if it is generally more secure to “Disable” something versus make it “Not Visible”, almost all security folks would recommend disabling.  Ironic isn’t it?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2009/03/19/when-aspnet-eventvalidation-doesnt-work/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.gdssecurity.com/l/b/2009/03/19/when-aspnet-eventvalidation-doesnt-work/</feedburner:origLink></item>
		<item>
		<title>Source Boston IIS7 Slides Posted</title>
		<link>http://feedproxy.google.com/~r/GdsSecurityBlog/~3/ab0IMlQWpXY/</link>
		<comments>http://www.gdssecurity.com/l/b/2009/03/17/source-boston-iis7-slides-posted/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 05:22:50 +0000</pubDate>
		<dc:creator>Brian Holyfield</dc:creator>
		
		<category><![CDATA[Application Security]]></category>

		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/?p=60</guid>
		<description><![CDATA[
My slides from the Source Boston conference last week have been posted for public consumption.  The talk discussed some of the cool new built-in features of IIS7, like the Integrated Request Pipeline and Request Filtering. Additionally, it covered the new modular architecture of IIS7 and discussed custom modules (like SPF) and various other new [...]]]></description>
			<content:encoded><![CDATA[<p>
My slides from the Source Boston conference last week have been <a href="http://www.gdssecurity.com/l/IIS7-Application-Defense-Source-Boston-2009.pdf">posted for public consumption</a>.  The talk discussed some of the cool new built-in features of IIS7, like the Integrated Request Pipeline and Request Filtering. Additionally, it covered the new modular architecture of IIS7 and discussed custom modules (like <a href="http://www.gdssecurity.com/l/spf/">SPF</a>) and various other new add-on modules that the Microsoft IIS team has released for free.
<p>Those of you not familiar with various extensions that the IIS team has released over the past several months should check out <a href="http://www.iis.net">IIS.NET</a>.  My two favorites are the <a href="http://www.iis.net/downloads/default.aspx?tabid=34&#038;g=6&#038;i=1691">URL Rewriter for IIS7</a> (think mod_rewrite for IIS) and <a href="http://www.iis.net/downloads/1825/ItemPermaLink.ashx">Dynamic IP Restrictions Extension</a>, an add-on that dynamically blocks IP addresses that violate connection threshold and timing limits (great for slowing down CGI and App Scans).
</p>
<p>
Overall, the conference was great&#8230;hats off to Stacy and the crew for a job well done.  They will be posting videos of the talks on the <a href="http://www.sourceconference.com/">Source Conference</a> site over the next few weeks, so certainly worth keeping an eye out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2009/03/17/source-boston-iis7-slides-posted/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.gdssecurity.com/l/b/2009/03/17/source-boston-iis7-slides-posted/</feedburner:origLink></item>
		<item>
		<title>.NET StockTrader from MSDN:  The new WebGoat?</title>
		<link>http://feedproxy.google.com/~r/GdsSecurityBlog/~3/766b9pE9jCs/</link>
		<comments>http://www.gdssecurity.com/l/b/2009/02/05/net-stocktrader-from-msdn-the-new-webgoat/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 16:38:43 +0000</pubDate>
		<dc:creator>Brian Holyfield</dc:creator>
		
		<category><![CDATA[Application Security]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/?p=35</guid>
		<description><![CDATA[As an application security consultant, I always like to have a vulnerable sample application handy for demonstrating web application attacks to clients.  The irony is that other than contrived vulnerable sample applications, like FoundStone&#8217;s Hacme Applications or OWASP WebGoat, good vulnerable demo applications are actually hard to find.  
Luckily the folks at Microsoft [...]]]></description>
			<content:encoded><![CDATA[<p>As an application security consultant, I always like to have a vulnerable sample application handy for demonstrating web application attacks to clients.  The irony is that other than contrived vulnerable sample applications, like <a href="http://www.foundstone.com/us/resources-free-tools.asp">FoundStone&#8217;s Hacme Applications</a> or <a href="http://www.owasp.org/index.php/Category:OWASP_WebGoat_Project">OWASP WebGoat</a>, good vulnerable demo applications are actually hard to find.  </p>
<p>Luckily the folks at Microsoft recently developed a new sample application, <a href="http://msdn.microsoft.com/en-us/netframework/bb499684.aspx">.NET StockTrader</a>, that fills this gap nicely.  The best thing about .NET StockTrader is that it was not intentionally designed to be an insecure application.  It is worth mentioning that the primary purpose of the .NET StockTrader application is to showcase the performance and interoperability of .NET Enterprise Application Server technologies like Windows Communication Foundation (WCF) and NOT a model for web application security.  That being said, for Microsoft to publish a sample application of any kind that has such obvious security bugs is interesting and would seem to be an oversight.  </p>
<p>For those interested in seeing a live demo of the application, you can find a live instance of .NET StockTrader on one of our <a href="http://trade-no-spf.gdsdemo.com">GDS Demo Sites</a>.  The items below just scratch the surface of this application as they were all quickly identified within about 10 minutes of playing around with the application.  While there are surely more issues to be found, here are some highlights:</p>
<p><strong>Failure to Restrict Authenticated URLs</strong></p>
<p>Not surprisingly, the .NET StockTrader application uses ASP.NET Forms Authentication for restricting access to protected pages.  Unfortunately, only the pages directly linked from the main navigation bar have been defined as protected resources within the web.config.  What does this mean?  Well,  pages such as <code>/PortfolioBySymbol.aspx</code> (used to display your portfolio holdings) can be directly browsed without providing proper authentication credentials. You&#8217;ll notice that a NullReferenceException gets thrown when accessing this page anonymously.  This is not by design, but due to the fact that the page attempts to read the ASP.NET forms authentication cookie and it&#8217;s missing.  Luckily the NullReferenceException saves the day here, but still a very sloppy configuration error (not to mention a code-level failure to anticipate and safely handle scenarios where the  ASP.NET Forms Authentication cookie is empty).</p>
<p><strong>Password Disclosure</strong></p>
<p>This issue highlights two major problems with the application.  As an authenticated user, try browsing to the Account Profile page.  Aside from the normal account profile data one would expect to find here, something will probably jump out at you (at least if you are a security person).  There are two form fields, appropriately marked &#8220;Password&#8221; and &#8220;Confirm Password&#8221;, which are pre-populated.  The problem here is that the actual user&#8217;s password is rendered back within two form fields.  Even though the browser masks the values from plain-sight, they can easily be revealed by viewing the HTML source (aka Right-Click -> View Source).  As I hinted at before, there are actually two issues here.  The second problem is that these passwords are actually stored in plain-text within the back-end database table used for storing profile data.  As you can see, things are starting to get ugly.</p>
<p><strong>Cross-Site Request Forgery</strong></p>
<p>The next issue is a classic Cross-Site Request Forgery (aka a one-click attack).  These attacks are certainly common, but this one is especially ugly as you will see in a moment.  Keep in mind that the premise for this sample application is an on-line stock trading web application, like eTrade.  Unfortunately, the page used to execute all BUY and SELL transactions passes all of its parameter via a single GET request similar to the following:</p>
<p><code>/Order.aspx?action=buy&#038;symbol=s:0&#038;quantity=122</code></p>
<p>The reason this is especially dangerous is that it can even be exploited through a malicious IMG or other HTML tag as shown below, so forcing a POST request is not necessary for exploit:</p>
<p><code>&lt;IMG SRC=&quot;/Order.aspx?action=buy&amp;symbol=s:0&amp;quantity=122&quot; HEIGHT=&quot;0&quot; WIDTH=&quot;0&quot; /&gt;</code></p>
<p><strong>FormsAuthenticationToken Manipulation</strong></p>
<p>Now this one is arguably the worst of the lot.  As I mentioned towards the beginning of the post, the .NET StockTrader application uses ASP.NET forms authentication.  What I didn&#8217;t mention was that the Authentication section of the web.config actually has cookie protection disabled (aka protection=&#8221;None&#8221;).  As you can imagine, this makes it trivial for anyone to decode the ASP.NET Forms Authentication Token and manipulate its contents to impersonate any, yes any, user.  Ironically this is one of those issues that does not immediately jump out at you if just viewing the cookie since the Forms Authentication Token is always HEX encoded irrespective of the protection setting .  Let&#8217;s take a look at an example: </p>
<p><code>signinform=BC970F782904ECCF027500690064003A0039000000316F04304A80C90100318975484C80C90100002F000000</code></p>
<p>The one thing that does jump out is the unusually short length of the encoded string and the abundance of NULL (00) values.  Run this string through a HEX decoder and you can quickly see the wheels come off (Hint:  75 69 64 3A 39 == U I D : 9)</p>
<p><strong>Arbitrary URL Redirection</strong></p>
<p>Last but not least, I&#8217;ll point out a less severe but equally interesting  URL that caught my eye when browsing the application:</p>
<p><code>/StockTrade.aspx?action=sell&#038;return=Portfolio.aspx&#038;holdingid=5434</code></p>
<p>Any time you see a URL or file name being passed to the application there is usually something fishy going on.  As it turns out, the &#8220;return&#8221; query string value on this page is directly assigned to the .PostBackUrl property of a LinkButton control on the page.  The result is an arbitrary URL redirection exploit when the user clicks the link button.  Ironically this bug is also dangerously close to being a Cross-Site Scripting (XSS) bug, however there appears to be some built-in escaping taking place thanks to the .NET framework (although I am sure with some further testing this could be turned into an exploitable XSS bug).  </p>
<p><strong>So What?</strong></p>
<p>I think we all would agree that the insecure code examples and sloppy configuration settings highlighted above are pretty common and easily fixed, however that&#8217;s no excuse for Microsoft publishing a sample application riddled with flaws (even if it isn&#8217;t intended to be  a showcase for application security).  As many of us know, developers often rely on sample code and reference applications like the ones published on MSDN when writing code, so mistakes like these could easily make their way into a real-world scenario. Pretty scary. </p>
<p>Ironically, ALL of these issues can be mitigated with <a href="http://www.gdssecurity.com/l/spf/">Secure Parameter Filter (SPF) for IIS</a>, which can be seen live in action protecting the same sample application at <a href="http://trade-spf.gdsdemo.com">http://trade-spf.gdsdemo.com</a>.  Also, for those interested in continuing the bug hunt, the .NET StockTrader sample application can be <a href="http://msdn.microsoft.com/en-us/netframework/bb499684.aspx">downloaded for free from MSDN</a>.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2009/02/05/net-stocktrader-from-msdn-the-new-webgoat/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.gdssecurity.com/l/b/2009/02/05/net-stocktrader-from-msdn-the-new-webgoat/</feedburner:origLink></item>
		<item>
		<title>Tamper Proofing Web Applications at Run-Time</title>
		<link>http://feedproxy.google.com/~r/GdsSecurityBlog/~3/TeFI7Vkxn2Y/</link>
		<comments>http://www.gdssecurity.com/l/b/2008/12/19/tamper-proofing-web-applications-at-run-time/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 21:05:20 +0000</pubDate>
		<dc:creator>Joe Hemler</dc:creator>
		
		<category><![CDATA[Application Security]]></category>

		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/2008/12/19/tamper-proofing-web-applications-at-run-time/</guid>
		<description><![CDATA[Earlier this week we presented at the OWASP NY/NJ chapter meeting on &#8220;Tamper Proofing Web Applications at Run-Time&#8221;.             The talk presented some strategies and free solutions for protecting web applications from input driven attacks.          [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this week we presented at the <a href="https://lists.owasp.org/pipermail/owasp-nynjmetro/2008-December/000368.html" target="_blank">OWASP NY/NJ chapter meeting</a> on &#8220;Tamper Proofing Web Applications at Run-Time&#8221;.             The talk presented some strategies and free solutions for protecting web applications from input driven attacks.             The goal is to harden web applications so their non-editable inputs cannot be manipulated, which when left unchecked are a root cause of authorization bypass vulnerabilities such as parameter manipulation, forceful browsing, business logic flaws, etc.                         You can download the <a href="http://www.gdssecurity.com/l/TamperProofing-OWASP-NYC-12-16-2008.pdf">presentation slides here</a>.</p>
<p>Non-editable inputs are those that end-users do not need to modify directly &#8216; hidden form fields, URIs and QueryString parameters, cookies, etc.             Traditional approaches to protecting this data &#8216; black list and/or white list validation &#8216; are insufficient as they cannot normally prevent authorization flaws within the context of a user&#8217;s session.</p>
<p>Our talk demonstrated two freely available solutions that provide this type of protection for existing web applications without the need to modify the underlying application source code.             In general, they both operate on the theory that the application should only permit users to perform those actions that the UI has rendered to them.             The idea is to leverage HTTP responses at run-time to identify all legitimate requests (forms and links), collect the state of each possible request, and then validate subsequent requests against the stored state information.             Specifically, we cover <a href="http://www.hdiv.org" target="_blank">HDIV (HTTP Data Integrity Validator)</a> for J2EE web applications and <a href="http://www.gdssecurity.com/l/spf/">SPF (Secure Parameter Filter)</a> for .NET web applications. The implementation details of each are discussed as well as related pros and cons.</p>
<p>You can download the <a href="http://www.gdssecurity.com/l/TamperProofing-OWASP-NYC-12-16-2008.pdf">presentation slides here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2008/12/19/tamper-proofing-web-applications-at-run-time/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.gdssecurity.com/l/b/2008/12/19/tamper-proofing-web-applications-at-run-time/</feedburner:origLink></item>
		<item>
		<title>OWASP Boston Slides and SPF Public Demo Site</title>
		<link>http://feedproxy.google.com/~r/GdsSecurityBlog/~3/NjYnDiezepM/</link>
		<comments>http://www.gdssecurity.com/l/b/2008/12/04/owasp-boston-slides-and-spf-public-demo-site/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 21:45:40 +0000</pubDate>
		<dc:creator>Brian Holyfield</dc:creator>
		
		<category><![CDATA[Application Security]]></category>

		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/2008/12/04/owasp-boston-slides-and-spf-public-demo-site/</guid>
		<description><![CDATA[The slide deck from the &#8220;Tamper Proofing Web Applications at Runtime&#8221; talk I gave last night at the OWASP Boston meeting are now available for download.
We also released version 1.0.1 of SPF earlier this week and have a public SPF demo site running .NET PetShop v4 from MSDN.        [...]]]></description>
			<content:encoded><![CDATA[<p>The slide deck from the &#8220;Tamper Proofing Web Applications at Runtime&#8221; talk I gave last night at the OWASP Boston meeting are now <a href="/l/TamperProofing-OWASP-Boston-12-03-2006.pdf">available for download</a>.</p>
<p>We also released version 1.0.1 of SPF earlier this week and have a public <a href="http://ps4-spf.gdsdemo.com/">SPF demo site</a> running .NET PetShop v4 from MSDN.             More information on SPF can be found on its <a href="/l/spf/">official page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2008/12/04/owasp-boston-slides-and-spf-public-demo-site/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.gdssecurity.com/l/b/2008/12/04/owasp-boston-slides-and-spf-public-demo-site/</feedburner:origLink></item>
		<item>
		<title>Key Principles in Writing Secure Code Webinar</title>
		<link>http://feedproxy.google.com/~r/GdsSecurityBlog/~3/Tsvcm0E8qCg/</link>
		<comments>http://www.gdssecurity.com/l/b/2008/10/29/key-principles-in-writing-secure-code-webinar/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 17:15:12 +0000</pubDate>
		<dc:creator>Joe Hemler</dc:creator>
		
		<category><![CDATA[Application Security]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/2008/10/29/key-principles-in-writing-secure-code-webinar/</guid>
		<description><![CDATA[We just wrapped up a webinar titled &#8220;Key Principles in Writing Secure Code&#8221; for one of our training partners, Intense School. The target audience was primarily folks involved with application development looking for an introduction to Application Security. Here are some of the key points covered in the presentation:

The OWASP Top Ten Web Application Vulnerabilities
.NET [...]]]></description>
			<content:encoded><![CDATA[<p>We just wrapped up a <a href="http://www.gdssecurity.com/l/webinars/20081022/lib/playback.html" target="_blank">webinar</a> titled &#8220;Key Principles in Writing Secure Code&#8221; for one of our training partners, <a href="http://www.intenseschool.com/" target="_blank">Intense School</a>. The target audience was primarily folks involved with application development looking for an introduction to Application Security. Here are some of the key points covered in the presentation:</p>
<ul>
<li>The <a href="http://www.owasp.org" target="_blank">OWASP</a> Top Ten Web Application Vulnerabilities</li>
<li>.NET and Java Secure Coding Practices</li>
<li>The Secure Development Lifecycle</li>
<li>Tools for Hacking web applications</li>
</ul>
<p>There are also a couple of hacking demos that target vulnerabilities in a sample banking web application.             Check it out <a href="http://www.gdssecurity.com/l/webinars/20081022/lib/playback.html" target="_blank">here</a>. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2008/10/29/key-principles-in-writing-secure-code-webinar/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.gdssecurity.com/l/b/2008/10/29/key-principles-in-writing-secure-code-webinar/</feedburner:origLink></item>
		<item>
		<title>Using SPF to Protect Against SQL Injection Worms</title>
		<link>http://feedproxy.google.com/~r/GdsSecurityBlog/~3/AmD7Zdfq1hY/</link>
		<comments>http://www.gdssecurity.com/l/b/2008/09/09/using-spf-to-protect-against-sql-injection-worms/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 16:49:02 +0000</pubDate>
		<dc:creator>Brian Holyfield</dc:creator>
		
		<category><![CDATA[Application Security]]></category>

		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/2008/09/09/using-spf-to-protect-against-sql-injection-worms/</guid>
		<description><![CDATA[When SPF was first released last month, I knew it was a great protection mechanism to thwart attacks against applications running on IIS.             What I didn&#8217;t realize was that the most urgent gap that it fills is that of thwarting SQL injection worms.
Microsoft [...]]]></description>
			<content:encoded><![CDATA[<p>When SPF was first <a href="/l/b/2008/08/22/iis-secure-parameter-filter-spf-released/">released last month</a>, I knew it was a great protection mechanism to thwart attacks against applications running on IIS.             What I didn&#8217;t realize was that the most urgent gap that it fills is that of thwarting <a href="/l/b/2008/08/21/overview-of-sql-injection-worms-for-fun-and-profit/">SQL injection worms</a>.</p>
<p>Microsoft has pitched <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=EE41818F-3363-4E24-9940-321603531989&amp;displaylang=en">UrlScan v3</a> as a band-aid solution to protect against SQL injection worm attacks on classic ASP and ASP.NET applications.             The reality is that UrlScan&#8217;s capabilities to protect applications-level attacks are quite limited.             Specifically, UrlScan is not able analyze POST data and lacks support for regular expressions.             This combined with the inability to include or exclude specific URLs leaves many users unable to adequately protect their vulnerable applications.             Unfortunately with UrlScan it&#8217;s an all or nothing approach.</p>
<p>SPF overcomes both of these shortcomings.             Unlike UrlScan, SPF is specifically designed to thwart application-level attacks.             UrlScan is not.             UrlScan was originally designed to protect IIS web servers from the onslaught of web server attacks that surfaced shortly after the turn of the millennium (i.e. Code Red, Nimda, etc).             UrlScan is very effective as a server-level protection mechanism; however the reality is that it simply was not designed to be an application-level protection mechanism.</p>
<p>Last week, an updated beta of SPF was released which has been significantly optimized for performance in Black-List only configuration mode.             I have come up with the following sample configuration which can be used to protect IIS6 applications from SQL injection attacks (applications hosted on IIS7 can also use this configuration).             Keep in mind that these patterns are designed to prevent false positive hits while still allowing most sites to function;             using blanket deny rules against strings like &#8220;exec&#8221;, for example, won&#8217;t work in most real-world situations (strings like this occur way too often in most free-text submissions).                         I experienced this first-hand when attempting to implement UrlScan on a customer website using the sample <a href="http://blogs.iis.net/nazim/archive/2008/06/30/using-the-new-rules-configuration-in-urlscan-v3-0-beta-part-2.aspx">SQL Injection rules published on the IIS.NET Security Blog</a>.</p>
<p>The Black-List only sample configuration for SPF is shown below:</p>
<pre>
&lt;spfConfig logDirectory="c:\\temp\\logs" protectForm="false" protectUri="false"
protectQueryString="false" protectCookie="false" protectMode="Active"
defaultUrl="/default.asp"&gt;

        &lt;protectedFileExtensions&gt;
                       &lt;add extension=".asp" /&gt;
                       &lt;add extension=".aspx" /&gt;
                   &lt;/protectedFileExtensions&gt;

        &lt;blackListPatterns&gt;
                       &lt;add patternRegex="(select|grant|delete|insert|drop|alter|replace|
                       truncate|update|create|rename|describe)\\s+.*\\s+(from|into|table|
                       database|index|view|set)" applyTo="all" /&gt;
                       &lt;add patternRegex="'?\\s+OR\\s.+=" applyTo="all" /&gt;
                       &lt;add patternRegex="(--|;|*|@@|0x|DECLARE|..|.dbo.)" applyTo="all" /&gt;
                       &lt;add patternRegex="(CAST|EXEC|CHAR)(%|()" applyTo="all" /&gt;
                       &lt;add patternRegex="(s|x)p_" applyTo="all" /&gt;
                   &lt;/blackListPatterns&gt;

&lt;/spfConfig&gt;</pre>
<p>If anyone has any additional ideas on good SQL attack patterns to look for, feel free to share your thoughts.             Keep in mind SPF BlackListPatterns are not case sensitive and are applied to decoded request data.             As always, this is not intended to be permanent solution for SQL injection (as opposed to fixing your code); however it certainly raises the bar for bad guys and will buy you some time to implement the optimal fix.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2008/09/09/using-spf-to-protect-against-sql-injection-worms/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.gdssecurity.com/l/b/2008/09/09/using-spf-to-protect-against-sql-injection-worms/</feedburner:origLink></item>
		<item>
		<title>IIS Secure Parameter Filter (SPF) Released</title>
		<link>http://feedproxy.google.com/~r/GdsSecurityBlog/~3/lWXtSsQa9MY/</link>
		<comments>http://www.gdssecurity.com/l/b/2008/08/22/iis-secure-parameter-filter-spf-released/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 13:48:36 +0000</pubDate>
		<dc:creator>Brian Holyfield</dc:creator>
		
		<category><![CDATA[Application Security]]></category>

		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/2008/08/22/iis-secure-parameter-filter-spf-released/</guid>
		<description><![CDATA[ We have publicly released the Beta version of IIS Secure Parameter Filter (SPF) on our tools page. SPF is an application security module specifically designed to thwart parameter-based attacks against applications running on Microsoft IIS web servers. SPF requires minimal initial configuration and does not require making any modification to the underlying application code.
Those [...]]]></description>
			<content:encoded><![CDATA[<p> We have publicly released the Beta version of <a href="/l/t.php">IIS Secure Parameter Filter (SPF)</a> on our tools page. SPF is an application security module specifically designed to thwart parameter-based attacks against applications running on Microsoft IIS web servers. SPF requires minimal initial configuration and does not require making any modification to the underlying application code.</p>
<p>Those of you who attended the &#8220;<a href="/l/Protecting_Vulnerable_Applications_with_IIS7-Blackhat08-Brian_Holyfield.pdf">Protecting Vulnerable Applications with IIS7</a>&#8221; talk which I presented at Black Hat earlier this month will recognize SPF as the module which I demonstrated. The version we released today works with both IIS6 and IIS7 and is written in managed .NET code.</p>
<p>So what exactly does SPF do? SPF provides two primary protection mechanisms which are each explained in more detail below.</p>
<p><strong>Tamper Protection</strong></p>
<p>The tamper protection capabilities of SPF are primarily designed to thwart authorization attacks. Tamper protection works at the following levels:</p>
<ul>
<li>URI Protection - Protected URI&#8217;s require a cryptographic token to access. The only way to obtain a valid URI token is for the application to present you with a link to the URI. This is primarily designed to thwart direct browsing attacks where users can forcefully request pages for which they are not entitled.</li>
</ul>
<ul>
<li>Query String Protection - Protected query string values are validated using a cryptographic token which ensures they were not tampered with. This protection is designed to secure embedded query string values from manipulation.</li>
</ul>
<ul>
<li>Form Field Protection - Protected form fields that contain embedded values (i.e. Hidden Fields and Select Lists) are encrypted to prevent un-authorized viewing or modification by malicious users.</li>
</ul>
<ul>
<li>HTTP Cookie Protection - Protected cookies are encrypted to prevent un-authorized viewing or modification by malicious users.</li>
</ul>
<p>SPF tokens can also be bound to the calling user and set to expire, resulting in the ability to protect against Cross-Site Request Forgery and thwart certain types of hijacking, replay and cross-site scripting attacks.</p>
<p><strong>Malicious Input Filtering</strong></p>
<p>Malicious input filtering (referred to as Black List Protection) is designed to identify parameters that include known attack patterns. SPF supports Black List pattern matching against Query Strings, Post data, and Cookie values.</p>
<p>In some ways, this functionality can be compared to existing server filters like Microsoft&#8217;s URL Scan, but SPF provides much more flexible capabilities. Black List Protection was originally not within the scope of SPF&#8217;s protection mechanisms, however with the recent wave of SQL Injection worms it became apparent that URLScan (specifically the recently released 3.0 Beta version) is not sufficient for protecting web applications from attack.</p>
<p>URLScan is a good server-level protection mechanism that has been adapted to provide basic web application protection whereas SPF is designed specifically to defend web applications and therefore can provide more comprehensive protection against harmful input. SPF&#8217;s Black List Protection provides the following:</p>
<ul>
<li>Regular Expression Support - Provide a powerful mechanism for defining malicious input patterns</li>
<li>Flexible Request Entity Coverage &#8216; Black List patterns can be applied to any combination of Query Strings, Post data or Cookie values. This level of HTTP request coverage is especially critical as SQL Injection worms become <a href="/l/b/2008/08/21/overview-of-sql-injection-worms-for-fun-and-profit/">more advanced</a> and move beyond exploiting Query String parameters.  Specific URLs can also be excluded from Black List coverage for greater flexibility.</li>
</ul>
<p>SPF is currently available for free download and use from the <a href="/l/t.php">GDS Tools</a> page. The current Beta of SPF provides full protection for any application running on IIS7 and for ASP.NET applications running on IIS6. Non-ASP.NET applications on IIS6 will be limited to only the Malicious Input Filtering (Black-List) capabilities of SPF. A detailed administration guide is included with the download.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2008/08/22/iis-secure-parameter-filter-spf-released/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.gdssecurity.com/l/b/2008/08/22/iis-secure-parameter-filter-spf-released/</feedburner:origLink></item>
		<item>
		<title>Overview of “SQL Injection Worms for Fun and Profit”</title>
		<link>http://feedproxy.google.com/~r/GdsSecurityBlog/~3/hLpXugz9yiM/</link>
		<comments>http://www.gdssecurity.com/l/b/2008/08/21/overview-of-sql-injection-worms-for-fun-and-profit/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 15:48:59 +0000</pubDate>
		<dc:creator>Justin Clarke</dc:creator>
		
		<category><![CDATA[Application Security]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/2008/08/21/overview-of-sql-injection-worms-for-fun-and-profit/</guid>
		<description><![CDATA[
For those of you who didn&#8217;t catch my turbo talk at Black Hat in Las Vegas, and especially those of you who looked at the slides and demo in my previous blog post and had no idea what the talk was about, I thought I&#8217;d put together a short summary of what was covered, and [...]]]></description>
			<content:encoded><![CDATA[<p>
For those of you who didn&#8217;t catch my turbo talk at Black Hat in Las Vegas, and especially those of you who looked at the slides and demo in my <a href="http://www.gdssecurity.com/l/b/2008/08/07/sql-injection-worms-for-fun-and-profit-slides-and-demo/">previous blog post</a> and had no idea what the talk was about, I thought I&#8217;d put together a short summary of what was covered, and what I demonstrated.
</p>
<p>
I began my presentation by discussing the mass SQL Injection attacks that started earlier this year (see Internet Storm Center <a href="http://isc.sans.org/diary.html?storyid=4294">coverage from the start of the year</a>), originally out of China, but now out of Eastern Europe as well. The profit motivation for these attacks is fairly obvious - inject JavaScript malware into a site&#8217;s HTML. The attacks exploit SQL Injection vulnerabilities to insert JavaScript into the database that is then rendered back into web pages. Botnets are often used to randomly attack website pages on the Internet (chosen using Google, for example) with a generic SQL Injection attack.  The attacks have one shot at success - it either works or it doesn&#8217;t. The major upside of using a botnet is that even a low success rate can be devastating as they can still compromise hundreds of thousands of pages. Even worse, the indiscriminate nature of botnet attacks make it so potential victims no longer have to wander off to the deep dark corners of the Internet to face the possibility of some malicious content being installed on their machines, because any site could potentially be infected.
</p>
<p>
There are some other profit motivations that to date we haven&#8217;t seen exploited. Namely, unlike the more common botnet attacks that seem to largely target home users for their personal information and details, the mass SQL Injection attacks have a different target - websites developed by organizations and businesses, large and small. Some of which may have some very interesting information, such as customer data and (regardless of whether it is supposed to be there according to the PCI DSS) credit card information.   Another target are websites that are on DMZ&#8217;s behind outer perimeter controls (e.g. firewalls), and therefore may provide a useful pathway into an organization&#8217;s network, and all of the interesting information and data residing there.
</p>
<p>
Building on these attack scenarios, I then speculated on aspects of the current mass SQL Injection attacks that could lead to more serious exploitation. What I came up with was a self replicating SQL Injection worm, and this is what was demonstrated on stage at Black Hat.
</p>
<p><b>How does the Proof of Concept SQL Injection Worm Work?</b></p>
<p>
For the moment it is Microsoft SQL Server specific, largely because the functionality leveraging the underlying operating system is straight forward to access in SQL Server. The worm looks at the IP address it is on, and if it is an RFC 1918 private IP range it will scan the subnet looking for other web servers on port 80. When it finds a website, it does a fairly simple crawl of the entire site, and then parses through the HTML code to identify query strings with parameters, as well as forms in the HTML. The worm then tests each parameter in succession for trivially identified SQL Injection vulnerabilities. If a parameter is vulnerable, the worm will then run through the following tests:
</p>
<ul>
<li>is the back end Microsoft SQL Server?</li>
<li>are stored procedures executable?</li>
<li>is the xp_cmdshell extended stored procedure executable?</li>
</ul>
<p>
If those tests succeed, the worm uses the xp_cmdshell functionality to upload a copy of itself (i.e. the payload) onto the database server. It does this by encoding the payload as a text file, echoing it up line by line, and unpacking it on the destination server using the debugger that ships with every Windows installation by default - debug.exe. Then, presuming it all worked, the reassembled worm is executed, and the spread continues. And that is all this proof of concept worm does - <em>spread</em>. All of this worked quite well live on stage, with the exploit to upload process taking about 2-3 minutes for my test network, enabling me to show a number of the worms executing in memory (as the worm doesn&#8217;t have any facility to detect whether a machine is already infected).
</p>
<p>
Yes, this particular worm does rely on an insecure configuration being present - namely that xp_cmdshell is executable. By default this is not available on SQL Server 2005, and won&#8217;t be executable unless the website has been explicitly granted privileged access to the database server, so not all vulnerable sites will be exploited by the worm. However, there are plenty of sites that are configured insecurely, running previous versions of SQL Server (that are much easier to misconfigure), and let&#8217;s not forget xp_cmdshell is also available and potentially exploitable on sites running a Sybase backend. After all, even if only one in ten sites are in this configuration, we will still have tens of thousands of vulnerable sites.
</p>
<p>
To wrap it all up, my Black Hat presentation demonstrated one particular way that things could get much worse with SQL Injection worms. Leveraging operating system access (if present) is only one potential way to wreak havoc on the Internet. There are lots of others - I for one will be very interested to see where those clever folks in China and Eastern Europe take the mass SQL Injection attacks in the near future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2008/08/21/overview-of-sql-injection-worms-for-fun-and-profit/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.gdssecurity.com/l/b/2008/08/21/overview-of-sql-injection-worms-for-fun-and-profit/</feedburner:origLink></item>
	</channel>
</rss>
