
上QQ阅读APP看书,第一时间看更新
1.18 实验#18:testfire网站出错导致应用程序细节泄露
缺陷标题 testfire网站出错导致应用程序细节泄露。
测试平台与浏览器 Windows 7+Chrome或Firefox。
测试步骤
(1)打开testfire网站http://demo.testfire.net。
(2)单击Online Banking with FREE Online Bill Pay链接,如图1-35所示。
(3)单击后进入URL http://demo.testfire.net/default.aspx?content=personal_savings.htm。
期望结果 网页能正常访问。
实际结果 网页出错,透露网站代码细节,如图1-36所示。

图1-35 单击Online Banking with FREE Online Bill Pay链接

图1-36 透露网站代码细节
专家点评
出错网页泄露网站代码细节,为安全攻击者提供了便利。程序发布到服务器供用户使用前,一定要屏蔽掉所有的调试页,给用户一个相对统一的出错页,不暴露代码细节。
web.config中的customErrors
节点用于定义一些自定义错误信息。此节点有Mode和defaultRedirect两个属性,其中defaultRedirect属性表示应用程序发生错误时重定向到的默认URL,Mode属性有On、Off、RemoteOnly 3个值。
customErrors节点在web.config中的位置为configuration→system.web→customerErrors。
customErrors节点常见用法如下。

这样就可以统一定义网页出现500、403、404等错误时跳转到哪个指定页面。