修复中危web项目漏洞(目标URL启用了不安全的HTTP方法)
漏洞名 :目标URL启用了不安全的HTTP方法
等级: 中危
漏洞位置: PUT DELETE
描述: Web服务器配置为允许使用危险的HTTP方法,如PUT、MOVE、COPY、DELETE、PROPFIND、SEARCH、MKCOL、LOCK、UNLOCK、PROPPATCH,该配置可能允许未授权的用户对Web服务器进行敏感操作。
修复建议:如果服务器不需要支持WebDAV请禁用WebDAV,或禁用掉不安全的HTTP方法
修复方法:在项目的web.xml配置中,增加如下代码:
<security-constraint><web-resource-collection><web-resource-name>Kosn2</web-resource-name><url-pattern>/*</url-pattern><http-method>PUT</http-method><http-method>DELETE</http-method><http-method>HEAD</http-method><http-method>OPTIONS</http-method><http-method>TRACE</http-method><http-method>PATCH</http-method></web-resource-collection><auth-constraint></auth-constraint></security-constraint>