<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Sacha Faust Web Security Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/sfaust/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/sfaust/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:27:12 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>FxCop ASP.NET Security Rules release</title>
      <link>https://docs.microsoft.com/archive/blogs/sfaust/fxcop-asp-net-security-rules-release</link>
      <pubDate>Mon, 13 Dec 2010 14:25:05 GMT</pubDate>
      <dc:creator><![CDATA[TheFaust]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sfaust/2010/12/13/fxcop-asp-net-security-rules-release/</guid>
      <description><![CDATA[The FxCop ASP.NET security rules have finally been released after being used for quite some time...]]></description>
      <content:encoded><![CDATA[<p>The FxCop ASP.NET security rules have finally been released after being used for quite some time internally.&nbsp; You can read more about it in this month MSDN magazine </p>
<p>on https://msdn.microsoft.com/en-us/magazine/gg490350.aspx</p>
<p>The rules are available on codeplex at https://fxcopaspnetsecurity.codeplex.com/</p>]]></content:encoded>
    </item>
    <item>
      <title>Strict Transport Security ASP.NET Module</title>
      <link>https://docs.microsoft.com/archive/blogs/sfaust/strict-transport-security-asp-net-module</link>
      <pubDate>Tue, 11 May 2010 20:23:00 GMT</pubDate>
      <dc:creator><![CDATA[TheFaust]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sfaust/2010/05/11/strict-transport-security-asp-net-module/</guid>
      <description><![CDATA[I’ve been tackling the problem of users connecting to online services from untrusted network. At...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>I’ve been tackling the problem of users connecting to online services from untrusted network. At work we typically call this the “Startbucks” scenario where a user is connecting to a random wifi and accessing corporate data through online services. For the majority of the cases, the browser is used to connect to the services and I don’t expect it to change much for the next few years.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>One of the new proposal I’ve stumble upon is the </FONT><A href="https://en.wikipedia.org/wiki/Strict_Transport_Security" mce_href="https://en.wikipedia.org/wiki/Strict_Transport_Security"><FONT size=3 face=Calibri>Strict Transport Security</FONT></A><FONT size=3 face=Calibri> proposal which is being sponsored by </FONT><A href="https://www.paypal.com/" mce_href="https://www.paypal.com/"><FONT color=#0000ff size=3 face=Calibri>Paypal</FONT></A><FONT size=3 face=Calibri> and currently supported by the </FONT><A href="https://www.google.com/chrome/index.html?hl=en&amp;brand=CHMA&amp;utm_campaign=en&amp;utm_source=en-ha-na-us-bk&amp;utm_medium=ha" mce_href="https://www.google.com/chrome/index.html?hl=en&amp;brand=CHMA&amp;utm_campaign=en&amp;utm_source=en-ha-na-us-bk&amp;utm_medium=ha"><FONT size=3 face=Calibri>Google Chrome</FONT></A><FONT size=3 face=Calibri> browser. The spec is still under review and the latest version is available at </FONT><A href="https://lists.w3.org/Archives/Public/www-archive/2009Dec/att-0048/draft-hodges-strict-transport-sec-06.plain.html" mce_href="https://lists.w3.org/Archives/Public/www-archive/2009Dec/att-0048/draft-hodges-strict-transport-sec-06.plain.html"><FONT size=3 face=Calibri>https://lists.w3.org/Archives/Public/www-archive/2009Dec/att-0048/draft-hodges-strict-transport-sec-06.plain.html</FONT></A><FONT size=3><FONT face=Calibri> .<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>The proposal is quite simple and aims at forcing the browser to only connect over SSL by redirecting HTTP traffic to HTTPS at the browser level so that no connection is made over HTTP. This is implemented by adding a server component that provides the browser with a connection policy and by a browser component which enforce the policy provided by the server.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>I’ve seen a lot of applications force connection over HTTPS by simply detecting the connection over HTTP and returning a 302 redirect to the client to the HTTPS site but this specification improves this logic by telling the browser to automatically replace the HTTP location on the client side so that no “unsafe” connections are made. <o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>I believe that the Strict Transport Security proposal is a step in the right direction but I’m not sure about its acceptance. I also have some concerns about requiring the initially connection over HTTP and allowing the browser to connect back to HTTP once the policy expires. I believe that group policy might be a better approach there for certain high profile sites but only time will tell.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>After reading the specification, I realize that implementing the server processing is quite simple under ASP.NET and decided to implement a quick STS HTTP Module for ASP.NET and make it available.<o:p></o:p></FONT></FONT></P><o:p><FONT size=3 face=Calibri>
<H1 style="MARGIN: 24pt 0in 0pt"><SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"><FONT color=#365f91><FONT face=Cambria>Installation<o:p></o:p></FONT></FONT></SPAN></H1>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal>The STS module can be installed by adding it to the system.web.httpModules section of your web.config<o:p></o:p></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&lt;</SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">system.web</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;</SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">httpModules</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">add</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin"> </SPAN><SPAN style="COLOR: red; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">name</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">=</SPAN><SPAN style="FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">"<SPAN style="COLOR: blue">STSModule</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">type</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">STSModule.STSServerModule</SPAN>"<SPAN style="COLOR: blue">/&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;/</SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">httpModules</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&lt;/</SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">system.web</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p>&nbsp;</o:p></P>
<H1 style="MARGIN: 24pt 0in 0pt"><SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"><FONT color=#365f91><FONT face=Cambria>Configuration<o:p></o:p></FONT></FONT></SPAN></H1>
<H2 style="MARGIN: 10pt 0in 0pt"><SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 11pt"><FONT color=#4f81bd><FONT face=Cambria>Enabling configuration section<o:p></o:p></FONT></FONT></SPAN></H2>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal>The STS Server module can be configured in the web.config with the stsModule configuration section. To do so, the configuration section needs to be added to the configuration.configSections section of your web.config.<o:p></o:p></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&lt;</SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">configuration</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;</SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">configSections</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">sectionGroup</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin"> </SPAN><SPAN style="COLOR: red; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">name</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">=</SPAN><SPAN style="FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">"<SPAN style="COLOR: blue">stsModuleSection</SPAN>"<SPAN style="COLOR: blue">&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">section</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin"> </SPAN><SPAN style="COLOR: red; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">name</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">=</SPAN><SPAN style="FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">"<SPAN style="COLOR: blue">stsModule</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">type</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">STSModule.StrictTransportSecuritySection</SPAN>"<SPAN style="COLOR: blue">/&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">sectionGroup</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;/</SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">configSections</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="LINE-HEIGHT: 115%; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&lt;/</SPAN><SPAN style="LINE-HEIGHT: 115%; COLOR: #a31515; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">configuration</SPAN><SPAN style="LINE-HEIGHT: 115%; COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&gt;<o:p></o:p></SPAN></P>
<H2 style="MARGIN: 10pt 0in 0pt"><SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 11pt"><FONT color=#4f81bd><FONT face=Cambria>Configuring the module<o:p></o:p></FONT></FONT></SPAN></H2>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p>&nbsp;</o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal>
<TABLE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BORDER-COLLAPSE: collapse; BORDER-TOP: medium none; BORDER-RIGHT: medium none; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt" class=MsoTableGrid border=1 cellSpacing=0 cellPadding=0 class="MsoTableGrid">
<TBODY>
<TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 105.3pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #d9d9d9; BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-background-themecolor: background1; mso-background-themeshade: 217; mso-border-alt: solid windowtext .5pt" vAlign=top width=140>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>Configuration name<o:p></o:p></FONT></FONT></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 162.6pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #d9d9d9; BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-background-themecolor: background1; mso-background-themeshade: 217; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" vAlign=top width=217>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>Description<o:p></o:p></FONT></FONT></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 140.6pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #d9d9d9; BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-background-themecolor: background1; mso-background-themeshade: 217; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" vAlign=top width=187>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>Default value<o:p></o:p></FONT></FONT></P></TD></TR>
<TR style="mso-yfti-irow: 1">
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 105.3pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=140>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>maxAgeInSeconds<o:p></o:p></FONT></FONT></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 162.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=217>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>This section defines the max-age section of the Strict-Transport-Security header<o:p></o:p></FONT></FONT></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 140.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=187>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>86400<o:p></o:p></FONT></FONT></P></TD></TR>
<TR style="mso-yfti-irow: 2">
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 105.3pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=140>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>includeSubDomains<o:p></o:p></FONT></FONT></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 162.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=217>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>Define if the includeSubDomains section of the Strict-Transport-Security header is present.<o:p></o:p></FONT></FONT></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>If the value is true, the includeSubDomains will be added to the header.<o:p></o:p></FONT></FONT></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 140.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=187>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>false<o:p></o:p></FONT></FONT></P></TD></TR>
<TR style="mso-yfti-irow: 3">
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 105.3pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=140>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>redirectUrl<o:p></o:p></FONT></FONT></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 162.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=217>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>Defines the url specified in the redirection.<o:p></o:p></FONT></FONT></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>If the configuration is empty or not defined, the redirection url will be the same as the one questions but the scheme will be set to HTTPS.<o:p></o:p></FONT></FONT></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 140.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=187>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>Empty string<o:p></o:p></FONT></FONT></P></TD></TR>
<TR style="mso-yfti-irow: 4; mso-yfti-lastrow: yes">
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 105.3pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=140>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>use302<o:p></o:p></FONT></FONT></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 162.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=217>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>Specify if the status code should be 302 instead of the 301 specified in the spec.<o:p></o:p></FONT></FONT></P></TD>
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 140.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=187>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal><FONT face=Calibri><FONT size=3>false<o:p></o:p></FONT></FONT></P></TD></TR></TBODY></TABLE></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p>&nbsp;</o:p></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&lt;</SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">stsModuleSection</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">stsModule</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin"> </SPAN><SPAN style="COLOR: red; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">maxAgeInSeconds</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">=</SPAN><SPAN style="FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">"<SPAN style="COLOR: blue">86400</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="COLOR: red; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">includeSubDomains</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">=</SPAN><SPAN style="FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">"<SPAN style="COLOR: blue">false</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="COLOR: red; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">use302</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">=</SPAN><SPAN style="FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">"<SPAN style="COLOR: blue">false</SPAN>"<SPAN style="COLOR: blue">/&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-layout-grid-align: none; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&lt;/</SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">stsModuleSection</SPAN><SPAN style="COLOR: blue; FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-no-proof: yes; mso-bidi-theme-font: minor-latin">&gt;</SPAN><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p>&nbsp;</o:p>&nbsp;</FONT></o:p></P>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/01/13/70/STSServerModule.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-01-13-70/STSServerModule.zip">STSServerModule.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Using ValidateRequest to detect when XSS is occuring</title>
      <link>https://docs.microsoft.com/archive/blogs/sfaust/using-validaterequest-to-detect-when-xss-is-occuring</link>
      <pubDate>Wed, 28 Apr 2010 00:00:00 GMT</pubDate>
      <dc:creator><![CDATA[TheFaust]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sfaust/2010/04/28/using-validaterequest-to-detect-when-xss-is-occuring/</guid>
      <description><![CDATA[In a way to limit the risk of Cross-Site Scripting &nbsp;(XSS) attacks, ASP.NET 2.0 introduced a way...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>In a way to limit the risk of </FONT><A href="https://en.wikipedia.org/wiki/Cross-site_scripting"><FONT size=3 face=Calibri>Cross-Site Scripting</FONT></A><FONT size=3 face=Calibri> <SPAN style="mso-spacerun: yes">&nbsp;</SPAN>(XSS) attacks, ASP.NET 2.0 introduced a way to detect such attack and automatically reject the request. This functionality is exposed by the </FONT><A href="https://msdn.microsoft.com/en-us/library/system.web.configuration.pagessection.validaterequest.aspx"><FONT size=3 face=Calibri>PageSections.ValidationRequest</FONT></A><FONT size=3><FONT face=Calibri> and is turned on by default. <SPAN style="mso-spacerun: yes">&nbsp;</SPAN>This should not be considered an s a full proof solution against XSS but a good first line of defense for common cases. For information about this feature can be found on:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpFirst><SPAN style="mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><A href="https://www.asp.net/(S(ywiyuluxr3qb2dfva1z5lgeg))/learn/whitepapers/request-validation/"><FONT size=3 face=Calibri>https://www.asp.net/(S(ywiyuluxr3qb2dfva1z5lgeg))/learn/whitepapers/request-validation/</FONT></A><o:p></o:p></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpLast><SPAN style="mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>-</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><A href="https://msdn.microsoft.com/en-us/library/ms972969.aspx#securitybarriers_topic6"><FONT color=#0000ff size=3 face=Calibri>https://msdn.microsoft.com/en-us/library/ms972969.aspx#securitybarriers_topic6</FONT></A><o:p></o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT face=Calibri><FONT size=3>Some of the questions I’ve been asked repeatedly are:<o:p></o:p></FONT></FONT></P>
<H3 style="TEXT-INDENT: -0.25in; MARGIN: 10pt 0in 0pt 0.25in; mso-list: l1 level1 lfo2"><FONT color=#4f81bd><SPAN style="mso-bidi-font-family: Cambria; mso-fareast-font-family: Cambria"><SPAN style="mso-list: Ignore"><FONT size=3 face=Cambria>1.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Cambria><FONT size=3>How to detect when this is occurring and?<o:p></o:p></FONT></FONT></FONT></H3>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>When ASP.NET detects that XSS is occurring it throws an </FONT><A href="https://msdn.microsoft.com/en-us/library/system.web.httprequestvalidationexception.aspx"><FONT size=3 face=Calibri>HttpRequestValidationException</FONT></A><FONT size=3 face=Calibri> which can be caught in the </FONT><A href="https://msdn.microsoft.com/en-us/library/24395wz3.aspx"><FONT size=3 face=Calibri>Application_Error</FONT></A><FONT size=3><FONT face=Calibri> handler.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">void</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> Application_Error(<SPAN style="COLOR: blue">object</SPAN> sender, <SPAN style="COLOR: #2b91af">EventArgs</SPAN> e)<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">{<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Code that runs when an unhandled error occurs<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Exception</SPAN> lastError;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>lastError = Server.GetLastError();<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// If the last exception is HttpRequestValidationException<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// we log it and signout the user<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (lastError <SPAN style="COLOR: blue">is</SPAN> <SPAN style="COLOR: #2b91af">HttpRequestValidationException</SPAN>)<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Log information about the attack<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>LogXssAttack();<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Server.ClearError();<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt; BACKGROUND: #eeece1" class=MsoNormal><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<H3 style="TEXT-INDENT: -0.25in; MARGIN: 10pt 0in 0pt 0.25in; mso-list: l1 level1 lfo2"><FONT color=#4f81bd><SPAN style="mso-bidi-font-family: Cambria; mso-fareast-font-family: Cambria"><SPAN style="mso-list: Ignore"><FONT size=3 face=Cambria>2.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Cambria><FONT size=3>What could potentially be done about it? <o:p></o:p></FONT></FONT></FONT></H3>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>One of the option that can be quite annoying for attackers trying to scan the application for XSS is to log them off automatically when </FONT><A href="https://msdn.microsoft.com/en-us/library/system.web.httprequestvalidationexception.aspx"><FONT size=3 face=Calibri>HttpRequestValidationException</FONT></A><FONT size=3><FONT face=Calibri>.<o:p></o:p></FONT></FONT></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">void</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> Application_Error(<SPAN style="COLOR: blue">object</SPAN> sender, <SPAN style="COLOR: #2b91af">EventArgs</SPAN> e) <o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">{ <o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Code that runs when an unhandled error occurs<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Exception</SPAN> lastError;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>lastError = Server.GetLastError();<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// If the last exception is HttpRequestValidationException<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// we log it and signout the user<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (lastError <SPAN style="COLOR: blue">is</SPAN> <SPAN style="COLOR: #2b91af">HttpRequestValidationException</SPAN>)<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Log the attack<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>LogXssAttack();<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// If the user is authenticated we:<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// - log the user out<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// - invalidate his session<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// - redirect him to the login page<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (Request.IsAuthenticated)<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">FormsAuthentication</SPAN>.SignOut();<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Session.Abandon();<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">FormsAuthentication</SPAN>.RedirectToLoginPage();<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Server.ClearError();<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #eeece1; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt; BACKGROUND: #eeece1" class=MsoNormal><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">}</SPAN><o:p></o:p></P>]]></content:encoded>
    </item>
    <item>
      <title>Watch out for scheme relative urls</title>
      <link>https://docs.microsoft.com/archive/blogs/sfaust/watch-out-for-scheme-relative-urls</link>
      <pubDate>Tue, 30 Mar 2010 00:12:00 GMT</pubDate>
      <dc:creator><![CDATA[TheFaust]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sfaust/2010/03/30/watch-out-for-scheme-relative-urls/</guid>
      <description><![CDATA[Doing my usual random code browsing yesterday I stumbled on a method that peaked my curiosity. The...]]></description>
      <content:encoded><![CDATA[<P><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin">Doing my usual random code browsing yesterday I stumbled on a method that peaked my curiosity. The intent of the method is to only allow redirect to relative paths. If the redirect is not a relative path, it is rejected. Let’s look at the implementation.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><FONT size=3><FONT face=Calibri><SPAN style="COLOR: blue; mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri">public</SPAN><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"> <SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">void</SPAN> SafeRedirect(<SPAN style="COLOR: #2b91af">HttpResponse</SPAN> response, <SPAN style="COLOR: blue">string</SPAN> rawRelativeUrl)<o:p></o:p></SPAN></FONT></FONT></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri>{<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Uri</SPAN> tmpUrl;<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// we use the default action of redirecting to<o:p></o:p></SPAN></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="COLOR: green; mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>// the root if the url is not defined<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (response == <SPAN style="COLOR: blue">null</SPAN>)<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">ArgumentNullException</SPAN>(<SPAN style="COLOR: #a31515">"response"</SPAN>);<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (rawRelativeUrl == <SPAN style="COLOR: blue">null</SPAN>)<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">ArgumentNullException</SPAN>(<SPAN style="COLOR: #a31515">"rawRelativeUrl"</SPAN>);<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (rawRelativeUrl.Trim().Length == 0)<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">ArithmeticException</SPAN>(<SPAN style="COLOR: #a31515">"rawRelativeUrl must not be empty"</SPAN>);<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// this method will parse the string into a url so we can make<o:p></o:p></SPAN></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// sure it is a relative.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>This protects against open redirects<o:p></o:p></SPAN></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (<SPAN style="COLOR: #2b91af">Uri</SPAN>.TryCreate(rawRelativeUrl, <SPAN style="COLOR: #2b91af">UriKind</SPAN>.Relative, <SPAN style="COLOR: blue">out</SPAN> tmpUrl))<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>response.Redirect(rawRelativeUrl);<o:p></o:p></FONT></FONT></SPAN></P>
<P style="BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242"><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-no-proof: yes; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin">}</SPAN><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><SPAN style="mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri>Looking at the code, we can see that each parameter is validated and it makes use of the System.Uri class and only redirect if the rawRelativeUrl is relative. The issue with this code is that it doesn’t handle scheme relative paths. Scheme relative paths are basically a relative url that doesn’t include the scheme section. For example //www.microsoft.com is a scheme relative url that will redirect to {base scheme}//www.microsoft.com.<o:p></o:p></FONT></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><SPAN style="mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><SPAN style="mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3 face=Calibri>This means that if the application is hosted under </FONT><A href="https://www.mysite.com/" mce_href="https://www.mysite.com/"><FONT color=#0000ff size=3 face=Calibri>https://www.mysite.com</FONT></A><FONT size=3 face=Calibri> and the rawRelativeUrl is //www.microsoft.com, it will allow the redirect and the browser will be directed to </FONT><A href="https://www.microsoft.com/" mce_href="https://www.microsoft.com/"><FONT size=3 face=Calibri>https://www.microsoft.com</FONT></A><FONT size=3><FONT face=Calibri>. This is actually what SafeRedirect is trying to protect against.<o:p></o:p></FONT></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><SPAN style="mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><SPAN style="mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri>To remediate the issue, the code needs to handle the scheme relative url case by rejecting rawRelativeUrl if it begins with the double forward slash ‘//’. <o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><FONT size=3><FONT face=Calibri><SPAN style="COLOR: blue; mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri">public</SPAN><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"> <SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">void</SPAN> SafeRedirect(<SPAN style="COLOR: #2b91af">HttpResponse</SPAN> response, <SPAN style="COLOR: blue">string</SPAN> rawRelativeUrl)<o:p></o:p></SPAN></FONT></FONT></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri>{<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Uri</SPAN> tmpUrl;<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// we use the default action of redirecting to the root if the url is not defined<o:p></o:p></SPAN></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (response == <SPAN style="COLOR: blue">null</SPAN>)<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">ArgumentNullException</SPAN>(<SPAN style="COLOR: #a31515">"response"</SPAN>);<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (rawRelativeUrl == <SPAN style="COLOR: blue">null</SPAN>)<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">ArgumentNullException</SPAN>(<SPAN style="COLOR: #a31515">"rawRelativeUrl"</SPAN>);<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (rawRelativeUrl.Trim().Length == 0)<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">ArithmeticException</SPAN>(<SPAN style="COLOR: #a31515">"rawRelativeUrl must not be empty"</SPAN>);<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="BACKGROUND: yellow; COLOR: green; mso-highlight: yellow">// Reject scheme relative url<o:p></o:p></SPAN></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="BACKGROUND: yellow; mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-highlight: yellow"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (rawRelativeUrl.StartsWith(<SPAN style="COLOR: #a31515">"//"</SPAN>))<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><FONT size=3><FONT face=Calibri><SPAN style="BACKGROUND: yellow; mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-highlight: yellow"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">throw</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">ArgumentException</SPAN>(<SPAN style="COLOR: #a31515">"scheme relative url is not allow"</SPAN>, <SPAN style="COLOR: #a31515">"rawRelativeUrl"</SPAN>);</SPAN><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><o:p></o:p></SPAN></FONT></FONT></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// this method will parse the string into a url so we can make<o:p></o:p></SPAN></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// sure it is a relative.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>This protects against open redirects<o:p></o:p></SPAN></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (<SPAN style="COLOR: #2b91af">Uri</SPAN>.TryCreate(rawRelativeUrl, <SPAN style="COLOR: #2b91af">UriKind</SPAN>.Relative, <SPAN style="COLOR: blue">out</SPAN> tmpUrl))<o:p></o:p></FONT></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>response.Redirect(rawRelativeUrl);<o:p></o:p></FONT></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 10pt; BACKGROUND: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class=MsoNormal><SPAN style="mso-no-proof: yes; mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><FONT size=3 face=Calibri>}</FONT></SPAN><SPAN style="mso-bidi-theme-font: minor-latin; mso-bidi-font-family: Calibri"><o:p></o:p></SPAN></P>]]></content:encoded>
    </item>
    <item>
      <title>Lessons Learned at Windows Live by Using ASP.NET MVC</title>
      <link>https://docs.microsoft.com/archive/blogs/sfaust/lessons-learned-at-windows-live-by-using-asp-net-mvc</link>
      <pubDate>Tue, 08 Dec 2009 11:32:00 GMT</pubDate>
      <dc:creator><![CDATA[TheFaust]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sfaust/2009/12/08/lessons-learned-at-windows-live-by-using-asp-net-mvc/</guid>
      <description><![CDATA[We published a new security whitepaper base on our experience with ASP.NET MVC. The whitepaper is...]]></description>
      <content:encoded><![CDATA[<P>We published a new security whitepaper base on our experience with ASP.NET MVC. The whitepaper is available at <A href="https://www.microsoft.com/downloads/details.aspx?FamilyID=7606f801-70c5-49ca-a18c-91d4ed725833&amp;displaylang=en">https://www.microsoft.com/downloads/details.aspx?FamilyID=7606f801-70c5-49ca-a18c-91d4ed725833&amp;displaylang=en</A></P>
<P mce_keep="true">&nbsp;</P>]]></content:encoded>
    </item>
    <item>
      <title>Fxcop rule to verify the use of ASP.NET MVC AntiforgeryTokenAttribute</title>
      <link>https://docs.microsoft.com/archive/blogs/sfaust/fxcop-rule-to-verify-the-use-of-asp-net-mvc-antiforgerytokenattribute</link>
      <pubDate>Wed, 07 Jan 2009 16:56:00 GMT</pubDate>
      <dc:creator><![CDATA[TheFaust]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sfaust/2009/01/07/fxcop-rule-to-verify-the-use-of-asp-net-mvc-antiforgerytokenattribute/</guid>
      <description><![CDATA[I’ve been working on code auditing for a project that makes use of the latest ASP.NET MVC api....]]></description>
      <content:encoded><![CDATA[<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Arial','sans-serif'">I’ve been working on code auditing for a project that makes use of the latest <A class="" title="ASP.NET MVC" href="https://www.asp.net/mvc/" target=_blank mce_href="https://www.asp.net/mvc/">ASP.NET MVC</A> api. Turned out that it didn’t benefit from the built-in <A class="" title=CSRF href="https://en.wikipedia.org/wiki/Cross-site_request_forgery" target=_blank mce_href="https://en.wikipedia.org/wiki/Cross-site_request_forgery">CSRF</A> mitigation available since preview 5 version of the api. The mitigation is quite simple and generates tokens and validates them inside controller actions. As usual, I rather spend my time looking for more complex issues during code audit&nbsp;and I prefer relying on the <A class="" title=FxCop href="https://en.wikipedia.org/wiki/FxCop" target=_blank mce_href="https://en.wikipedia.org/wiki/FxCop">FxCop</A> automation we have to spot this sort of problem earlier so I implemented a simple rule that will catch where the mitigation should be used. The rule will look for controller actions that are available via POST and look to see if the method declares the <EM>ValidateAntiForgeryTokenAttribute</EM>. You can read more on how to implement the mitigation in your code by reading Steve Sanderson <A class="" title="blog post" href="https://blog.codeville.net/2008/09/01/prevent-cross-site-request-forgery-csrf-using-aspnet-mvcs-antiforgerytoken-helper/" target=_blank mce_href="https://blog.codeville.net/2008/09/01/prevent-cross-site-request-forgery-csrf-using-aspnet-mvcs-antiforgerytoken-helper/">blog post</A> on the subject.</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Arial','sans-serif'"><STRONG><U>Installation</U></STRONG></SPAN></P>
<OL>
<LI>
<DIV class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Arial','sans-serif'">Copy MVCAntiforgeryTokenChecker.dll in your FxCop rule folder. By default it's under c:\Program Files\Microsoft FxCop 1.36\Rules</SPAN></DIV></LI>
<LI>
<DIV class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Arial','sans-serif'">Launch FxCop and the rule is "AntiforgeryToken used" under "ASP.NET MVC Security" group.</SPAN><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Arial','sans-serif'"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p><FONT size=3></DIV></LI></OL></FONT></o:p></SPAN>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/29/07/14/MVCAntiforgeryTokenChecker.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-29-07-14/MVCAntiforgeryTokenChecker.zip">MVCAntiforgeryTokenChecker.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Checking for ViewStateUserKey using FxCop</title>
      <link>https://docs.microsoft.com/archive/blogs/sfaust/checking-for-viewstateuserkey-using-fxcop</link>
      <pubDate>Thu, 25 Sep 2008 16:31:00 GMT</pubDate>
      <dc:creator><![CDATA[TheFaust]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sfaust/2008/09/25/checking-for-viewstateuserkey-using-fxcop/</guid>
      <description><![CDATA[ASP.NET has had a mitigation to prevent against&nbsp;CSRF/One-Click attacks since 1.1 with the use...]]></description>
      <content:encoded><![CDATA[<P>ASP.NET has had a mitigation to prevent against&nbsp;CSRF/One-Click attacks since 1.1 with the use of <A class="" href="https://msdn.microsoft.com/en-us/library/system.web.ui.page.viewstateuserkey.aspx" target=_blank mce_href="https://msdn.microsoft.com/en-us/library/system.web.ui.page.viewstateuserkey.aspx">Page.ViewStateUserKey</A> property. I've implemented a basic FXCop rule to verify if this property is used on each page. The rule is basic so it doesn't look at what is assigned to the property and only looks if something is assigned to it. The ViewStateUserKey property is not full proof. If you are not using viewstate on the page it doesn't help much. You can also review this <A class="" href="https://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx" target=_blank mce_href="https://keepitlocked.net/archive/2008/05/29/viewstateuserkey-doesn-t-prevent-cross-site-request-forgery.aspx">post</A> regarding limitation of the ViewStateUserKey. I strongly recommend that you include this rule when running fxcop or code analysis in visual studio on web projects.</P>
<P><U><STRONG>Installation</STRONG></U></P>
<OL>
<LI>&nbsp;Unzip and select the appropriate rule for the fxcop release you are using</LI>
<UL>
<LI>For Visual Studio Team System 2005 select the fxcop 1.35 version and place it in&nbsp;<EM>C:\Program Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\Rules</EM></LI>
<LI>For Visual Studio Team System 2008 select the fxcop 1.36 version and place it in <EM>C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Static Analysis Tools\FxCop\Rules</EM></LI></UL>
<LI>The rule can be enabled under the "ASP.NET Security" section and it's called "ViewStateUserKey used"</LI></OL>
<P><U><STRONG>Update</STRONG></U></P>
<P>I've been working with projects using <A class="" title="ASP.NET MVC" href="https://www.asp.net/mvc/" target=_blank mce_href="https://www.asp.net/mvc/">ASP.NET MVC</A>&nbsp;and made some update to the rule to ignore classes inheriting from ViewPage since MVC doesn't use ViewState.</P>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/08/96/55/85/ViewStateUserKey-1.2.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-08-96-55-85/ViewStateUserKey_2D00_1.2.zip">ViewStateUserKey-1.2.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Fxcop HtmlSpotter - Spotting ASP.NET XSS using Fxcop and Html encoding document</title>
      <link>https://docs.microsoft.com/archive/blogs/sfaust/fxcop-htmlspotter-spotting-asp-net-xss-using-fxcop-and-html-encoding-document</link>
      <pubDate>Thu, 18 Sep 2008 16:30:00 GMT</pubDate>
      <dc:creator><![CDATA[TheFaust]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sfaust/2008/09/18/fxcop-htmlspotter-spotting-asp-net-xss-using-fxcop-and-html-encoding-document/</guid>
      <description><![CDATA[In my previous post, I provided a list of which ASP.NET HTML control property that offers automatic...]]></description>
      <content:encoded><![CDATA[<P>In my previous <A class="" href="https://blogs.msdn.com/sfaust/archive/2008/09/02/which-asp-net-controls-automatically-encodes.aspx" target=_blank mce_href="https://blogs.msdn.com:443/sfaust/archive/2008/09/02/which-asp-net-controls-automatically-encodes.aspx">post</A>, I provided a list of which ASP.NET HTML control property that offers automatic HTML encoding. As a side note, I was&nbsp;made aware that an older version of that file is available from&nbsp;the support files of the <A class="" href="https://www.microsoft.com/mspress/companion/0-7356-2187-X/" mce_href="https://www.microsoft.com/mspress/companion/0-7356-2187-X/">Hunting Security Bugs</A> book. I initially received this document from Tom Gallagher team and made some updates regarding BaseValidator and child classes ErrorMessage property so the version I posted is more up to date. I'll remind the book authors to update the file on their side.</P>
<P>The document was targeted to ASP.NET 2.0 developers who were interested to know which control doesn't offer encoding to mitigate against <A class="" href="https://en.wikipedia.org/wiki/Cross-site_scripting" mce_href="https://en.wikipedia.org/wiki/Cross-site_scripting">XSS</A> problems. The document is also very useful during code review and I've decided to quickly plug it into <A class="" href="https://msdn.microsoft.com/en-us/library/bb429476(VS.80).aspx" mce_href="https://msdn.microsoft.com/en-us/library/bb429476(VS.80).aspx">FxCop</A> so it can quickly spot areas that should be reviewed.</P>
<P>The rule will load the control encoding information stored in asp_controls.xml and will apply the following logic:</P>
<UL>
<LI>If properties that don't offer encoding are used, it will be listed in the FxCop result</LI>
<LI>If it finds a property that offers encoding but that property is bound to html attribute, it will spot it to make sure that users cannot inject things like javascript: or other handlers</LI>
<UL>
<LI>In the future, it will only show cases where the attribute can be executed. I'm currently looking to potentially integrate the rule with the <A class="" href="https://www.webappsec.org/projects/scriptmapping/" target=_blank mce_href="https://www.webappsec.org/projects/scriptmapping/">script mapping project</A> from <A class="" href="https://www.webappsec.org/" target=_blank mce_href="https://www.webappsec.org/">WASC</A>.</LI></UL></UL>
<P>This will give a detailed list of items to review. The aim is not to automatically detect XSS but to identify spots in the code that should be reviewed.</P>
<P><U>Installation</U></P>
<OL>
<LI>Simply unzip the files and put them in the FxCop Rules folder (C:\Program Files\Microsoft FxCop 1.36\Rules)</LI>
<LI>Launch FxCop</LI>
<LI>The rule can be selected from the Rules tab under the&nbsp;<STRONG>Html Review</STRONG> section</LI></OL>
<BLOCKQUOTE>
<P mce_keep="true">&nbsp;</P></BLOCKQUOTE>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/08/95/78/38/HtmlControlSpotter.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-08-95-78-38/HtmlControlSpotter.zip">HtmlControlSpotter.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Which ASP.NET Controls Automatically Encodes?</title>
      <link>https://docs.microsoft.com/archive/blogs/sfaust/which-asp-net-controls-automatically-encodes</link>
      <pubDate>Tue, 02 Sep 2008 01:20:00 GMT</pubDate>
      <dc:creator><![CDATA[TheFaust]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sfaust/2008/09/02/which-asp-net-controls-automatically-encodes/</guid>
      <description><![CDATA[I've had a lot of people ask me which ASP.NET control offers automatic html encoding and the answer...]]></description>
      <content:encoded><![CDATA[<P>I've had a lot of people ask me which ASP.NET control offers automatic html encoding and the answer I had for a long time was to look at MSDN or even write a quick sample and test the behavior. If you are asking yourself the same question, you can now use the attached document to see if the control if offering the appropriate encoding. The document list all asp.net control and which property offers html, script or url encoding. You can also see which html attribute the property is bound to. This document is quite useful when you are reviewing your code for possible Cross-Site Scripting (XSS) or double encoding problems.</P>
<P><U>Side note</U></P>
<P>I was made aware that the initial content was provided as part of the companion content for the excellent book Hunting for Security bugs available at <A href="https://www.microsoft.com/mspress/companion/0-7356-2187-X/" rel=nofollow target=_new><FONT color=#0065e2>https://www.microsoft.com/mspress/companion/0-7356-2187-X/</FONT></A>. The file attached to this is indeed base on the same content since I received it internally by the author's team. I found some slight issues and made some changes. I recommend the file I provide until the book companio content gets updated.</P>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/08/91/89/96/asp.net_control_encoding.htm" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-08-91-89-96/asp.net_5F00_control_5F00_encoding.htm">asp.net_control_encoding.htm</a></p>]]></content:encoded>
    </item>
  </channel>
</rss>