Search code examples
asp.net.netiishttpwebrequesthttpmodule

Validate request before Application_BeginRequest?


I trying to perform aditional validation before application start reading the input of the request, to end suspicious request, based on headers and form data or something like that.

Is there it possible?

[Update]

I'm focusing in prevent a zero day vunerability that occurs before BeginRequest and ins't catch by ASP .net validation.

If I could control the creation of the HttpWebRequest object I could detect this attack.

[Solution]

It can be solved using a native module.

Information about a creating a native module can be found here (using C++): http://learn.iis.net/page.aspx/169/develop-a-native-cc-module-for-iis/

The zero day vulnerability I was talking is described in this blog post: http://blogs.technet.com/b/srd/archive/2011/12/27/more-information-about-the-december-2011-asp-net-vulnerability.aspx

I made a fix for it (is a pre release, not suitable for production) and can be found on GitHub: https://github.com/ginx/HashCollisionDetector

Thanks for all the help.


Solution

  • It can be solved using a native module.

    Native module are executed before any ASP .net validation.

    Information about a creating a native module can be found here (using C++): http://learn.iis.net/page.aspx/169/develop-a-native-cc-module-for-iis/