在Application_BeginRequest之前验证请求?
我尝试在应用程序开始读取请求的输入之前执行额外的验证,以根据标头和表单数据或类似的内容结束可疑的请求。
有可能吗?
[更新]
我的重点是防止在 BeginRequest 之前发生的零日漏洞,并且 ASP .net 验证无法捕获。
如果我可以控制 HttpWebRequest 对象的创建,我就可以检测到这种攻击。
[解决方案]
可以使用原生模块来解决。
有关创建本机模块的信息可以在此处找到(使用 C++): http://learn.iis。 net/page.aspx/169/develop-a-native-cc-module-for-iis/
我正在谈论的零日漏洞在这篇博客文章中进行了描述: http://blogs.technet.com/b/srd/archive/2011/12/27/more-information-about-the-december-2011-asp-net-vulnerability.aspx
我对其进行了修复(是预发行版,不适合生产),可以在 GitHub 上找到:https://github.com/ginx/HashCollisionDetector
感谢您的所有帮助。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
BeginRequest
是 IIS 请求处理管道中的第一个事件。在该事件之前发生的唯一预请求操作是创建
HttpContext
、HttpRequest
和HttpResponse
类的实例。某些注册的
HttpModules
(包括 Global.asax)中的BeginRequest
事件也会先于其他事件运行。但是,ASP.NET 不保证排序。BeginRequest
is the first event in the IIS request-processing pipeline.The only pre-request actions that happen before that event are the creation of instances the
HttpContext
,HttpRequest
andHttpResponse
classes.It's also the case that the
BeginRequest
event in some registeredHttpModules
(including Global.asax) will run before others. However, ASP.NET makes no guarantees with regard to ordering.您可以通过设置页面 validateRequest="true" 在您的 web.config 中。
否则,您可以尝试替换 IIS 管道中的一些标准模块(除非您有大量时间,否则不建议这样做)。
以下是一些非常好的资源:
IIS 7.0 的 ASP.NET 应用程序生命周期概述
IIS 7 模块概述
自定义 IIS 7.0 角色和模块
You can ask HttpApplication to do this for you by setting pages validateRequest="true" in your web.config.
Otherwise, you can attempt to replace some of the standard modules in the IIS pipeline (not recommended unless you have a lot of time on your hands).
Here are some very good resources:
ASP.NET Application Life Cycle Overview for IIS 7.0
IIS 7 Modules Overview
Customizing IIS 7.0 Roles and Modules
可以使用本机模块来解决。
本机模块在任何 ASP .net 验证之前执行。
有关创建本机模块的信息可以在此处找到(使用 C++):http://learn.iis.net/page.aspx/169/develop-a-native-cc-module-for-iis/
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/