<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.iis.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:cs="http://blogs.iis.net/"><channel><title>Nazim&amp;#39;s Security Blog</title><link>http://blogs.iis.net/nazim/default.aspx</link><description>All things security ...</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Debug Build: 20510.895)</generator><item><title>Safely handling untrusted XML server-side</title><link>http://blogs.iis.net/nazim/archive/2013/03/13/safely-handling-untrusted-xml-server-side.aspx</link><pubDate>Wed, 13 Mar 2013 16:11:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:5063053</guid><dc:creator>naziml</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=5063053</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2013/03/13/safely-handling-untrusted-xml-server-side.aspx#comments</comments><description>&lt;p&gt;If you didn&amp;#39;t think that processing XML on the server side can lead to a Denial of Service, Information Disclosure or even Remote Code Execution, read on. The issues discussed here are include a class of issues that is commonly referred to as XML External Entity vulnerabilities (XXE), but are not limited to this. &lt;u&gt;If you are NOT processing untrusted XML and the data comes from a trusted source this article doesn’t really apply for you but is still good to enforce safe usage for hygiene.&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;Most would consider XML as simple markup data, but you should actually consider it a ‘language’ that actually has powerful runtime features. These runtime features could be enabled on the server-side even if their use is not intended, and this is what unwittingly leads to XML based vulnerabilities on the server side. Following are a few of the classes of issues you could run into with XML processing.&lt;/p&gt;  &lt;h1&gt;Denial of Service &lt;/h1&gt;  &lt;p&gt;XML allows you to define entities that are essentially tokens that get replaced at runtime. Some of these are well-known, like &lt;em&gt;&amp;amp;gt;&lt;/em&gt; which would get replaced by the greater than sign ‘&lt;strong&gt;&amp;gt;&lt;/strong&gt;’. But you can actually custom define entities as in the example below.&lt;/p&gt;  &lt;blockquote&gt;   &lt;div class="code"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;!DOCTYPE&lt;/font&gt;&lt;font color="#ff0000"&gt; doc [&amp;lt;!ENTITY name &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;quot;Nazim&amp;quot;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt;]&amp;gt;        &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;doc&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;amp;name;         &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="#800000"&gt;doc&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt;&lt;/font&gt; &lt;/div&gt; &lt;/blockquote&gt;  &lt;p&gt;During XML pre-processing, this XML would essentially become&lt;/p&gt;  &lt;blockquote&gt;   &lt;div class="code"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;doc&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Nazim         &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="#800000"&gt;doc&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt; &lt;/div&gt; &lt;/blockquote&gt;  &lt;p&gt;But we can go further and define entities that reference other entities, like&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&amp;#160;&lt;/pre&gt;

&lt;blockquote&gt;
  &lt;div class="code"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;!DOCTYPE&lt;/font&gt;&lt;font color="#ff0000"&gt; doc &lt;font color="#0000ff"&gt;[&lt;/font&gt; 

      &lt;br /&gt;&amp;#160;&amp;#160; &lt;font color="#0000ff"&gt;&amp;lt;!&lt;/font&gt;ENTITY greeting &lt;/font&gt;&lt;font color="#0000ff"&gt;“Hello&amp;quot;&amp;gt; 
      &lt;br /&gt;&amp;#160;&amp;#160; &amp;lt;!&lt;font color="#ff0000"&gt;ENTITY name&lt;/font&gt; “Nazim&amp;quot;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;!&lt;/font&gt;&lt;font color="#ff0000"&gt;ENTITY sayhello &lt;/font&gt;&lt;font color="#0000ff"&gt;“&amp;amp;greeting; &amp;amp;name;&amp;quot;&amp;gt; 
      &lt;br /&gt;]&amp;gt; 

      &lt;br /&gt;&amp;lt;&lt;font color="#800000"&gt;doc&lt;/font&gt;&amp;gt; 

      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;font color="#ff0000"&gt;&amp;amp;sayhello;&lt;/font&gt; 

      &lt;br /&gt;&amp;lt;&lt;font color="#800000"&gt;/doc&lt;/font&gt;&amp;gt;&lt;/font&gt; &lt;/div&gt;
&lt;/blockquote&gt;

&lt;p&gt;So now the XML pre-processor has to go through multiple stages of entity expansion.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.iis.net/blogs/nazim/image_7D522F15.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;border-bottom-width:0px;display:inline;border-top-width:0px;" border="0" alt="image" src="http://blogs.iis.net/blogs/nazim/image_thumb_6EA78330.png" width="277" height="183" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;You have probably put 2 and 2 together at this point and see the issue already. Since this is essentially a tree structure, I can grow the number of nodes to pre-process exponentially. So something like the doc below even though small in size (&amp;lt;1KB) will expand out to a billion lols and can take up almost &lt;strong&gt;&lt;em&gt;3GB in memory&lt;/em&gt;&lt;/strong&gt;. This is commonly referred to as the billion laughs attack and you can read more about it in this &lt;a href="http://msdn.microsoft.com/en-us/magazine/ee335713.aspx"&gt;MSDN article&lt;/a&gt;. &lt;/p&gt;

&lt;blockquote&gt;
  &lt;div class="code"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;?xml&lt;/font&gt;&lt;font color="#ff0000"&gt; version&lt;/font&gt;&lt;font color="#0000ff"&gt;=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;!DOCTYPE&lt;/font&gt;&lt;font color="#ff0000"&gt; lolz &lt;font color="#0000ff"&gt;[&lt;/font&gt; 

      &lt;br /&gt;&amp;#160; &lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;!ENTITY&lt;/font&gt; lol &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;quot;lol&amp;quot;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;&amp;#160; &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;!ENTITY&lt;/font&gt;&lt;font color="#ff0000"&gt; lol2 &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;quot;&amp;amp;lol;&amp;amp;lol;&amp;amp;lol;&amp;amp;lol;&amp;amp;lol;&amp;amp;lol;&amp;amp;lol;&amp;amp;lol;&amp;amp;lol;&amp;amp;lol;&amp;quot;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;&amp;#160; &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;!ENTITY&lt;/font&gt;&lt;font color="#ff0000"&gt; lol3 &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;quot;&amp;amp;lol2;&amp;amp;lol2;&amp;amp;lol2;&amp;amp;lol2;&amp;amp;lol2;&amp;amp;lol2;&amp;amp;lol2;&amp;amp;lol2;&amp;amp;lol2;&amp;amp;lol2;&amp;quot;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;&amp;#160; &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;!ENTITY&lt;/font&gt;&lt;font color="#ff0000"&gt; lol4 &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;quot;&amp;amp;lol3;&amp;amp;lol3;&amp;amp;lol3;&amp;amp;lol3;&amp;amp;lol3;&amp;amp;lol3;&amp;amp;lol3;&amp;amp;lol3;&amp;amp;lol3;&amp;amp;lol3;&amp;quot;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;&amp;#160; &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;!ENTITY&lt;/font&gt;&lt;font color="#ff0000"&gt; lol5 &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;quot;&amp;amp;lol4;&amp;amp;lol4;&amp;amp;lol4;&amp;amp;lol4;&amp;amp;lol4;&amp;amp;lol4;&amp;amp;lol4;&amp;amp;lol4;&amp;amp;lol4;&amp;amp;lol4;&amp;quot;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;&amp;#160; &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;!ENTITY&lt;/font&gt;&lt;font color="#ff0000"&gt; lol6 &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;quot;&amp;amp;lol5;&amp;amp;lol5;&amp;amp;lol5;&amp;amp;lol5;&amp;amp;lol5;&amp;amp;lol5;&amp;amp;lol5;&amp;amp;lol5;&amp;amp;lol5;&amp;amp;lol5;&amp;quot;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;&amp;#160; &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;!ENTITY&lt;/font&gt;&lt;font color="#ff0000"&gt; lol7 &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;quot;&amp;amp;lol6;&amp;amp;lol6;&amp;amp;lol6;&amp;amp;lol6;&amp;amp;lol6;&amp;amp;lol6;&amp;amp;lol6;&amp;amp;lol6;&amp;amp;lol6;&amp;amp;lol6;&amp;quot;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;&amp;#160; &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;!ENTITY&lt;/font&gt;&lt;font color="#ff0000"&gt; lol8 &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;quot;&amp;amp;lol7;&amp;amp;lol7;&amp;amp;lol7;&amp;amp;lol7;&amp;amp;lol7;&amp;amp;lol7;&amp;amp;lol7;&amp;amp;lol7;&amp;amp;lol7;&amp;amp;lol7;&amp;quot;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;&amp;#160; &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;!ENTITY&lt;/font&gt;&lt;font color="#ff0000"&gt; lol9 &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;quot;&amp;amp;lol8;&amp;amp;lol8;&amp;amp;lol8;&amp;amp;lol8;&amp;amp;lol8;&amp;amp;lol8;&amp;amp;lol8;&amp;amp;lol8;&amp;amp;lol8;&amp;amp;lol8;&amp;quot;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;]&amp;gt; 

      &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;lolz&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#ff0000"&gt;&amp;amp;lol9;&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="#800000"&gt;lolz&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt;&lt;/font&gt; &lt;/div&gt;
&lt;/blockquote&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h1&gt;Information Disclosure &lt;/h1&gt;

&lt;p&gt;Entity expansion is not limited to string literals though. It could very well refer to external data like the example below.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;div class="code"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;!DOCTYPE&lt;/font&gt;&lt;font color="#ff0000"&gt; doc &lt;font color="#0000ff"&gt;[&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;!ENTITY&lt;/font&gt; win SYSTEM &lt;/font&gt;&lt;font color="#0000ff"&gt;“c:\windows\win.ini&amp;quot;&amp;gt; 
      &lt;br /&gt;]&amp;gt; 

      &lt;br /&gt;&amp;lt;&lt;font color="#800000"&gt;doc&lt;/font&gt;&amp;gt; 

      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;amp;win; 

      &lt;br /&gt;&amp;lt;&lt;font color="#800000"&gt;/doc&lt;/font&gt;&amp;gt;&lt;/font&gt; &lt;/div&gt;
&lt;/blockquote&gt;

&lt;p&gt;If this document is somehow reflected back to the client it would result in disclosing information on the server that a client wouldn’t have access to.&lt;/p&gt;

&lt;h1&gt;Remote Code Execution &lt;/h1&gt;

&lt;p&gt;I think this is best shown by directly diving into an example.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;div class="code"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;xsl:stylesheet&lt;/font&gt;&lt;font color="#ff0000"&gt; version&lt;/font&gt;&lt;font color="#0000ff"&gt;=&amp;quot;1.0&amp;quot;&lt;/font&gt;&lt;font color="#ff0000"&gt; 
      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; xmlns:xsl&lt;/font&gt;&lt;font color="#0000ff"&gt;=&amp;quot;http://www.w3.org/1999/XSL/Transform&amp;quot;&lt;/font&gt;&lt;font color="#ff0000"&gt; 
      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; xmlns:msxsl&lt;/font&gt;&lt;font color="#0000ff"&gt;=&amp;quot;urn:schemas-microsoft-com:xslt&amp;quot;&lt;/font&gt;&lt;font color="#ff0000"&gt; 
      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; xmlns:user&lt;/font&gt;&lt;font color="#0000ff"&gt;=&amp;quot;http://example.com/ns&amp;quot;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;msxsl:script&lt;/font&gt;&lt;font color="#ff0000"&gt; language&lt;/font&gt;&lt;font color="#0000ff"&gt;=&amp;quot;C#&amp;quot;&lt;/font&gt;&lt;font color="#ff0000"&gt; implements-prefix&lt;/font&gt;&lt;font color="#0000ff"&gt;=&amp;quot;user&amp;quot;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;![CDATA[ 
      &lt;br /&gt;&lt;/font&gt;&lt;font color="#ff0000"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;font style="background-color:yellow;" color="#000000"&gt;public string Code() 
        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; { 

        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return Environment.MachineName; 

        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } 

        &lt;br /&gt;&lt;/font&gt;&amp;#160;&amp;#160;&amp;#160; ]]&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="#800000"&gt;msxsl:script&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;xsl:template&lt;/font&gt;&lt;font color="#ff0000"&gt; match&lt;/font&gt;&lt;font color="#0000ff"&gt;=&amp;quot;/&amp;quot;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;xsl:value-of&lt;/font&gt;&lt;font color="#ff0000"&gt; select&lt;/font&gt;&lt;font color="#0000ff"&gt;=&amp;quot;user:Code()&amp;quot;/&amp;gt; 
      &lt;br /&gt;&amp;lt;/&lt;/font&gt;&lt;font color="#800000"&gt;xsl:template&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; 
      &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="#800000"&gt;xsl:stylesheet&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt;&lt;/font&gt; &lt;/div&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here we have an XML style sheet that essentially has some code that is run as part of applying the style sheet. Imaging replacing the code &lt;font style="background-color:yellow;" color="#000000"&gt;highlighted &lt;/font&gt;with a payload of your choice, including things like a network scan :)&lt;/p&gt;

&lt;h1&gt;Preventing XML Entity Attacks&lt;/h1&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;You essentially want to disable &lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;!DOCTYPE&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt;&lt;/font&gt; definitions (DTDs) when parsing untrusted XML. There are many APIs, that are not safe by default in this respect and you need to explicitly disable DTD resolution on an XML document. See below for API specifics.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h1&gt;Preventing XSL Attacks&lt;/h1&gt;

&lt;p&gt;This is pretty much the same as above and you want to disable DTD and XSL script support. See below for unsafe API specifics.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h1&gt;Safe XML API usage on Windows/.NET&lt;/h1&gt;

&lt;p&gt;The list below was accurate at the time this article was compiled. It is possible that updates to components may have changed the defaults, so it is &lt;strong&gt;&lt;u&gt;always better to test your usage&lt;/u&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;System.Xml.XmlDocument&lt;/li&gt;

  &lt;ul&gt;
    &lt;li&gt;Load and LoadXml UNSAFE unless you pass a safe XmlReader (DTD disabled) into it during initialization.&lt;/li&gt;

    &lt;li&gt;InnerXml is NEVER SAFE.&lt;/li&gt;
  &lt;/ul&gt;

  &lt;li&gt;System.Xml.XmlTextReader&lt;/li&gt;

  &lt;ul&gt;
    &lt;li&gt;UNSAFE by default in .NET 3.5 and below. &lt;/li&gt;

    &lt;ul&gt;
      &lt;li&gt;You need to set ProhibitDtd=true to make this safe.&lt;/li&gt;
    &lt;/ul&gt;

    &lt;li&gt;.NET 4.0 and above are safe be default.&lt;/li&gt;
  &lt;/ul&gt;

  &lt;li&gt;System.Xml.Xsl.XslTransform&lt;/li&gt;

  &lt;ul&gt;
    &lt;li&gt;UNSAFE as it supports both entities and XSL script.&lt;/li&gt;
  &lt;/ul&gt;

  &lt;li&gt;System.Xml.Xsl.XslCompiledTransform&lt;/li&gt;

  &lt;ul&gt;
    &lt;li&gt;Safe for XSL script since this is blocked by default.&lt;/li&gt;

    &lt;li&gt;UNSAFE for entity expansion unless a secure resolver is specified.&lt;/li&gt;

    &lt;ul&gt;
      &lt;li&gt;Pass an instance of XmlSecureResolver or null&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/ul&gt;

  &lt;li&gt;System.Web.UI.WebControls.XmlDataSource&lt;/li&gt;

  &lt;ul&gt;
    &lt;li&gt;NEVER SAFE – supports both entities and XSL script.&lt;/li&gt;
  &lt;/ul&gt;

  &lt;li&gt;MSXML 5 and below&lt;/li&gt;

  &lt;ul&gt;
    &lt;li&gt;UNSAFE by default&lt;/li&gt;

    &lt;li&gt;Need to set ProhibitDtd=true, AllowXsltScript=false and AllowDocumentFunction=false&lt;/li&gt;
  &lt;/ul&gt;

  &lt;li&gt;MSXML 6&lt;/li&gt;

  &lt;ul&gt;
    &lt;li&gt;Safe by default&lt;/li&gt;
  &lt;/ul&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h1&gt;Resources&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://www.owasp.org/index.php/XML_External_Entity_(XXE)_Processing"&gt;OWASP XXE Page&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://shh.thathost.com/secadv/adobexxe/"&gt;Adobe Reader XXE Attack&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.exploit-db.com/download_pdf/16093/"&gt;Attacking server side XML parsers (PDF)&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=5063053" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/Windows+Security/default.aspx">Windows Security</category><category domain="http://blogs.iis.net/nazim/archive/tags/XML/default.aspx">XML</category></item><item><title>Is IIS vulnerable to the THC SSL DoS attack tool?</title><link>http://blogs.iis.net/nazim/archive/2011/11/02/is-iis-vulnerable-to-the-thc-ssl-dos-attack-tool.aspx</link><pubDate>Wed, 02 Nov 2011 21:22:25 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:4664937</guid><dc:creator>naziml</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=4664937</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2011/11/02/is-iis-vulnerable-to-the-thc-ssl-dos-attack-tool.aspx#comments</comments><description>&lt;p&gt;There was a &lt;a href="http://thehackerschoice.wordpress.com/2011/10/24/thc-ssl-dos/"&gt;recently released tool by THC&lt;/a&gt; that can be used to launch Denial of Service (DoS) attacks against servers hosting SSL sites. Besides the traditional bot-net Distributed Denial of Service (DDoS) class attacks, this tool lets a single client use client SSL renegotiation to cause server DoS.&lt;/p&gt;  &lt;p&gt;IIS versions 6 and above are NOT affected by the renegotiation DoS attack since http.sys (http driver on Windows Server) disallows client initiated renegotiation in SSL and sends a TCP RST anytime a client attempts a renegotiation. The attack tool will open a new TCP/IP connection for each SSL handshake in this case, making it no different than a regular DDoS attack that would need very large client side resources to execute.&lt;/p&gt;  &lt;p&gt;The information used to carry out the attack in this tool is easily mitigated and has been known publicly since March 2010 in the &lt;a href="http://www.ietf.org/mail-archive/web/tls/current/msg07553.html"&gt;IETF TLS Lists&lt;/a&gt;. The gist of all these attacks is that it takes more resources on the server side to complete an SSL handshake than it does on the client side. So any effective front firewall mechanism that is employed to track such requests and clients and block them early on, provide adequate protection against this kind of attack. &lt;/p&gt;  &lt;p&gt;Unlike IIS, some other services that use SChannel to perform SSL on Windows Servers may not disable client initiated renegotiation. To globally disable this for all servers and services that use SChannel, follow the guidelines on &lt;a href="http://support.microsoft.com/kb/977377"&gt;http://support.microsoft.com/kb/977377&lt;/a&gt; to disable client initiated renegotiation globally on the server. &lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=4664937" width="1" height="1"&gt;</description></item><item><title>Is IIS susceptible to the Apache Range Header DoS attack?</title><link>http://blogs.iis.net/nazim/archive/2011/08/25/is-iis-susceptible-to-the-apache-range-header-dos-attack.aspx</link><pubDate>Thu, 25 Aug 2011 21:17:26 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:4570140</guid><dc:creator>naziml</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=4570140</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2011/08/25/is-iis-susceptible-to-the-apache-range-header-dos-attack.aspx#comments</comments><description>&lt;p&gt;A recent disclosure on &lt;a href="http://seclists.org/fulldisclosure/2011/Aug/175"&gt;seclists.org&lt;/a&gt; about a Denial of Service attack against Apache web servers has raised concerns about whether IIS web servers are affected. We will quickly talk about the issue and its impact on IIS web servers in this post.&lt;/p&gt;  &lt;h2&gt;Issue&lt;/h2&gt;  &lt;p&gt;HTTP requests give you the ability to send a request to a web server and elicit only a portion of the response by using the 'Range' header. For example, if you are requesting a text file, but only want the first 500 bytes, you would send the request with the following HTTP header: Range: 0-499 \r\n. This feature allows for multiple comma-separated ranges to be specified within the header, so I could get the same result as above by specifying Range: 0-199,200-499. &lt;/p&gt;  &lt;p&gt;This feature can theoretically be abused by specifying several ranges that will cause server-side processing of the response to consume excessive resources. So if I sent Range: 0-,0-,0-,0-,0-,0- the server would produce a response by replicating the resource requested six times and consuming resources in the process of concatenating the response. So it is possible to send a malicious request and cause a Denial of Service on the server side.&lt;/p&gt;  &lt;h2&gt;Is IIS affected?&lt;/h2&gt;  &lt;p&gt;IIS 6 and above are &lt;strong&gt;NOT&lt;/strong&gt; affected because IIS only allows up to 5 ranges within any HTTP request in the Range header. The resources consumed on the server side for such a request is not sufficient to cause a Denial of Service. IIS 5, however, does not have this limitation and is hence affected by such a vulnerability. IIS5 however is not supported by Microsoft anymore, and if you still have IIS 5 web servers deployed you should consider upgrading to the latest Windows Server version.&lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=4570140" width="1" height="1"&gt;</description></item><item><title>World IPv6 Day and IIS 7</title><link>http://blogs.iis.net/nazim/archive/2011/06/07/world-ipv6-day-and-iis-7.aspx</link><pubDate>Tue, 07 Jun 2011 18:03:37 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:4449406</guid><dc:creator>naziml</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=4449406</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2011/06/07/world-ipv6-day-and-iis-7.aspx#comments</comments><description>&lt;p&gt;Wednesday June 8 2011 is &lt;a href="http://www.worldipv6day.org/"&gt;World IPv6 Day&lt;/a&gt; and there will be plenty of representation by IIS7 on the Windows Server side. From Microsoft we will have participation in this event by &lt;a href="http://www.microsoft.com/"&gt;Microsoft.com&lt;/a&gt;, &lt;a href="http://www.bing.com/"&gt;Bing.com&lt;/a&gt; and &lt;a href="http://www.xbox.com/"&gt;Xbox.com&lt;/a&gt;; all of which run IIS7 web servers on their front end.&lt;/p&gt;  &lt;p&gt;Using IPv6 with IIS7 is trivial and intuitive, and we have deep integration of IPv6 features into the IIS product. From creating site bindings to logging to security features like IP Restriction, IIS has full support for IPv6 including validation in our management interfaces. For more information on using IPv6 with IIS7 please visit &lt;a href="http://blogs.iis.net/nazim/archive/2008/05/03/using-ipv6-with-iis7.aspx"&gt;http://blogs.iis.net/nazim/archive/2008/05/03/using-ipv6-with-iis7.aspx&lt;/a&gt;. &lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=4449406" width="1" height="1"&gt;</description></item><item><title>Use of special characters like '%'  ‘.’ and ‘:’ in an IIS URL</title><link>http://blogs.iis.net/nazim/archive/2011/04/18/use-of-special-characters-like-in-an-iis-url.aspx</link><pubDate>Mon, 18 Apr 2011 17:12:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:4387673</guid><dc:creator>naziml</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=4387673</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2011/04/18/use-of-special-characters-like-in-an-iis-url.aspx#comments</comments><description>&lt;p mce_keep="true"&gt;There are multiple times that we get questions about % and other special characters in the URL and what the expected behavior is in IIS. The behavior in IIS is very deterministic when it comes to these special characters, but to explain the behavior we will need to delve a little bit into both URL canonicalization and the different stages of request processing in IIS. &lt;/p&gt;  &lt;p mce_keep="true"&gt;Usage of special characters in the URL first and foremost depends on the portion of the URL it is being used in. Here is a sample URL.&lt;/p&gt;  &lt;p mce_keep="true"&gt;&lt;font style="background-color: #ffffff" color="#000000"&gt;&lt;strong&gt;http://www.myserver.com:80/application1/foo.aspx?var1=1&amp;amp;var2=2&lt;/strong&gt;, where &lt;/font&gt;    &lt;br /&gt;&lt;font style="background-color: #ffffff" color="#000000"&gt;&lt;strong&gt;http://&lt;/strong&gt;&lt;/font&gt; is the protocol specifier     &lt;br /&gt;&lt;strong&gt;www.myserver.com:80&lt;/strong&gt; is the hostname where the port specification is optional     &lt;br /&gt;&lt;strong&gt;application1/foo.aspx&lt;/strong&gt; is the request URI or the URI path     &lt;br /&gt;&lt;strong&gt;var1=1&amp;amp;var2=2&lt;/strong&gt; is the query string.&lt;/p&gt;  &lt;p&gt;IIS does not perform any checks on the query string and considers this portion as a blob and does no encoding processing and is as such not very interesting for this discussion. Both http.sys (driver mode HTTP parser) and IIS considers the query string opaque. The only exception to this are filters like Urlscan, Request Filtering etc. These may additionally block characters depending on their configuration.&lt;/p&gt;  &lt;p&gt;The request URI (URI path) above is the most interesting and there are several layers of validation that happen, the first being by http.sys, the second by IIS request filtering, third by IIS core, and then by any handler (like ASP.NET). &lt;/p&gt;  &lt;h3&gt;Layer 1: Http.sys (blocked characters = ‘%’)&lt;/h3&gt;  &lt;p&gt;Http.sys parses URLs in accordance with &lt;a href="http://www.ietf.org/rfc/rfc2396.txt"&gt;RFC 2396&lt;/a&gt;. You can however configure exceptions using the &lt;em&gt;AllowRestrictedChars&lt;/em&gt; registry setting documented in &lt;a href="http://support.microsoft.com/kb/820129"&gt;KB 820129&lt;/a&gt;. &lt;u&gt;This configuration will never allow a bare ‘%’ character though&lt;/u&gt; because it is expressly forbidden in the RFC section 2.4.2 which says:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;“Because the percent &amp;quot;%&amp;quot; character always has the reserved purpose of being the escape indicator, &lt;u&gt;it must be escaped as &amp;quot;%25&amp;quot;&lt;/u&gt; in order to be used as data within a URI. Implementers should be careful not to escape or unescape the same string more than once, since unescaping an already unescaped string might lead to misinterpreting a percent data character as another escaped character, or vice versa in the case of escaping an already escaped string”&lt;/em&gt;&lt;/p&gt;  &lt;h3&gt;Layer 2: IIS request filtering (blocked characters = ‘%25’, ‘.’, ‘%2b’)&lt;/h3&gt;  &lt;p&gt;IIS request filtering checks for a couple of things by default and the behavior is controlled by configuration. You can reference the following articles for details, &lt;a href="http://learn.iis.net/page.aspx/143/use-request-filtering/"&gt;Use Request Filtering&lt;/a&gt; and &lt;a href="http://learn.iis.net/page.aspx/473/using-urlscan/"&gt;Using Urlscan&lt;/a&gt;. This filtering potentially processes both the URI path and the query string and could disallow things like: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Double escaping which involves the use of %25, which is an encoded ‘%’ sign. Also, ‘+’ characters are considered and encoded space even though it does not have a % in the beginning. So encoding this as %2b will also trigger this rule.&lt;/li&gt;    &lt;li&gt;Non-ASCII high bit characters.&lt;/li&gt;    &lt;li&gt;Dot in the URI path, where a request that contains a dot other than that for the resource extension will be rejected. Eg: &lt;strong&gt;http://foo/a&lt;font style="background-color: #ffff00"&gt;.&lt;/font&gt;b/bar.aspx&lt;/strong&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;h3&gt;Layer 3: IIS core (blocked characters = ‘:’)&lt;/h3&gt;  &lt;p&gt;There are no restrictions per se in IIS core, but there are a couple of things it does with physical file mappings that are produced from URL mappings.So for handlers like the static file handler that will serve out files, we will check for file paths containing the ‘:’ character to avoid ::$DATA like security issues that occurred in &lt;a href="http://www.microsoft.com/technet/security/bulletin/ms98-003.mspx"&gt;MS98-003&lt;/a&gt; and &lt;a href="http://www.microsoft.com/technet/security/bulletin/MS10-065.mspx"&gt;MS10-065&lt;/a&gt;. &lt;/p&gt;  &lt;h3&gt;Layer 4: Handlers&lt;/h3&gt;  &lt;p&gt;This part depends on what handlers are being used in your request processing. So if you are using ASP.NET for instance, it could trigger &lt;a href="http://www.asp.net/learn/whitepapers/request-validation"&gt;request validation&lt;/a&gt; that could additionally block characters in both the URI path and the query string. If you are using Sharepoint, they have their own list of blocked characters as mentioned in &lt;a href="http://support.microsoft.com/kb/905231"&gt;KB 905231&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=4387673" width="1" height="1"&gt;</description></item><item><title>Security update released for FTP 7.0 and FTP 7.5 0-day</title><link>http://blogs.iis.net/nazim/archive/2011/02/08/security-update-released-for-ftp-7-0-and-ftp-7-5-0-day.aspx</link><pubDate>Tue, 08 Feb 2011 18:41:54 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:4293500</guid><dc:creator>naziml</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=4293500</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2011/02/08/security-update-released-for-ftp-7-0-and-ftp-7-5-0-day.aspx#comments</comments><description>&lt;p&gt;In the later half of December 2010, an FTP 7.X exploit was published on &lt;a href="http://www.exploit-db.com/exploits/15803/"&gt;http://www.exploit-db.com/exploits/15803/&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;We posted a risk assessment in a blog on the Security Research and Defense team’s blog &lt;a title="http://blogs.technet.com/b/srd/archive/2010/12/22/assessing-an-iis-ftp-7-5-unauthenticated-denial-of-service-vulnerability.aspx" href="http://blogs.technet.com/b/srd/archive/2010/12/22/assessing-an-iis-ftp-7-5-unauthenticated-denial-of-service-vulnerability.aspx"&gt;http://blogs.technet.com/b/srd/archive/2010/12/22/assessing-an-iis-ftp-7-5-unauthenticated-denial-of-service-vulnerability.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This issue now has a fix available &lt;a title="http://www.microsoft.com/technet/security/bulletin/ms11-004.mspx" href="http://www.microsoft.com/technet/security/bulletin/ms11-004.mspx"&gt;http://www.microsoft.com/technet/security/bulletin/ms11-004.mspx&lt;/a&gt;. Please make note of the known issues for patching on Windows Server 2008 Server Core in &lt;a title="http://support.microsoft.com/kb/2489256" href="http://support.microsoft.com/kb/2489256"&gt;http://support.microsoft.com/kb/2489256&lt;/a&gt;. The fix is available for both the Download Center version of FTP and the optional component in Windows 7 and Windows Server 2008 R2.&lt;/p&gt;  &lt;p&gt;You can find more information on this issue on &lt;a title="http://blogs.technet.com/b/srd/archive/2011/02/08/regarding-ms11-004-addressing-an-iis-ftp-services-vulnerability.aspx" href="http://blogs.technet.com/b/srd/archive/2011/02/08/regarding-ms11-004-addressing-an-iis-ftp-services-vulnerability.aspx"&gt;http://blogs.technet.com/b/srd/archive/2011/02/08/regarding-ms11-004-addressing-an-iis-ftp-services-vulnerability.aspx&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=4293500" width="1" height="1"&gt;</description></item><item><title>Security update released for ASP.NET Padding Oracle Vulnerability</title><link>http://blogs.iis.net/nazim/archive/2010/09/29/security-update-released-for-asp-net-padding-oracle-vulnerability.aspx</link><pubDate>Wed, 29 Sep 2010 01:12:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:4102641</guid><dc:creator>naziml</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=4102641</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2010/09/29/security-update-released-for-asp-net-padding-oracle-vulnerability.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;Microsoft has just released &lt;A href="http://www.microsoft.com/technet/security/bulletin/ms10-070.mspx" mce_href="http://www.microsoft.com/technet/security/bulletin/ms10-070.mspx"&gt;security bulletin MS10-070&lt;/A&gt; with security updates for the issue. The updates are currently on Microsoft Download Center, but will be available through all other channels soon.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;A href="http://weblogs.asp.net/scottgu/archive/2010/09/28/asp-net-security-update-now-available.aspx" mce_href="http://weblogs.asp.net/scottgu/archive/2010/09/28/asp-net-security-update-now-available.aspx"&gt;ScottGu has also blogged some FAQs&lt;/A&gt; on this security update.&lt;/P&gt;
&lt;P mce_keep="true"&gt;It is highly recommended for customers using ASP.NET to apply the security update on their servers.&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=4102641" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/Windows+Security/default.aspx">Windows Security</category><category domain="http://blogs.iis.net/nazim/archive/tags/ASP_2800_x_2900_/default.aspx">ASP(x)</category></item><item><title>Update 1: ASP.NET Zero Day Vulnerability - Padding Oracle Exploit</title><link>http://blogs.iis.net/nazim/archive/2010/09/21/update-1-asp-net-zero-day-vulnerability-padding-oracle-exploit.aspx</link><pubDate>Tue, 21 Sep 2010 02:12:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:4089706</guid><dc:creator>naziml</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=4089706</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2010/09/21/update-1-asp-net-zero-day-vulnerability-padding-oracle-exploit.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;ScottGu has posted some additional FAQs on &lt;A href="http://weblogs.asp.net/scottgu/archive/2010/09/20/frequently-asked-questions-about-the-asp-net-security-vulnerability.aspx"&gt;http://weblogs.asp.net/scottgu/archive/2010/09/20/frequently-asked-questions-about-the-asp-net-security-vulnerability.aspx&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;The Microsoft advisory has been revised with some additional content in the FAQs. &lt;A href="http://www.microsoft.com/technet/security/advisory/2416728.mspx" mce_href="http://www.microsoft.com/technet/security/advisory/2416728.mspx"&gt;http://www.microsoft.com/technet/security/advisory/2416728.mspx&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;The SRD blog has also been revised with some additional content. &lt;A href="http://blogs.technet.com/b/srd/archive/2010/09/20/additional-information-about-the-asp-net-vulnerability.aspx" mce_href="http://blogs.technet.com/b/srd/archive/2010/09/20/additional-information-about-the-asp-net-vulnerability.aspx"&gt;http://blogs.technet.com/b/srd/archive/2010/09/20/additional-information-about-the-asp-net-vulnerability.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;The Sharepoint team has a blog on some additional workarounds that you can employ for Sharepoint 2010. &lt;A href="http://blogs.msdn.com/b/sharepoint/archive/2010/09/21/security-advisory-2416728-vulnerability-in-asp-net-and-sharepoint.aspx" mce_href="http://blogs.msdn.com/b/sharepoint/archive/2010/09/21/security-advisory-2416728-vulnerability-in-asp-net-and-sharepoint.aspx"&gt;http://blogs.msdn.com/b/sharepoint/archive/2010/09/21/security-advisory-2416728-vulnerability-in-asp-net-and-sharepoint.aspx&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=4089706" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/Windows+Security/default.aspx">Windows Security</category><category domain="http://blogs.iis.net/nazim/archive/tags/ASP_2800_x_2900_/default.aspx">ASP(x)</category></item><item><title>ASP.Net zero day vulnerability - Padding Oracle exploit</title><link>http://blogs.iis.net/nazim/archive/2010/09/18/asp-net-zero-day-vulnerability-padding-oracle-exploit.aspx</link><pubDate>Sat, 18 Sep 2010 03:03:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:4085158</guid><dc:creator>naziml</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=4085158</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2010/09/18/asp-net-zero-day-vulnerability-padding-oracle-exploit.aspx#comments</comments><description>&lt;P&gt;&amp;nbsp;An ASP.Net cryptograhic zero day was publicly disclosed today. &lt;/P&gt;
&lt;P&gt;Microsoft has released an advisory to help customers understand the vulnerability and apply workarounds to secure their sites. The advisory is at &lt;A href="http://www.microsoft.com/technet/security/advisory/2416728.mspx" mce_href="http://www.microsoft.com/technet/security/advisory/2416728.mspx"&gt;http://www.microsoft.com/technet/security/advisory/2416728.mspx&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;The Microsoft Security Response Center (MSRC) has released a blog at &lt;A href="http://blogs.technet.com/b/msrc/archive/2010/09/17/security-advisory-2416728-released.aspx" mce_href="http://blogs.technet.com/b/msrc/archive/2010/09/17/security-advisory-2416728-released.aspx"&gt;http://blogs.technet.com/b/msrc/archive/2010/09/17/security-advisory-2416728-released.aspx.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The Security Research &amp;amp; Defense (SRD) team at Microsoft has also released a blog that contains a script to help detect vulnerable installations. The blog is located at &lt;A href="http://blogs.technet.com/b/srd/archive/2010/09/17/understanding-the-asp-net-vulnerability.aspx" mce_href="http://blogs.technet.com/b/srd/archive/2010/09/17/understanding-the-asp-net-vulnerability.aspx"&gt;http://blogs.technet.com/b/srd/archive/2010/09/17/understanding-the-asp-net-vulnerability.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You can check out more details on Scott Guthrie’s blog at &lt;A title=http://weblogs.asp.net/scottgu/archive/2010/09/18/important-asp-net-security-vulnerability.aspx href="http://weblogs.asp.net/scottgu/archive/2010/09/18/important-asp-net-security-vulnerability.aspx" mce_href="http://weblogs.asp.net/scottgu/archive/2010/09/18/important-asp-net-security-vulnerability.aspx"&gt;http://weblogs.asp.net/scottgu/archive/2010/09/18/important-asp-net-security-vulnerability.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.iis.net/nazim/archive/2010/09/21/update-1-asp-net-zero-day-vulnerability-padding-oracle-exploit.aspx" mce_href="http://blogs.iis.net/nazim/archive/2010/09/21/update-1-asp-net-zero-day-vulnerability-padding-oracle-exploit.aspx"&gt;&amp;gt; UPDATES HERE &amp;lt;&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=4085158" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/Windows+Security/default.aspx">Windows Security</category><category domain="http://blogs.iis.net/nazim/archive/tags/ASP_2800_x_2900_/default.aspx">ASP(x)</category></item><item><title>Fixes for several IIS issues released in September 2010 patch cycle</title><link>http://blogs.iis.net/nazim/archive/2010/09/16/fixes-for-several-iis-issues-released-in-september-2010-patch-cycle.aspx</link><pubDate>Thu, 16 Sep 2010 22:01:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:4083258</guid><dc:creator>naziml</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=4083258</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2010/09/16/fixes-for-several-iis-issues-released-in-september-2010-patch-cycle.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;We just released a bulletin this September that addresses&amp;nbsp;three IIS vulnerabilites.&amp;nbsp;Two of&amp;nbsp;these were responsibly discolsed, while one was publicly disclosed.&amp;nbsp;The bulletin is on &amp;nbsp;&lt;A href="http://www.microsoft.com/technet/security/bulletin/MS10-065.mspx"&gt;http://www.microsoft.com/technet/security/bulletin/MS10-065.mspx&lt;/A&gt;&amp;nbsp;and contains the mitigations and workarounds in each case. The knowledge base articles for each of the three vulnerabilities are linked below and contain affected platform information.&lt;/P&gt;
&lt;P mce_keep="true"&gt;CVE-2010-1899 [classic ASP]: Denial of Service:&amp;nbsp;
&lt;SCRIPT language=javascript&gt;endA()&lt;/SCRIPT&gt;
 &lt;A href="http://support.microsoft.com/kb/2124261/"&gt;http://support.microsoft.com/kb/2124261/&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;CVE-2010-2730 [fastCGI]: Remote Code Execution:&amp;nbsp; &lt;A href="http://support.microsoft.com/kb/2271195/"&gt;http://support.microsoft.com/kb/2271195/&lt;/A&gt;
&lt;SCRIPT language=javascript&gt;endA()&lt;/SCRIPT&gt;
 &lt;/P&gt;
&lt;P mce_keep="true"&gt;CVE-2010-2731 [Authentication]: Elevation of Privilege: &lt;A href="http://support.microsoft.com/kb/2290570/"&gt;http://support.microsoft.com/kb/2290570/&lt;/A&gt;
&lt;SCRIPT language=javascript&gt;endA()&lt;/SCRIPT&gt;
 &lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=4083258" width="1" height="1"&gt;</description></item><item><title>Dynamic IP Restrictions Beta 2 released!</title><link>http://blogs.iis.net/nazim/archive/2010/08/24/dynamic-ip-restrictions-beta-2-released.aspx</link><pubDate>Tue, 24 Aug 2010 16:42:47 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:4043037</guid><dc:creator>naziml</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=4043037</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2010/08/24/dynamic-ip-restrictions-beta-2-released.aspx#comments</comments><description>&lt;p&gt;Yes, it has been a while since Beta was released, but Beta 2 is finally released! You can download Dynamic IP Restrictions Beta 2 from the links below.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://download.microsoft.com/download/6/4/9/649FAA72-B683-4E6F-B1A3-059336576FBE/dynamiciprestrictions_beta2_x86.msi"&gt;Dynamic IP Restrictions 1.0&amp;#160; Beta 2 – x86&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://download.microsoft.com/download/D/A/D/DAD4CC0B-0877-41FF-864A-CCD00E77CDE8/dynamiciprestrictions_beta2_x64.msi"&gt;Dynamic IP Restrictions 1.0 Beta 2 – x64&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;For more details on the release make sure you check out the updated article on &lt;a href="http://learn.iis.net/page.aspx/548/using-dynamic-ip-restrictions/"&gt;using Dynamic IP Restrictions&lt;/a&gt;. I will take the time to mark the distinctions between Beta and Beta2 versions in this post. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Splitting dynamic and static IP restrictions&lt;/h2&gt;  &lt;p&gt;Well, in Beta we were experimenting with the codebase and possible restructuring of features by combining static and dynamic IP Restrictions. This caused a bunch of setup issues and didn’t buy us much in terms of ease of use and configuration. So we have decided to let static and dynamic IP restrictions each live in their own module and configuration space for Beta 2 and this will remain as such moving forward to RTW. What this means is that:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;You will need to uninstall the Beta version of Dynamic IP restriction before you can install Beta 2. Make sure to backup configuration before doing this! &lt;/li&gt;    &lt;li&gt;Since static IP restrictions module was uninstalled during the installation of dynamic IP restrictions Beta, you will now have to re-install (re-enable) static IP restrictions module (IP and Domain Restrictions). &lt;/li&gt; &lt;/ol&gt;  &lt;h2&gt;Negligible runtime performance impact&lt;/h2&gt;  &lt;p&gt;The other change, that will be invisible to the end user, is a complete rewrite of the code to make the runtime performance impact of the module almost 0, even if you are just serving static files from your web server. We feel that every web server should have this feature installed and enabled and this way we ensure that the dynamic IP restrictions module will have no performance impact on your server.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Removal of RSCA interface&lt;/h2&gt;  &lt;p&gt;In Beta, you could use our RSCA interface to see currently blocked IP addresses, but this is not much more than eye candy. The data presented through this is not really actionable, since this list is going to be highly dynamic by nature. This module has been designed as a security defense tool and keeping that in mind the right action to perform is to detect repeat offenders and block them using either the static IP restriction or the firewall. To do this you would need historic data and not just a snapshot of what is happening right now. We had strong feedback from Beta that mining the logs was much more meaningful.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Proxy mode&lt;/h2&gt;  &lt;p&gt;Requests coming to the web server from a proxy or firewall server usually has the IP address of the firewall or proxy server as the client IP address. This defeats the usability of dynamic IP restrictions module because client IP address to actual clients is now a many to one mapping. We now have a configuration option that will enable the module to use the first IP address in the X-Forwarded-For request header as the client IP address. This header is used as the de-facto mechanism of reporting originating IP address.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Server and site level configuration only&lt;/h2&gt;  &lt;p&gt;One of the main changes we had to make in the module to make it extremely performant is to restrict configuring this module to server and site level only. If you host multiple applications with extremely different request-response characteristics on the same site, you should move them to different sites on the same server to increase the effectiveness of the module.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I will have a blog/article on using LogParser to mine data from log output of dynamic IP restrictions soon.&lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=4043037" width="1" height="1"&gt;</description></item><item><title>Security fix for IIS Extended Protection released</title><link>http://blogs.iis.net/nazim/archive/2010/06/09/security-fix-for-iis-extended-protection-released.aspx</link><pubDate>Wed, 09 Jun 2010 18:56:42 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:3913506</guid><dc:creator>naziml</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=3913506</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2010/06/09/security-fix-for-iis-extended-protection-released.aspx#comments</comments><description>&lt;p&gt;Microsoft has just released a fix for the &lt;a href="http://blogs.iis.net/nazim/archive/2009/12/09/extended-protection-for-windows-authentication-in-iis.aspx"&gt;Extended Protection for Windows Authentication feature in IIS&lt;/a&gt;. The details about the issue are in &lt;a href="http://www.microsoft.com/technet/security/Bulletin/MS10-040.mspx"&gt;security bulletin MS10-040&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Important things to note about the issue/fix:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;strong&gt;The fix is only applicable if you have Extended Protection installed.       &lt;br /&gt;&lt;/strong&gt;Windows 7 and Windows Server 2008 R2 have this feature in the OS. However all previous platforms require you to install &lt;a href="http://support.microsoft.com/kb/973917"&gt;KB 973917&lt;/a&gt; to get this particular feature. So if you did not install KB 973917 on your Windows Server 2008 machine for example, you won't need this update.      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;The issue will occur only if you set &lt;/strong&gt;&lt;a href="http://support.microsoft.com/kb/973917"&gt;&lt;strong&gt;Extended Protection tokenChecking flags&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; to 'Allow' (partially hardened).        &lt;br /&gt;&lt;/strong&gt;Your server configuration is NOT vulnerable if the Extended protection feature is not in use, i.e. tokenChecking=None, or your server is configured to a 'hardened' state, i.e. tokenChecking=Require. Your server is vulnerable on if it is configured to a partially hardened state, i.e. tokenChecking=Allow. In this state your server will allow Windows Authentication without a Channel Binding Token from clients that do not support it.&lt;/li&gt; &lt;/ol&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=3913506" width="1" height="1"&gt;</description></item><item><title>Blocking SQL injection using IIS URL Rewrite</title><link>http://blogs.iis.net/nazim/archive/2010/03/23/blocking-sql-injection-using-iis-url-rewrite.aspx</link><pubDate>Tue, 23 Mar 2010 16:36:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:3746653</guid><dc:creator>naziml</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=3746653</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2010/03/23/blocking-sql-injection-using-iis-url-rewrite.aspx#comments</comments><description>&lt;P&gt;We have had quite a few conversations about SQL injection on my blog, including &lt;EM&gt;&lt;A href="http://blogs.iis.net/nazim/archive/2008/04/28/filtering-sql-injection-from-classic-asp.aspx" mce_href="http://blogs.iis.net/nazim/archive/2008/04/28/filtering-sql-injection-from-classic-asp.aspx"&gt;Filtering SQL Injection from Classic ASP&lt;/A&gt;&lt;/EM&gt; and &lt;EM&gt;&lt;A href="http://blogs.iis.net/nazim/archive/2008/06/30/using-the-new-rules-configuration-in-urlscan-v3-0-beta-part-2.aspx" mce_href="http://blogs.iis.net/nazim/archive/2008/06/30/using-the-new-rules-configuration-in-urlscan-v3-0-beta-part-2.aspx"&gt;Using Rules Configuration in UrlScan 3.0&lt;/A&gt;&lt;/EM&gt; to filter SQL injection. One of the shortcomings that we talked about was that UrlScan is not as flexible as some users want it to be since it does not have the ability to use regular expressions. Well the story changes quite a bit with &lt;A href="http://learn.iis.net/page.aspx/460/using-url-rewrite-module/" mce_href="http://learn.iis.net/page.aspx/460/using-url-rewrite-module/"&gt;IIS URL Rewrite module&lt;/A&gt;, that is capable of doing request and response rewriting based on regular expressions. For those weighing between URL Rewrite and UrlScan, URL Rewrite has more flexibility but UrlScan is a lot more performant, so choose depending on your needs and resources.&lt;/P&gt;
&lt;P&gt;I have seen a lot of articles crop up with increasingly complex and voluminous rules for this, so I wanted to present something a little more simplified for folks to use. Thanks to Bala from the SQL Server Security team (who has written excellent &lt;A href="http://msdn.microsoft.com/en-us/library/cc676512.aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc676512.aspx"&gt;MSDN documentation on preventing SQL injections in ASP&lt;/A&gt;) there is a simpler rule to use that will catch quite a few of the variants without any false positives for any valid requests that I have seen so far. Most of the widespread automated SQL injection attacks use a DECLARE-&amp;gt;CAST-&amp;gt;EXEC approach to executing their injection. If I were to just put 'CAST' in a deny list I would hit a lot of false-positives, e.g. if my Url contained the word 'casting'.By requiring a Declare ... Cast ... Exec structure we can drastically reduce the chances of a false-positive.&lt;/P&gt;
&lt;P&gt;Here is the Regular Expression used:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT color=#008080 face="Courier New"&gt;[dD][\%]*[eE][\%]*[cC][\%]*[lL][\%]*[aA][\%]*[rR][\%]*[eE][\s\S]*[@][a-zA-Z0-9_]+[\s\S]*[nN]*[\%]*[vV][\%]*[aA][\%]*[rR][\%]*[cC][\%]*[hH][\%]*[aA][\%]*[rR][\s\S]*[eE][\%]*[xX][\%]*[eE][\%]*[cC][\s\S]*&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Notice the the groupings in the brackets towards the beginning spell out DECLARE and that towards the end spell out EXEC. That should give you a good idea of how this regex is expected to work. To add this validation to the REQUEST_URI you could use configuration like that below in a web.config file.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class=code&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;?xml&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; version&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="1.0"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; encoding&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="UTF-8"?&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;configuration&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;system.webServer&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;rewrite&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;rules&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;rule&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Filter SQL injection"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; stopProcessing&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="true"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;match&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; url&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=".*"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;conditions&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;add&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; input&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="{REQUEST_URI}"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; pattern&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="[dD][\%]*[eE][\%]*[cC][\%]*[lL][\%]*[aA][\%]*[rR][\%]*[eE][\s\S]*[@][a-zA-Z0-9_]+[\s\S]*[nN]*[\%]*[vV][\%]*[aA][\%]*[rR][\%]*[cC][\%]*[hH][\%]*[aA][\%]*[rR][\s\S]*[eE][\%]*[xX][\%]*[eE][\%]*[cC][\s\S]*"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;conditions&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;action&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; type&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="AbortRequest"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;rule&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;rules&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;rewrite&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;system.webServer&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;configuration&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;&lt;/FONT&gt; &lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can change the &lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;match&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; url&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt; directive above to \&lt;FONT color=#0000ff&gt;.as[p|px]&lt;/FONT&gt; if you want to apply the filtering rule to .asp and .aspx pages only.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#ff0000&gt;Update&lt;/FONT&gt;:&lt;/STRONG&gt; The SQL server security team has a more detailed &lt;A href="http://blogs.msdn.com/sqlsecurity/archive/2010/04/27/blocking-automated-sql-injection-attacks-using-regular-expressions.aspx" mce_href="http://blogs.msdn.com/sqlsecurity/archive/2010/04/27/blocking-automated-sql-injection-attacks-using-regular-expressions.aspx"&gt;blog entry&lt;/A&gt; on this that you can refer to.&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=3746653" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/SQL+injection/default.aspx">SQL injection</category></item><item><title>Fixing IIS 6 issue with semi-colon</title><link>http://blogs.iis.net/nazim/archive/2010/01/15/fixing-iis-6-issue-with-semi-colon.aspx</link><pubDate>Fri, 15 Jan 2010 02:19:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:3618585</guid><dc:creator>naziml</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=3618585</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2010/01/15/fixing-iis-6-issue-with-semi-colon.aspx#comments</comments><description>&lt;P&gt;In an &lt;A href="http://blogs.iis.net/nazim/archive/2009/12/29/public-disclosure-of-iis-security-issue-with-semi-colons-in-url.aspx" mce_href="http://blogs.iis.net/nazim/archive/2009/12/29/public-disclosure-of-iis-security-issue-with-semi-colons-in-url.aspx"&gt;earlier post&lt;/A&gt; I talked about the semi-colon issue and since then we have published a &lt;A href="http://support.microsoft.com/kb/979124" mce_href="http://support.microsoft.com/kb/979124"&gt;KB article 979124&lt;/A&gt; on how to configure uploads for web applications in IIS as well. To complete the story I wanted to do a quick write-up on how to go about fixing your server configuration to avoid this issue.&lt;/P&gt;
&lt;H3&gt;Step 1: Block incoming malicious requests using UrlScan&lt;/H3&gt;
&lt;P&gt;This is a stopgap solution to keep your server running while you fix the configuration issue. The simplest solution is to disallow semi-colons in your URL.&amp;nbsp;Please refer to the &lt;A href="http://learn.iis.net/page.aspx/473/using-urlscan" mce_href="http://learn.iis.net/page.aspx/473/using-urlscan"&gt;Using UrlScan&lt;/A&gt; article on installing and&amp;nbsp; configuring the tool. &lt;STRONG&gt;The specific piece of configuration you want to add to the urlscan.ini file is the value 0x3B in the [DenyUrlSequences] section. &lt;/STRONG&gt;0x3B is the character value for the semi-colon character.&lt;/P&gt;
&lt;H3&gt;Step 2: Identify and modify incorrectly configured upload directories&lt;/H3&gt;
&lt;P&gt;There are multiple ways that your upload directories could be misconfigured depending on how you configure isolation for your site (metabase ACLs vs. NTFS ACLs). In case you are using&amp;nbsp;metabase ACLs,&amp;nbsp;what we need to identify here are all the paths that have both Write and Script flags set on the &lt;A href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/e9b6d626-9583-4d59-b7f7-a079ec47461c.mspx?mfr=true" mce_href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/e9b6d626-9583-4d59-b7f7-a079ec47461c.mspx?mfr=true"&gt;AccessFlags metabase property&lt;/A&gt; and remove the script flag. Here’s a sample script that will find all such paths and fix them for a server. &lt;STRONG&gt;&lt;U&gt;Please take a look at the output of the script to see the paths where script permissions were removed and make sure they are indeed upload paths.&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class=code&gt;&lt;FONT color=#006400&gt;'&amp;nbsp; File: RemoveScriptPermissions.vbs&amp;nbsp; &lt;BR&gt;'&amp;nbsp; Copyright Microsoft Corp. 2010&amp;nbsp; &lt;BR&gt;'&amp;nbsp; Author: Nazim Lala&amp;nbsp; &lt;BR&gt;'&amp;nbsp; &lt;BR&gt;'&amp;nbsp; This script will remove script permissions from AccessFlags for all&amp;nbsp; &lt;BR&gt;'&amp;nbsp; paths on the local server that has both write(MD_ACCESS_WRITE) and&amp;nbsp; &lt;BR&gt;'&amp;nbsp; script(MD_ACCESS_SCRIPT) permissions. You can optionally specify &lt;BR&gt;'&amp;nbsp; a remote server name to perform this operation on. &lt;BR&gt;'&amp;nbsp; &lt;BR&gt;'&amp;nbsp; Usage:&amp;nbsp; &lt;BR&gt;'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cscript RemoveScriptPermissions.vbs [RemoteServerName] &lt;BR&gt;' &lt;BR&gt;' NOTE: THIS SCRIPT IS FOR USE WITH IIS6 ONLY (WINDOWS SERVER 2003) &lt;BR&gt;'&amp;nbsp; &lt;BR&gt;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;OPTION&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;EXPLICIT&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;DIM&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;strServer,&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;strBindings&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;DIM&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;objWebService,&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;objWebServer,&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;objDir&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;IF&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;WScript&lt;/FONT&gt;&lt;FONT color=#000000&gt;.Arguments.Length&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#800000&gt;1&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;THEN&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;strServer&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;WScript&lt;/FONT&gt;&lt;FONT color=#000000&gt;.Arguments(&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#800000&gt;0&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;ELSE&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;strServer&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt; "localhost" &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;END&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;IF&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;SET&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;objWebService&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;GetObject&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#808080&gt; "IIS://" &lt;/FONT&gt;&lt;FONT color=#000000&gt;&amp;amp;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;strServer&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;&amp;amp;&lt;/FONT&gt;&lt;FONT color=#808080&gt; "/W3SVC" &lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#006400&gt;' Enumerate websites on the server &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;FOR&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;EACH&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;objWebServer&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;IN&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;objWebService&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;IF&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;objWebserver.Class&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt; "IIsWebServer" &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;THEN&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;EnumAndFixDirectories(objWebServer)&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;END&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;IF&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;NEXT&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;SUB&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;EnumAndFixDirectories(objDir)&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;DIM&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;objSubDir&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;FixScriptAndWrite(objDir)&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;FOR&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;EACH&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;objSubDir&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;IN&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;objDir&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;IF&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(objSubDir.Class&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt; "IIsWebVirtualDir"&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;OR&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;_&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;objSubDir.Class&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt; "IIsWebDirectory"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;THEN&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;EnumAndFixDirectories(objSubDir)&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;END&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;IF&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;NEXT&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;END&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;SUB&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;SUB&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;FixScriptAndWrite(objDir)&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;IF&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(objDir.AccessWrite&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;True&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;AND&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;objDir.AccessScript&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;True&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;THEN&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;WScript&lt;/FONT&gt;&lt;FONT color=#000000&gt;.Echo&lt;/FONT&gt;&lt;FONT color=#808080&gt; "Fixing: " &lt;/FONT&gt;&lt;FONT color=#000000&gt;&amp;amp;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;objDir.AdsPath&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;objDir.Put&lt;/FONT&gt;&lt;FONT color=#808080&gt; "AccessScript"&lt;/FONT&gt;&lt;FONT color=#000000&gt;,&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;False&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;objDir.SetInfo&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;END&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;IF&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;END&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;SUB&lt;/FONT&gt; &lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;
&lt;H3&gt;Step 3: Remove UrlScan filtering for semi-colons&lt;/H3&gt;
&lt;P mce_keep="true"&gt;After you have confirmed that all affected&amp;nbsp;configuration has been updated, go and remove the semicolon (0x3B) from the [DenyUrlSequences] entry in urlscan.ini.&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=3618585" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/UrlScan/default.aspx">UrlScan</category><category domain="http://blogs.iis.net/nazim/archive/tags/IIS6/default.aspx">IIS6</category></item><item><title>Public disclosure of IIS security issue with semi-colons in URL</title><link>http://blogs.iis.net/nazim/archive/2009/12/29/public-disclosure-of-iis-security-issue-with-semi-colons-in-url.aspx</link><pubDate>Tue, 29 Dec 2009 19:19:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:3588184</guid><dc:creator>naziml</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=3588184</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2009/12/29/public-disclosure-of-iis-security-issue-with-semi-colons-in-url.aspx#comments</comments><description>&lt;P&gt;IIS has been alerted to the claim of a new security issue in IIS 6 and I wanted to explain the issue and our position on it. &lt;/P&gt;
&lt;P&gt;The issue in question affects only IIS 6 (Windows Server 2003) and arises when you send a URL with a semi-colon in it. IIS 6 uses the path before the semi-colon to determine the script handler for it. So sending a URL like &lt;A href="http://www.fabrikam.com/uploads/foo.asp;bar.jpg" mce_href="http://www.fabrikam.com/uploads/foo.asp;bar.jpg"&gt;http://www.fabrikam.com/uploads/foo.asp;bar.jpg&lt;/A&gt; results in mapping this request to the ASP script handler since it ignores everything after the semi-colon. In the case where this URL is given Execute Permissions, we will end up executing the ASP script inside a file "foo.asp;bar.jpg". &lt;/P&gt;
&lt;P&gt;Here are the facts concerning this issue:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;You MUST have write permissions to upload your content. The issue being discussed here does not let you bypass that requirement. So if you don't allow uploads, read no further, you are not exposed to the issue. &lt;/LI&gt;
&lt;LI&gt;If you allow uploads of files then &lt;A href="http://technet.microsoft.com/en-us/library/cc782762(WS.10).aspx" mce_href="http://technet.microsoft.com/en-us/library/cc782762(WS.10).aspx"&gt;IIS best practices&lt;/A&gt; require you NOT to give&amp;nbsp;script permissions to an upload folder (see bullet point 7 in the link). In the case that you follow best practices and not grant&amp;nbsp;script permissions to an upload folder, there is no room for any script being executed. Requesting a URL like &lt;A href="http://www.fabrikam.com/uploads/foo.asp;bar.jpg" mce_href="http://www.fabrikam.com/uploads/foo.asp;bar.jpg"&gt;http://www.fabrikam.com/uploads/foo.asp;bar.jpg&lt;/A&gt; on a properly configured server will result in a 403 error. Hence there is no security issue on a properly configured server either. &lt;/LI&gt;
&lt;LI&gt;If your server uses an non-recommended configuration and allows uploads and script execution privileges together, then only those authorized to actually upload content will be able to place said content. And in this case the existence of this issue is of no major import in letting you execute your script ... since that is exactly what you have configured your server for.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;In summary, there is a functionality issue here, but there is no security issue unless you already had a poorly configured server to begin with.&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=3588184" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/IIS6/default.aspx">IIS6</category></item></channel></rss>