解決安全掃描Insecure HTTP Methods Enabled的問題

來源:互聯網
上載者:User

今天把Spring MVC的Java網站部署到CentOS上,並且設定了https/ssl 8443連接埠,然後用IBM Rational AppScan進行安全掃描,發現一個漏洞:Insecure HTTP Methods Enabled. 原因是Tomcat支援的http命令中包含DELETE、OPTIONS、PUT、HEAD和TRACE這五條命令。

 

 漏洞描述和建議:

Insecure HTTP Methods Enabled

Severity:  Medium
Type: Infrastructure test
WASC Threat Classification: Client-side Attacks: Content Spoofing
CVE Reference(s): N/A
Security Risk: It is possible to upload, modify or delete web pages, scripts and files on the web server

Fix Recommendation
If you do not need WebDAV enabled on your server, make sure that you either disable it, or disallow HTTP methods (verbs) that are unneeded.

 

解決辦法

參考了這個文章,但小題大做了,只需修改網站的web.xml添加下面的內容即可。

<security-constraint>
     <web-resource-collection>
          <web-resource-name>DisableUnsecureHttpActions</web-resource-name>
          <url-pattern>/*</url-pattern>
          <http-method>DELETE</http-method>
          <http-method>PUT</http-method>
          <http-method>HEAD</http-method>
          <http-method>TRACE</http-method>
          <http-method>OPTIONS</http-method>
     </web-resource-collection>
     <auth-constraint>
        <role-name>NotExistingRole</role-name>
     </auth-constraint>
     <user-data-constraint>
        <transport-guarantee>NONE</transport-guarantee>
     </user-data-constraint>
 </security-constraint>

有關Security-constraint的理解,可以參考這個文章。

作者的其它相關文章
  • Spring MVC防禦CSRF、XSS和SQL注入攻擊
  • Tomcat的SessionID引起的Session Fixation和Session Hijacking問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.