【问题标题】:aspxerrorpath=/ in url causes custom error page to not workurl 中的 aspxerrorpath=/ 导致自定义错误页面不起作用
【发布时间】:2013-04-11 21:45:28
【问题描述】:

我正在尝试使网站符合 pci。

如果您访问(虚拟 ip): http:someipaddress/ZNYTMHXO.ashx

然后用户正确地看到我在我的网络配置中声明的页面中的 html:

但是,如果您使用相同的 url,但在查询字符串中使用 ?aspxerrorpath=/: http:someipaddress/ZNYTMHXO.ashx?aspxerrorpath=/

然后页面显示“/”应用程序中的服务器错误。运行时错误。

pci 扫描失败。

为什么这个变量会导致问题?

对不起,我应该声明 ZNYTMHXO.ashx 不存在。当 asperrorpath 不在查询字符串中时,404 重定向有效。

-----更新----- 只是为了帮助,这是显示页面的 html,非常有限。

<!DOCTYPE html>
<html>
    <head>
        <title>Runtime Error</title>
        <meta name="viewport" content="width=device-width" />
        <style>
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
         @media screen and (max-width: 639px) {
          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
         }
         @media screen and (max-width: 479px) {
          pre { width: 280px; }
         }
        </style>
    </head>

    <body bgcolor="white">

            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

            <h2> <i>Runtime Error</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> Description: </b>An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated.
            <br><br>

    </body>
</html>

【问题讨论】:

  • Server Error in '/' Application 消息中应该有其他信息——也许是Description 和/或Compiler Error MessageSource Error
  • 刚刚把html加到上面...
  • 了解错误页面输出的关键在于Description。它说“处理您的请求时发生异常。此外,在执行第一个异常的自定义错误页面时发生另一个异常。请求已终止。”当您的错误处理本身在处理另一个错误时发生错误时,就会发生这种不太有趣的情况。不过,请查看我发布的答案——我认为您可以在这里找到通过 PCI 合规性测试所需进行的纠正。

标签: asp.net custom-error-pages


【解决方案1】:

ScottGuthrie http://weblogs.asp.net/scottgu/archive/2010/09/24/update-on-asp-net-vulnerability.aspx 的以下博客文章应该会有所帮助。

他描述了如何使用 IIS Url Scan 模块:

不允许具有“aspxerrorpath=”查询字符串属性的 URL 从进入 ASP.NET 应用程序,反而会导致 Web 服务器返回 HTTP 错误。添加此规则可防止 攻击者无法区分不同类型的错误 发生在服务器上 - 这有助于阻止使用此攻击的攻击 漏洞。

他写的是一个据报道已修补的漏洞。然而,有些人报告说直到 .Net 4.0 仍然存在问题(此处提到:Why does the ASP.NET error page return 404 as soon as the aspxerrorpath querystring is present?

您的 PCI 扫描可能正试图利用相同的漏洞。消除漏洞,您应该可以通过。

希望对您有所帮助。

【讨论】:

    猜你喜欢
    • 2011-06-11
    • 1970-01-01
    • 2013-03-06
    • 2012-07-24
    • 2014-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多