<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>GDS Security Blog &#187; Tools</title>
	<atom:link href="http://www.gdssecurity.com/l/b/category/tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gdssecurity.com/l/b</link>
	<description>Gotham Digital Science Security Blog</description>
	<lastBuildDate>Tue, 10 Aug 2010 14:38:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Fuzzing GWT RPC Requests</title>
		<link>http://www.gdssecurity.com/l/b/2010/05/06/fuzzing-gwt-rpc-requests/</link>
		<comments>http://www.gdssecurity.com/l/b/2010/05/06/fuzzing-gwt-rpc-requests/#comments</comments>
		<pubDate>Thu, 06 May 2010 17:59:07 +0000</pubDate>
		<dc:creator>Ron Gutierrez</dc:creator>
				<category><![CDATA[Application Security]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/?p=382</guid>
		<description><![CDATA[In a previous post,  I went through the process of parsing GWT RPC requests to determine the method and parameter values sent. In this post I will discuss, GwtParse, a tool that I wrote to automate this process in order to easily determine the values within a GWT RPC payload that can actually be manipulated. [...]]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://www.gdssecurity.com/l/b/2009/10/08/gwt-rpc-in-a-nutshell/" target="_new">previous post</a>,  I went through the process of parsing GWT RPC requests to determine the method and parameter values sent. In this post I will discuss, GwtParse, a tool that I wrote to automate this process in order to easily determine the values within a GWT RPC payload that can actually be manipulated. GwtParse can be downloaded <a href="http://www.gdssecurity.com/l/t/d.php?k=GwtParse">here</a> but I recommend you continue reading&#8230;<br />
<br />
<strong>Why use this tool?</strong></p>
<p><strong><span style="font-weight: normal">Fuzzing every delimited value in GWT RPC requests is not practical and produces a lot of unnecessary output. GWT client side code is heavily obfuscated, which makes it difficult to identify all the fuzzable values passed in the request by reviewing the JavaScript. Additionally, there could be values passed in the request that do not necessarily originate from user input. For example, assume there is a custom “User” object which contains a numeric property that indicates a user’s role membership. Manipulation of this value could result in unauthorized access to data or privileged functionality. The tool I wrote <strong>gwtparse.py</strong> will help identifying the meaningful values in a GWT RPC request so that you can more easily identify security bugs in GWT applications during a Black Box assessment.</span></strong><br />
<br />
<strong>gwtparse.py</strong></p>
<p>A command line tool that parses a GWT RPC payload and creates a new payload value with all fuzzable values identified. This new payload value can then be plugged into the web application fuzzer of your choice. The tool has currently only been tested using GWT version 2.0.</p>
<p>The following types can be parsed:</p>
<ul>
<li>Primitive Java Types and Object (ie. Integer, Double, Byte, etc )</li>
<li>Strings</li>
<li>Arraylist, Vector, LinkedList</li>
<li>Arrays</li>
<li>Custom Objects ( to a limited extent )</li>
</ul>
<p>Parsing of custom objects cannot be guaranteed to work correctly in all scenarios as they can be very complex. I created a number of test cases with custom objects, but there is bound to be cases that the current version of my tool cannot handle. I just want to point out a couple key points:</p>
<ul>
<li>Parsing a GWT RPC request is as simple as follows</li>
</ul>
<p><code>$ python gwtparse.py -i "5|0|12|http://127.0.0.1:8888/gwt_test/|4E7583E4BED25F58DDD5F1A1D675522A|<br />
com.gwttest.client.GreetingService|greetServer|java.util.ArrayList/3821976829|<br />
com.gwttest.client.CustomObj/427743781|com.gwttest.client.Person/2847577871|<br />
PersonName|java.lang.Integer/3438268394|CustomObjParam1|CustomObjParam2|<br />
CustomObjParam3|1|2|3|4|2|5|6|5|2|7|200|8|7|200|8|6|9|200|10|11|12|10|"</code><br />
<br />
Output from above command:<br />
<br />
GWT RPC Payload Fuzz String</p>
<p><code>5|0|12|http://127.0.0.1:8888/gwt_test/|4E7583E4BED25F58DDD5F1A1D675522A|<br />
com.gwttest.client.GreetingService|greetServer|java.util.ArrayList/3821976829|<br />
com.gwttest.client.CustomObj/427743781|com.gwttest.client.Person/2847577871|<br />
%s|java.lang.Integer/3438268394|%s|%s|%s|1|2|3|4|2|5|6|5|2|7|<br />
%d|8|7|%d|8|6|9|%d|10|11|12|10|</code></p>
<p>The default output of the script replaces the fuzzable string values with a %s and numeric values with a %d.  This is incredibly useful since Java is a strong typed language and will throw an exception if a string value is passed anywhere the application is expecting an Integer.</p>
<ul>
<li>Tool output can be customized so that the fuzzable values are easily recognized by your favorite fuzzer. This is done with the “-s” option, which surrounds the values with the string/character of your choice.</li>
</ul>
<ul>
<li>For Burp Suite users, there is the “-b” switch to surround the values using the Burp Intruder Position Value (Section Sign). Note that the Section Sign character is only output to the command-line when run within a terminal that can output UTF-8 values (i.e. Linux, Cygwin). Windows users can add the “-w” or “-a” switches to write or append the output to a text file.</li>
</ul>
<ul>
<li>Lastly, there is the “-p” switch that displays the request in a human readable format. This can be especially useful in identifying the values which belong to a custom object. I have included an example of this at the end of my post.</li>
</ul>
<p>The gwtparse.py program simply calls functionality available within my GWTParser object. The GWTParser object can be easily reused by testers within their own python fuzzers or tools. Hopefully, application testers will find the tool useful when tackling a GWT application assessment.</p>
<p>If you find GWT RPC payload strings which are not properly handled by my tool (which I am sure there will be), send an email to rgutierrez at gdssecurity.com and I will work on incorporating a fix for the next version. GwtParse can be downloaded <a href="http://www.gdssecurity.com/l/t/d.php?k=GwtParse">here</a><br />
<br />
<strong>Sample output when using the –p Switch to Display GWT RPC Requests in Human Readable Format</strong><br />
<br />
<code>Serialized Object:</code></p>
<p><code>5|0|12|http://127.0.0.1:8888/gwt_test/|4E7583E4BED25F58DDD5F1A1D675522A|<br />
com.gwttest.client.GreetingService|greetServer|java.util.ArrayList/3821976829|<br />
com.gwttest.client.CustomObj/427743781|com.gwttest.client.Person/2847577871|<br />
PersonName|java.lang.Integer/3438268394|CustomObjParam1|CustomObjParam2|<br />
CustomObjParam3|1|2|3|4|2|5|6|5|2|7|200|8|7|200|8|6|9|200|10|11|12|10|</code></p>
<p><code>Stream Version: 5<br />
Flags: 0<br />
Column Numbers: 12<br />
Host: http://127.0.0.1:8888/gwt_test/<br />
Hash: 4E7583E4BED25F58DDD5F1A1D675522A<br />
Class Name: com.gwttest.client.GreetingService<br />
Method: greetServer<br />
# of Params: 2</p>
<p>Parameters:<br />
{'flag': False,<br />
'is_array': False,<br />
'is_custom_obj': True,<br />
'is_list': True,<br />
'subtype': 'com.gwttest.client.Person',<br />
'typename': 'java.util.ArrayList/3821976829',<br />
'values': [&lt;Parameter.Parameter object at 0x7fee4a4c&gt;,<br />
&lt;Parameter.Parameter object at 0x7fee4a6c&gt;]}</p>
<p>{        'flag': False,<br />
'is_array': False,<br />
'is_custom_obj': True,<br />
'is_list': False,<br />
'typename': 'com.gwttest.client.Person/2847577871',<br />
'values': [200, 'PersonName']}<br />
{         'flag': False,<br />
'is_array': False,<br />
'is_custom_obj': True,<br />
'is_list': False,<br />
'typename': 'com.gwttest.client.Person/2847577871',<br />
'values': [200, 'PersonName']}</p>
<p></code></p>
<p><code>{'flag': False,<br />
'is_array': False,<br />
'is_custom_obj': True,<br />
'is_list': False,<br />
'typename': 'com.gwttest.client.CustomObj/427743781',<br />
'values': [200,<br />
'CustomObjParam1',<br />
'CustomObjParam2',<br />
'CustomObjParam3',<br />
'CustomObjParam1']}</code></p>
<p>The above “pretty” output shows that the RPC call has two parameters. The first parameter is an ArrayList of Person Objects with two member variables and the second parameter is another object called CustomObj which has five member variables.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2010/05/06/fuzzing-gwt-rpc-requests/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Penetrating Intranets through Adobe Flex Applications</title>
		<link>http://www.gdssecurity.com/l/b/2010/03/17/penetrating-intranets-through-adobe-flex-applications/</link>
		<comments>http://www.gdssecurity.com/l/b/2010/03/17/penetrating-intranets-through-adobe-flex-applications/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 15:23:35 +0000</pubDate>
		<dc:creator>Marcin Wielgoszewski</dc:creator>
				<category><![CDATA[Application Security]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/?p=356</guid>
		<description><![CDATA[In my last post, Pentesting Adobe Flex Applications with a Custom AMF Client, I described how one could write a client using Python and PyAMF to perform manual penetration testing of Flex applications.  The example application I focused on utilized RemoteObjects and communicated via binary AMF encoded messages, a common roadblock for security testers. [...]]]></description>
			<content:encoded><![CDATA[<p>In my last post, <a href="http://www.gdssecurity.com/l/b/2009/11/11/pentesting-adobe-flex-applications-with-a-custom-amf-client/" title="Pentesting Adobe Flex Applications with a Custom AMF Client">Pentesting Adobe Flex Applications with a Custom AMF Client</a>, I described how one could write a client using Python and PyAMF to perform manual penetration testing of Flex applications.  The example application I focused on utilized RemoteObjects and communicated via binary AMF encoded messages, a common roadblock for security testers.  If you are new to penetration testing Flex applications, I suggest reading my previous post to familiarize yourself with Flex and the techniques I discussed.</p>
<p></p>
<p>In this post, I&#8217;ll show how you can exploit Flex applications that use BlazeDS to gain access to internal networks and other hosts behind the firewall.  BlazeDS is a Java-based remoting server that allows developers to utilize existing application logic and web services in Flex applications.  The following also applies to applications that use Adobe LiveCycle Data Services ES.</p>
<p></p>
<p>A common insecure configuration that we encounter when assessing Flash applications is an insecure crossdomain.xml policy file (usually hosted within a web site&#8217;s root directory). By default, a Flash application hosted on domain A cannot access resources from domain B unless domain B has configured their cross-domain policy to allow domain A. More often than not, the cross domain policy file has been configured to allow the entire world access rather than a specific list of trusted domains. Now, assuming the cross domain policy file has been secured, developers of Flex applications that consume data from external web services must now incorporate this restriction into their design. This makes it difficult to develop Flex applications that will be hosted on multiple, possibly untrusted domains.</p>
<p></p>
<p>Enter BlazeDS. To get around the restrictions imposed by cross-domain policy files, BlazeDS allows developers to configure &#8220;Proxy Services&#8221;. Using Proxy Services, BlazeDS will make calls to remote service destinations on behalf of the Flex application. BlazeDS Proxy Services allows Flex applications to consume SOAP and Web Services hosted on other domains without the need for a cross-domain policy. A common use case for proxy services is to allow external access to internally hosted web services via a specified destination. A typical proxy service is configured like so (see <a href="http://livedocs.adobe.com/blazeds/1/blazeds_devguide/rpc_httpws_04.html" title="BlazeDS Developer Guide">BlazeDS Developer Guide</a> for more detail):</p>
<pre># contents of WEB-INF\flex\proxy-config.xml:
&lt;service id="proxy-service" class="flex.messaging.services.HTTPProxyService"&gt;
&nbsp;&nbsp;...
&nbsp;&nbsp;
&nbsp;&nbsp;&lt;destination id="web-service"&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;properties&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dynamic-url&gt;http://ws.localdomain:9899/web/service/content.jsp&lt;/dynamic-url&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/properties&gt;
&nbsp;&nbsp;&lt;/destination&gt;
&nbsp;&nbsp;
&nbsp;&nbsp;&lt;destination id="soap-service"&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;properties&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;wsdl&gt;http://ws.localdomain:9899/ws?wsdl&lt;/wsdl&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;soap&gt;*&lt;/soap&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/properties&gt;
&nbsp;&nbsp;&lt;/destination&gt;
&lt;/service&gt;
</pre>
<p></p>
<p>In the <em>proxy-config.xml</em> above, we have two destinations defined: web-service and soap-service.  If you look closely, the <em>soap</em> property has an asterisk (wildcard) defined.  This property can define an absolute domain and path, however like cross-domain policies, an asterisk permits BlazeDS to make requests to any hosts it can reach on the network that match this property. This is a common occurrence, due in part to sample configuration files supplied with BlazeDS and lack of awareness on part of those responsible for securing the application server.  In more secure configurations, this property is set to a strict domain or path (such as the web-service destination).</p>
<p></p>
<p>If you want to build a Flex client that communicates with Proxy Services, you&#8217;ll need to familiarize yourself with the following objects (refer to the <a href="http://livedocs.adobe.com/flex/3/langref/index.html" title="Adobe Flex Language Reference">Flex Language Reference</a> for more information):</p>
<ul>
<li>mx.rpc.http.HTTPService (url)</li>
<li>mx.rpc.http.mxml.HTTPService(url)</li>
<li>mx.messaging.messages.HTTPRequestMessage (url)</li>
<li>mx.rpc.soap.WebService (endpointURI)</li>
<li>mx.rpc.soap.mxml.SOAPService (endpointURI)</li>
<li>mx.messaging.messages.SOAPMessage (url)</li>
</ul>
<p>Without further ado, I&#8217;d like to introduce Blazentoo, a tool I developed to exploit such functionality. With Blazentoo, you can exploit insecurely configured Proxy Services and browse internal websites, potentially those on trusted corporate networks. Just recently I was working on an assessment and I was able to successfully compromise an internal application via an exposed BlazeDS server – as this wasn&#8217;t the first (or last) time, I decided it was time to build Blazentoo.</p>
<p>To use Blazentoo, you&#8217;ll need to know the following (most of this information can be obtained by examining HTTP requests proxied through a tool like <a href="http://www.portswigger.net/suite/" title="Burp Suite">Burp Suite</a>, <a href="http://www.charlesproxy.com/" title="Charles Proxy">Charles Proxy</a>, or <a href="http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project" title="OWASP WebScarab">WebScarab</a>):</p>
<ul>
<li>AMF/HTTP endpoint (the message broker servlet that flex requests are routed to)</li>
<li>The &#8220;destination&#8221; id (if this is left blank, the DefaultHTTP destination is used)</li>
<li>An optional &#8220;channel&#8221; id (leave blank if unknown)</li>
</ul>
<p>If using SOAP, you&#8217;ll need to know the following additional information:</p>
<ul>
<li>A SOAP Action associated with the destination id, and/or</li>
<li>URL of the WSDL (required if no destination id is defined)</li>
</ul>
<p>Below is a screenshot of Blazentoo in action.  Note that the URL being accessed in this example is &#8220;http://localhost/&#8221;.  This could just as easily have been an internal IP address or hostname.</p>
<p><a href="/l/blazentoo.png"><img alt="Blazentoo in action" src="/l/blazentoo.png" class="alignnone" width="258" height="199" /></a></p>
<p>You can download Blazentoo from our <a href="http://www.gdssecurity.com/l/t.php" title="Gotham Digital Science Tools">tools</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2010/03/17/penetrating-intranets-through-adobe-flex-applications/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Abusing WCF to Perform Remote Port Scans</title>
		<link>http://www.gdssecurity.com/l/b/2010/02/12/abusing-wcf-to-perform-remote-port-scans/</link>
		<comments>http://www.gdssecurity.com/l/b/2010/02/12/abusing-wcf-to-perform-remote-port-scans/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 13:00:47 +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=267</guid>
		<description><![CDATA[Last weekend at Shmoocon, I demonstrated how an attacker can trick certain WCF web services into performing an unauthorized port scan of machines behind a firewall.  For those that were not able to attend the talk, the slides are posted here. The part that covers the port scanning technique may not be clear in isolation, so [...]]]></description>
			<content:encoded><![CDATA[<p>Last weekend at Shmoocon, I demonstrated how an attacker can trick certain WCF web services into performing an unauthorized port scan of machines behind a firewall.  For those that were not able to attend the talk, the <a href="http://www.gdssecurity.com/l/Attacking_WCF_Web_Services-Holyfield-Shmoocon_2010.pdf">slides are posted here</a>. The part that covers the port scanning technique may not be clear in isolation, so I’ll try and explain it in detail. The problem is related to the WSDualHttpBinding, so in order to understand how the scanning technique works you must first understand some WSDualHttpBinding basics. </p>
<p><strong>The WSDualHttpBinding</strong></p>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.wsdualhttpbinding.aspx">WSDualHttpBinding</a> is one of several “Duplex” WCF bindings.  The term Duplex refers to the bi-directional nature of the communication channel, meaning that both the client and the service can directly send messages to each other.   This is ideal for scenarios where a service needs to “push” data down to a client, rather than the alternative of constantly polling the server for a callback.   In order to do this over HTTP, which is by nature a one-way protocol, WCF sets up a dedicated HTTP listener port on the client that accepts incoming HTTP requests from the service (known as the callback channel).   If you are like me, you probably just raised an eyebrow when I said that WCF sets up an inbound HTTP listener on the client machine.  This scenario sounds odd from a security perspective, which is what initially caught my eye.</p>
<p>The first step in establishing a session with WSDualHttpBinding requires the client and server to negotiate the duplex connection.  This negotiation is a required part of the connection sequence, and is the mechanism that can be abused to perform remote port scanning.  The negotiation starts with the client sending a “CreateSequence” SOAP request to the web service endpoint.  A typical CreateSequence request is shown below.</p>
<p><img src="http://www.gdssecurity.com/l/wsd1.png" alt="" /></p>
<p>As you can see, the CreateSequence request includes a “ReplyTo” address.  This address is the URL of the callback channel at which the client expects to receive callback requests from the service.  When the service receives this request, it reacts by initiating a “CreateSequenceResponse” to the ReplyTo address, and then responding to the original request with a “202 Accepted”.  Conceptually this is represented by the diagram below.  Note that the circled numbers represent the order in which each request and response occurs. <br />
<img src="http://www.gdssecurity.com/l/wsd2.png" alt="" /><br />
The scenario above represents the intended chain of events for a CreateSequence negotiation.  There are a few important things to note:</p>
<ul>
<li>There are two separate HTTP conversations occurring.  One is between the client and the service over port 80, and the other is between the service and the client on port 8000.</li>
<li>When the service receives a CreateSequence request, it will immediately attempt to issue the CreateSequenceResponse request to the address that is passed within the ReplyTo value.  This does NOT have to be the same address (or port) where the CreateSequence request originated from. </li>
</ul>
<p>Next, let’s introduce another slightly more complex example.  In this scenario, we have 4 machines:</p>
<ul>
<li>The client, which in this case will end up being the bad guy</li>
<li>The WCF service that uses WSDualHttpBinding</li>
<li>Two unrelated hosts that will serve as targets</li>
</ul>
<p>The client in this case will send two CreateSequence requests to the service.  The first request will include a ReplyTo address of Target1, and the second request will include a ReplyTo address of Target2.  Again, the circled numbers represent the order in which each request and response occurs. <br />
<img src="http://www.gdssecurity.com/l/wsd3.png" alt="" /><br />
This diagram is much more interesting as it depicts what is certainly NOT an intended use case.  As illustrated above, the first CreateSequence request (1) causes the service to initiate a connection to Target1 on port 8000, just as the second CreateSequence request  (4) does to Target2.   Even more interesting is that the “Accepted” HTTP response (7) to the second CreateSequence request (4) does not occur until AFTER the connection to Target1 times out (5).  This means that the delay between the second CreateSequence (4) and the subsequent &#8220;Accepted&#8221; response (7) was directly related to the response time of the first CreateSequenceResponse attempt (5).  It appears that a WCF service will not respond to a new CreateService request until all previous CreateSequenceResponse requests have either been acknowledged or timed out. </p>
<p><strong>What Does this Mean?</strong></p>
<p>Based on the behavior described above, the CreateSequence HTTP response delay is an effective mechanism to determine the state of a prior connection request.  By issuing multiple requests to different hosts and ports, we can use this behavior to probe remote hosts from the server hosting the WCF service.  Depending on the connectivity available from the host, we can even probe systems that would not otherwise be available to us (such as on an internal network or DMZ). </p>
<p>In order to prove this theory, I wrote a utility to issue successive CreateSequence requests to a WCF service that each have a different ReplyTo address and/or port.  It measures the time between a CreateSequence request and the &#8220;202 Accepted&#8221; response in an attempt to determine whether a previous request was successful.  The utility is fairly simple and operates as follows (assume that <strong>Service</strong> is the WCF service we want to mis-use, and that the <strong>Target</strong> is the machine we want to port scan): </p>
<ul>
<li><strong>Request #1:</strong>  Issue a CreateSequence request to <strong>Service</strong> which will ReplyTo <strong>Target</strong> on <strong>Port 1</strong>.  The delay (if any) on this first request is not associated with a connection we initiated so the timing of this first response is ignored. </li>
<li><strong>Request #2:</strong> Issue another CreateSequence request to <strong>Service</strong> which will ReplyTo <strong>Target</strong> on <strong>Port2</strong>.  A timer is used to measure the time between this request the “202 Accepted” response from <strong>Service</strong>.   This response will not occur until the previous CreateSequenceResponse has been acknowledged or timed out.  As such, this delay will be used to infer the outcome of the probe caused by Request #1.</li>
<li><strong>Request #3:</strong>  Issue a CreateSequence request to <strong>Service</strong> which will ReplyTo <strong>Target</strong> on <strong>Port3</strong>.  A timer is used to measure the time between this request the “202 Accepted” response from <strong>Service</strong>.   This response will not occur until the previous CreateSequenceResponse has been acknowledged or timed out.  As such, this delay will be used to infer the outcome of the probe caused by Request #2.</li>
<li>and on and on and on…</li>
</ul>
<p><strong>Proof of Concept</strong></p>
<p>As a proof of concept, I deployed an instance of the <a href="http://msdn.microsoft.com/en-us/library/ms751450.aspx">MSDN CalculatorDuplex</a> sample service to a virtual machine in the Microsoft Azure cloud to use as a test case.  This service is a simple calculator web service that uses the WCF WSDualHttpBinding.  As it turns out, the Azure environment was a great place to test this concept since Azure VMs actually reside on an internal private 10.x.x.x network behind a firewall.  Conceptually, this is represented in the diagram below (note, this is an over simplified diagram based on what I have seen in my limited testing with Azure).</p>
<p><img src="http://www.gdssecurity.com/l/wsd4.png" alt="" /></p>
<p>Based on an analysis of the VM running the sample service, it also appeared that the VMs within the Azure environment typically run IIS on port 20000.  I used the utility to remotely scan other VMs within the 10.x.x.x address space on this port through requests to the Calculator service.  The results from the initial test are shown in the screenshot below.
<div style="text-align: center;"><img src="http://www.gdssecurity.com/l/wsd5.png" alt="" /></div>
<p> </p>
<p>As you can see, the result of each probe is inferred based on the average response time of the other requests.  The scan above shows that four of the probes returned very quickly (around 114 ms) while the others appear to have timed out.  The probes that do not time out in this case are the other internal VMs that are up and running IIS on port 20000.  As a second test, I used the utility to probe ports on the localhost of the machine running the Calculator service.  As you can see below, the probe to port 3389 times out while the others return after about 1 second.  So in this case, the Remote Desktop service is running on the localhost.</p>
<p>
<div align="center"><img src="http://www.gdssecurity.com/l/wsd6.png" alt="" /></div>
</p>
<p>So to summarize, this appears to be a potential design flaw within the WCF create sequence negotiation process.  As a result, any service that uses this binding can be abused by a remote user to scan other hosts (even those behind a firewall that they may not otherwise have access to).  Certain web-based attacks can also be proxied through these services since the remote attacker has the ability to control not only the target address and port, but also the complete URI that will be requested.  The source code for the scanner utility is <a href="http://www.gdssecurity.com/l/t/WsDualScanner.cs">posted here</a> for reference.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2010/02/12/abusing-wcf-to-perform-remote-port-scans/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>WCF Binary Soap Plug-In for Burp</title>
		<link>http://www.gdssecurity.com/l/b/2009/11/19/wcf-binary-soap-plug-in-for-burp/</link>
		<comments>http://www.gdssecurity.com/l/b/2009/11/19/wcf-binary-soap-plug-in-for-burp/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 00:38:55 +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=206</guid>
		<description><![CDATA[Update 2010:  With the official release of Burp Suite v1.3, both plug-ins discussed in this post can be used with either Pro or Free versions of Burp.
If you run into a Silverlight application that consumes WCF, there’s a good chance it will use Binary XML Message Encoding to send data between the Silverlight client and the [...]]]></description>
			<content:encoded><![CDATA[<p><strong><em>Update 2010:  With the official release of Burp Suite v1.3, both plug-ins discussed in this post can be used with either Pro or Free versions of Burp.</em></strong></p>
<p>If you run into a Silverlight application that consumes WCF, there’s a good chance it will use Binary XML Message Encoding to send data between the Silverlight client and the WCF endpoint. These messages usually include a <code>Content-Type: application/soap+msbin1</code> header to indicate that they are using <a href="http://msdn.microsoft.com/en-us/library/cc219175(PROT.10).aspx">Microsoft’s .NET Binary Format for SOAP (NBFS)</a>. From an attack perspective, the main problem with this encoding format is that you can’t simply edit requests or responses on-the-fly like you would with text-based SOAP messages, since the recipient of the message expects the data to be properly encoded (otherwise it will throw an exception) and, as such, will throw an exception if it’s not.</p>
<p>My initial research into what security tools support NBFS didn’t turn up much. The only option I found were two WCF Binary Inspectors for <a href="http://www.fiddler2.com/fiddler2/">Fiddler</a> (one <a href="http://tfstoys.codeplex.com/">here</a> written by Richard Berg, and another <a href="http://code.msdn.microsoft.com/wcfbinaryinspector">here</a> written by Samuel Jack). Both of these inspectors are essentially plug-ins for Fiddler that add support to view NBFS encoded data. Originally these both looked like the solution I was after, however upon further analysis I realized that while those plug-ins let you VIEW encoded messages, they don’t let you EDIT them. I decided it would be a worthwhile effort to try and leverage the plug-in architecture of <a href="http://portswigger.net/suite/">Burp Suite</a> (through use of the <a href="http://blog.portswigger.net/2009/04/using-burp-extender.html">BurpExtender</a> interface) to write a NBFS plug-in for Burp.</p>
<p><strong>The Solution (sort of)</strong><br />
Not wanting to re-invent the wheel, I figured I would leverage the work that had already been done with Fiddler by calling into one of the existing Fiddler libraries from Burp. I chose to use Richard Berg’s code since it looks like it can be ported entirely to Java down the road if needed (it doesn’t rely on WCF’s built-in decoder). Luckily for me, his code also had all of the methods needed to both encode and decode message data.</p>
<p>The way the plug-in works is pretty simple…when a request comes in, the <code>processProxyMessage</code> method of BurpExtender is used to check whether the requests should be decoded and, if so, passes the request data to the C# library. The C# library decodes the message and returns the plain-text version back to Burp. As requests exit Burp, the <code>processHttpMessage</code> method of BurpExtender is used to determine whether the request needs to be re-encoded and, if so, calls into the C# library again.</p>
<p>There are a couple of interesting points to note here:</p>
<ul>
<li>The <code>processHttpMessage</code> of BurpExtender is currently only supported in the Professional version of Burp Suite. It is my understanding that this method will be supported in the Free version starting with the <a href="http://blog.portswigger.net/2009/11/burp-suite-feature-requests-please.html">next release</a> (v1.3) but for now only licensed users of Burp pro have access to this extender method.</li>
<li>Both the <code>processProxyMessage</code> AND <code>processHttpMessage </code>methods of BurpExtender alway fire BEFORE a response can be edited by the user. Unfortunately this precludes the Plug-in from being able to re-encode RESPONSE messages should the user want to edit one.</li>
</ul>
<p>What this means is that you’ll need to resort to the proxy chaining as a workaround for this if you use the Burp Free Edition (explained in more detail below). Additionally, even if you use Burp Professional Edition, you’ll need to use this workaround if you want to edit RESPONSE data (REQUEST data can be edited on the fly with a single instance of Burp Professional).</p>
<p><strong>Plug-In Versions</strong><br />
There are two version of the Burp plug-in available:</p>
<p><a href="http://www.gdssecurity.com/l/t.php">Burp Professional Edition Plug-in</a>: Allows binary requests to be edited on the fly. This version does not support editing of response data. Pro users can use the Free Edition Plug-in with Burp Professional for editing response data.</p>
<p><a href="http://www.gdssecurity.com/l/t.php">Burp Universal Plug-in</a>: The Universal Plug-in works with both Free and Professional Editions of Burp and supports editing of binary REQUESTS and RESPONSES. The caveat to using this version of the plug-in is that you’ll need to chain two burp instances together as outlined in the diagram below for the plugin to work properly.</p>
<div><img src="/l/burp_chain.gif" alt="" /></div>
<p>The purpose of chaining two proxies together is as follows:</p>
<ul>
<li>The first instance handles decoding requests, intercepting (and editing) requests, and re-encoding edited responses. Set this instance to intercept REQUESTS only (not responses) and to use the 2nd proxy as the next hop.</li>
<li>The second instance handles re-encoding edited requests, decoding responses, and intercepting (and editing) responses. Set this instance to intercept RESPONSES only (not requests).</li>
</ul>
<p>Each proxy will add or remove a custom header (<code>X-WCF-Proxy: must-encode</code>) to edited requests/responses which they use to notify each other of whether re-encoding of a message is necessary. This custom header is removed when read by the plug-in, so it shouldn’t ever get disclosed to the target system.</p>
<p>Albeit it slightly crude, I didn’t see much in the way of a better work around (I am certainly open to suggestions if anyone has any). It should be noted that this workaround is ONLY necessary if you are using the Free Edition (1.2.x) of Burp Suite OR if you want to want to edit WCF binary response content using Burp Professional Edition. Editing WCF binary request data is supported with a single instance of the Burp Professional Plug-In.</p>
<p><strong>Next Steps</strong><br />
These plug-ins were created as a proof of concept for the talk at <a href="http://www.gdssecurity.com/l/b/2009/11/19/slides-from-appsec-dc-posted/">OWASP AppSec DC 2009</a>. Looking forward, the C# decoding library should easily port to pure Java since it doesn’t make use of the native WCF decoding classes. This would not only eliminate cross-language calls but would also make the plug-in platform independent (since the implementation would be in pure Java). The drawback to this approach, of course, is that we would be using a home grown decoder for a proprietary Microsoft protocol that could change down the road.</p>
<p>In any case, hopefully the plug-ins will be useful in the short term until more security tools include native support for NBFS messages. You can find both versions of the plug-in <a href="http://www.gdssecurity.com/l/t.php">available for free on our tools page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2009/11/19/wcf-binary-soap-plug-in-for-burp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Slides from AppSec DC Posted</title>
		<link>http://www.gdssecurity.com/l/b/2009/11/19/slides-from-appsec-dc-posted/</link>
		<comments>http://www.gdssecurity.com/l/b/2009/11/19/slides-from-appsec-dc-posted/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 05:43:27 +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=178</guid>
		<description><![CDATA[Slides from the “Attacking WCF Web Services” talk I presented last week at OWASP AppSec DC 2009 are now available for download.  We’ve also released the WCF Binary Soap Plug-In for Burp that was demonstrated during the presentation.  There will be a separate blog post dedicated to this plug-in published later today, so I definitely recommend reading [...]]]></description>
			<content:encoded><![CDATA[<p>Slides from the “Attacking WCF Web Services” talk I presented last week at <a href="http://www.owasp.org/index.php/OWASP_AppSec_DC_2009">OWASP AppSec DC 2009 </a>are now <a href="http://www.gdssecurity.com/l/Attacking_WCF_Web_Services-Holyfield-OWASP_AppSec_DC_2009.pdf">available for download</a>.  We’ve also released the <a href="http://www.gdssecurity.com/l/t.php">WCF Binary Soap Plug-In for Burp</a><strong> </strong>that was demonstrated during the presentation.  There will be a separate blog post dedicated to this plug-in published later today, so I definitely recommend reading it to get the full scoop on what it does and how to use it.</p>
<p>Overall, the conference was great.  Aside from the presentations, the highlight for me was when we ran into Jason Alexander (aka <a href="http://en.wikipedia.org/wiki/George_Costanza">George Costanza</a>) at dinner on Thursday night.  These pretzels are making me thirsty!!</p>
<p>&nbsp;</p>
<div align="center">
<a href="/l/jalexander.jpg" target="new"><img src="/l/jalexander_small.jpg" border="0"/></a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2009/11/19/slides-from-appsec-dc-posted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SPF Moves to CodePlex</title>
		<link>http://www.gdssecurity.com/l/b/2009/08/13/spf-moves-to-codeplex/</link>
		<comments>http://www.gdssecurity.com/l/b/2009/08/13/spf-moves-to-codeplex/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 14:30:38 +0000</pubDate>
		<dc:creator>Brian Holyfield</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.gdssecurity.com/l/b/?p=114</guid>
		<description><![CDATA[Just a quick post to let everyone know that with the release of v1.0.5, SPF has officially gone open-source.  The code (and most recent binary distribution) are now available from CodePlex and have been released under the GPL license. 
The decision to open-source SPF was an easy one.  The biggest factor preventing several companies from implementing SPF in their production environment [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick post to let everyone know that with the release of <a href="http://spf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=31437#DownloadId=78876">v1.0.5</a>, SPF has officially gone open-source.  The code (and most recent binary distribution) are now available from <a href="http://spf.codeplex.com">CodePlex</a> and have been released under the GPL license. </p>
<p>The decision to open-source SPF was an easy one.  The biggest factor preventing several companies from implementing SPF in their production environment was the fact that it was neither commercially supported nor open source.  By moving SPF to an open source licensing model, more companies will have the option to experiment and hopefully use SPF to protect their web applications. </p>
<p>The CodePlex platform also provides public <a href="http://spf.codeplex.com/WorkItem/List.aspx">issue tracking</a> and a <a href="http://spf.codeplex.com/Thread/List.aspx">discussion forum</a> that will hopefully benefit the SPF user base going forward.  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gdssecurity.com/l/b/2009/08/13/spf-moves-to-codeplex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Source Boston IIS7 Slides Posted</title>
		<link>http://www.gdssecurity.com/l/b/2009/03/17/source-boston-iis7-slides-posted/</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>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tamper Proofing Web Applications at Run-Time</title>
		<link>http://www.gdssecurity.com/l/b/2008/12/19/tamper-proofing-web-applications-at-run-time/</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>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>OWASP Boston Slides and SPF Public Demo Site</title>
		<link>http://www.gdssecurity.com/l/b/2008/12/04/owasp-boston-slides-and-spf-public-demo-site/</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>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using SPF to Protect Against SQL Injection Worms</title>
		<link>http://www.gdssecurity.com/l/b/2008/09/09/using-spf-to-protect-against-sql-injection-worms/</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>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
