Jos*_*ger 10 asp.net security iis fortify
是否足以将[ System.Web.Configuration.HttpRuntimeSection.EnableHeaderChecking](http://msdn.microsoft.com/en-us/library/system.web.configuration.httpruntimesection.enableheaderchecking ( VS.85).aspx)设置为true(默认)以完全阻止Http标题注入攻击像响应拆分等?
我问,因为白盒渗透测试工具(强化)报告可利用的http头注入问题HttpResponse.Redirect和cookie但我还没有找到成功执行攻击的方法.(编辑:..我们已启用EnableHeaderChecking ..)
我一直在寻找这一段时间,得出结论,设置EnableHeaderChecking到true其实不够好,以防止HTTP头注入攻击.
看看'反映'的ASP.NET代码,我发现:
HttpResponseHeader(内部)实例HttpResponseHeader.MaybeEncodeHeader(for IIS7WorkerRequests)HttpResponseHeader在发送RedirectLocation或ContentType等已知标头之前创建实例(HttpResponse.GenerateResponseHeaders)HttpResponseHeader构造检查EnableheaderChecking设置和调用HttpResponseHeader.MaybeEncodeHeader时设置为trueHttpResponseHeader.MaybeEncodeHeader 正确编码换行符,这使得无法进行HTTP头注入攻击这是一个大致演示我如何测试的片段:
// simple http response splitting attack
Response.AddHeader("foo", "bar\n" +
// injected http response, bad if user provided
"HTTP/1.1 200 OK\n" +
"Content-Length: 19\n" +
"Content-Type: text/html\n\n" +
"<html>danger</html>"
);
Run Code Online (Sandbox Code Playgroud)
以上仅在明确关闭EnableHeaderChecking时才有效:
<httpRuntime enableHeaderChecking="false"/>Run Code Online (Sandbox Code Playgroud)
Fortify不会考虑配置(设置EnableHeaderChecking显然没有效果),因此总是报告这些类型的问题.