ASP.NET 2.0 dumb's down request validation

Since the early days of ASP.NET there has been a heavy reliance on the request validation performed to mitigate cross-site scripting issues as many of the WebControls do not perform any encoding.  In ASP.NET v1.1 the request validation performed was fairly restrictive.  It looked for tags, expressions, on strings (onClick, etc), javascript:, and "&#".  After reviewing an ASP.NET 2.0 site I found these protections have been simplified to just look for tags and "&#".

This has a number of interesting security impacts as any 1.1 site which relies on these protections as mitigation’s to security issues will find themselves vulnerable once they upgrade.  It would be interesting to know Microsoft’s reasons for removing these checks.  I would assume it caused to many customer issues, perhaps interfered with AJAX in some way.

To recap, asp.net v1.1 performed the following checks:

  1. Look for "&#"
  2. Look for ‘<’ then alphas or ! or / (tags)
  3. Look for "script:"
  4. Look for on handlers (onXXX=)
  5. Look for “expression(“
  6. Skip elements named "__VIEWSTATE"

While asp.net v2.0 and higher performs the following:

  1. Look for &#
  2. Look for ‘<’ then alphas or ! or / (tags)
  3. Skip elements with names prefixed with double underscore (__)

As you can see the 2.0 version is much weaker than 1.1.

Enjoy!

~ by meddington on January 23, 2008.

10 Responses to “ASP.NET 2.0 dumb's down request validation”

  1. [...] Eddington recently posted some interesting information regarding the differences in request validation being used in ASP.NET 1.1 vs. ASP.NET 2.0.  In addition to the information he’s posting, which are good things to know, I think this should [...]

  2. [...] Eddington recently posted some interesting information regarding the differences in request validation being used in ASP.NET 1.1 vs. ASP.NET 2.0.  In addition to the information he’s posting, which are good things to know, I think this should [...]

  3. Well – this really means that Microsoft is putting the security aspects of application development back in the hands of developers. Although this breaks the uniformity principle (the more standardized, the safer) … it’s forcing developers to actually know what they’re doing… sort of.

    Look for more vulns in .Net 2.0 code, coming to a web app near you.

  4. Well – this really means that Microsoft is putting the security aspects of application development back in the hands of developers. Although this breaks the uniformity principle (the more standardized, the safer) … it’s forcing developers to actually know what they’re doing… sort of.

    Look for more vulns in .Net 2.0 code, coming to a web app near you.

  5. [...] caught up with Michael Eddington’s short and sweet analysis of the request validation in ASP.NET 2.0. So far I’ve seen a few people blast it, but I think [...]

  6. [...] caught up with Michael Eddington’s short and sweet analysis of the request validation in ASP.NET 2.0. So far I’ve seen a few people blast it, but I think [...]

  7. [...] phed.org » ASP.NET 2.0 dumb’s down request validation   [...]

  8. [...] phed.org » ASP.NET 2.0 dumb’s down request validation   [...]

  9. please guide to get VB.NET & ASP.NET Dump’s questions & answers

    thank u

  10. please guide to get VB.NET & ASP.NET Dump’s questions & answers

    thank u

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.