-
如何禁用Spring Boot内置Undertow的HTTP TRACE/TRACK
2020-09-11 19:29:57文章目录如何禁用Spring Boot内置Undertow的HTTP TRACE/TRACK前言测试应用是否允许HTTP TRACE禁用Spring Boot内置的Undertow的HTTP TRACE/TRACK参考文档 如何禁用Spring Boot内置Undertow的HTTP TRACE/TRACK 前言 ...文章目录
如何禁用Spring Boot内置Undertow的HTTP TRACE/TRACK
前言
因为安全原因,需要禁用Spring Boot内置Web服务器的HTTP TRACE/TRACK方法。
- Spring Boot版本:
spring-boot:2.2.2.RELEASE
- 内置Web服务器:Undertow
测试应用是否允许HTTP TRACE
curl -v -X TRACE http://<ip>:<port>
如果应用允许HTTP TRACE,响应信息为
200 OK
。如果应用不允许HTTP TRACE,响应信息为
405 Method Not Allowed
。禁用Spring Boot内置的Undertow的HTTP TRACE/TRACK
在
autoconfigure
包下,创建一个配置类UndertowWebServerCustomizerConfig
,禁用HTTP TRACE/TRACK方法。示例代码:
package com.example.demo.autoconfigure; import io.undertow.server.HandlerWrapper; import io.undertow.server.HttpHandler; import io.undertow.server.handlers.DisallowedMethodsHandler; import io.undertow.util.HttpString; import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory; import org.springframework.boot.web.server.WebServerFactoryCustomizer; import org.springframework.context.annotation.Configuration; @Configuration public class UndertowWebServerCustomizerConfig implements WebServerFactoryCustomizer<UndertowServletWebServerFactory> { @Override public void customize(UndertowServletWebServerFactory factory) { factory.addDeploymentInfoCustomizers(deploymentInfo -> { deploymentInfo.addInitialHandlerChainWrapper(new HandlerWrapper() { @Override public HttpHandler wrap(HttpHandler handler) { HttpString[] disallowedHttpMethods = {HttpString.tryFromString("TRACE"), HttpString.tryFromString("TRACK")}; return new DisallowedMethodsHandler(handler, disallowedHttpMethods); } }); }); } }
在
resources/META-INF/spring.factories
中设置自动配置类。org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ com.example.demo.autoconfigure.UndertowWebServerCustomizerConfig
关于Spring Boot
autoconfigure
参见:如果使用
@Component
注解,而不是autoconfigure
的做法,需要确保Spring Boot Application启动时Component Scan会包含该类所在的包路径,否则设置不会生效。参考文档
- Spring Boot版本:
-
服务器禁用TRACE和TRACK方法
2020-05-08 10:01:09http://wenku.baidu.com/view/557d761ea8114431b90dd873.html ...http://www.myhack58.com/Article/html/3/62/2012/32870.htm (http TRACE 跨站攻击漏洞测试与防御修复)...http://wenku.baidu.com/view/557d761ea8114431b90dd873.html
http://wenku.baidu.com/view/de1f4ad2195f312b3169a50d.html
http://www.myhack58.com/Article/html/3/62/2012/32870.htm (http TRACE 跨站攻击漏洞测试与防御修复)
http://blog.csdn.net/chamtianjiao/article/details/6268746
linux具体操作如下: 找到服务器配置文件
/etc/httpd/conf/httpd.conf
在文件最后一行加上 TraceEnable off
如果不行的话在 vhost.conf 也加上以上的指令,重启apache
/etc/init.d/httpd restart
或是在httpd.conf里面每一个visual host里面加以下的module(RrwriteEngine需要compiler)
RewriteEngine on RewriteCond %{REQUEST_METHOD}^(TRACE|TRACK) RewriteRule .* – [F]
这一点比较复杂visual host都加上…重启
/etc/init.d/httpd restart 稍后生效
如果一台 web Server 支持 Trace 和 / 或 Track 方式,那么它一定存在跨站脚本漏洞,将有可能受到跨站攻击。Trace 和 Track 是用来调试 Web 服务器连接的 HTTP 方式。
我们通常在描述各种浏览器缺陷的时候,把“Cross-Site-Tracing”(跨站攻击)简称为XST。
攻击者可以利用此漏洞欺骗合法用户并得到他们的私人信息。
解决方案:禁用 Trace 和 / 或 Track 方式。
针对 Apache,可以借助 mod_rewrite 模块来禁止 HTTP Trace请求。只要在各虚拟主机的配置文件里添加如下语句:
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]补充其他 Web Server 的解决方案:
1、Microsoft IIS
使用 URLScan 工具禁用 HTTP Trace 请求,或者只开放满足站点需求和策略的方式。
2、Sun ONE Web Server releases 6.0 SP2 或者更高的版本:
在 obj.conf 文件的默认 object section 里添加下面的语句:
AuthTrans fn=“set-variable”
remove-headers=“transfer-encoding”
set-headers=“content-length: -1”
error=“501”3、Sun ONE Web Server releases 6.0 SP2 或者更低的版本:
编译如下地址的 NSAPI 插件:
http://sunsolve.sun.com/pub-cgi/retrieve.pl?doc=fsalert/50603更多信息可以查看以下资料:
http://www.whitehatsec.com/press_releases/WH-PR-20030120.pdf
http://archives.neohapsis.com/ar …h/2003-q1/0035.html
http://sunsolve.sun.com/pub-cgi/retrieve.pl?doc=fsalert/50603
http://www.kb.cert.org/vuls/id/867593
禁用 Domino HTTP 服务器的 Trace 方法
在最近客户提交的一份 安全 检查报告中,有一条是检测到 Domino HTTP 服务器启用了 Trace方法,可能存在安全漏洞。虽然在 IBM 技术 支持文档中宣称此处不存在安全漏洞,但也提供了禁用它的方法:
使用了 Internet 站点配置:在站点配置文档的配置标签页中,禁止 Trace 方法
未使用 Internet 站点配置:在 Notes.ini 中加入一行HTTPDisableMethods=TRACE -
apache 禁止trace或track防止xss攻击
2017-11-12 18:39:00TRACE和TRACK是用来调试web服务器连接的HTTP方式。支持该方式的服务器存在跨站脚本漏洞,通常在描述各种浏览器缺陷的时候,把"Cross-Site-Tracing"简称为XST。攻击者可以利用此漏洞欺骗合法用户并得到他们的私人信息...TRACE和TRACK是用来调试web服务器连接的HTTP方式。
支持该方式的服务器存在跨站脚本漏洞,通常在描述各种浏览器缺陷的时候,把"Cross-Site-Tracing"简称为XST。
攻击者可以利用此漏洞欺骗合法用户并得到他们的私人信息。
禁用trace可以使用rewrite功能来实现
RewriteEngine On
RewriteCondi %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
或者还可以直接在apache的配置文件中配置相应参数TraceEnable off
本文转自 小杨_Ivan 51CTO博客,原文链接:http://blog.51cto.com/aqiang/1895873
-
apache 禁用TRACE / TRACK方法,及测试过程
2020-09-29 16:16:59apache 禁用TRACE / TRACK方法禁用方法本地测试过程课程分享: 禁用方法 在httpd.conf 中增加一行“TraceEnable off” 本地测试过程 通过telnet到HTTP的某个服务端口,进行测试,如下描述 (红色为需要输入的部分)。 ...禁用方法
在httpd.conf 中增加一行“TraceEnable off”
本地测试过程
通过telnet到HTTP的某个服务端口,进行测试,如下描述 (红色为需要输入的部分)。
关闭前测试会返回200 OK:[root@web001 ~]$ telnet xxx.xxx.xxx.xxx 80 Trying xxx.xxx.xxx.xxx... Connected to xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx). Escape character is '^]'. TRACE / HTTP/1.0 X-Test:abcde HTTP/1.1 200 OK Date: Wed, 18 Jul 2012 06:49:19 GMT Server: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_jk/1.2.28 Connection: close Content-Type: message/http TRACE / HTTP/1.0 X-Test: abcde Connection closed by foreign host.
关闭后测试会返回405 Method Not Allowed:
[root@web001 ~]$ telnet xxx.xxx.xxx.xxx 80 Trying xxx.xxx.xxx.xxx... Connected to xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx). Escape character is '^]'. TRACE / HTTP/1.0 X-Test:abcde HTTP/1.1 405 Method Not Allowed Date: Wed, 18 Jul 2012 06:50:05 GMT Server: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_jk/1.2.28 Allow: Content-Length: 223 Connection: close Content-Type: text/html; charset=iso-8859-1 X-Pad: avoid browser bug <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>405 Method Not Allowed</title> </head><body> <h1>Method Not Allowed</h1> <p>The requested method TRACE is not allowed for the URL /.</p> </body></html> Connection closed by foreign host.
课程分享:
安利一门Python超级好课!
扫码下单输优惠码【csdnfxzs】再减5元,比官网还便宜!
https://marketing.csdn.net/poster/109?utm_source=NEWFXDT -
apache 禁止trace或track防止xss***
2017-02-07 21:44:41TRACE和TRACK是用来调试web服务器连接的HTTP方式。支持该方式的服务器存在跨站脚本漏洞,通常在描述各种浏览器缺陷的时候,把"Cross-Site-Tracing"简称为XST。***者可以利用此漏洞欺骗合法用户并得到他们的私人信息... -
Track & Trace
2009-01-07 17:43:00但在我們實際的開發中,發現有很少的開發人員養成在代碼里寫Debug和Trace語句的。這表明這些程序員缺乏基本功的培訓。 事實上,當在開發web component的時候,用logging的方式可以很快找到程序的bug所在,甚至更好... -
關閉Apache上的Trace / Track 漏洞
2012-05-11 10:11:31關閉Apache上的Trace / Track 漏洞 作者:yoshie 日期:2009-12-11 字體大小: 小 中 大 剛剛跟法蘭克硬try 阿帕契漏洞 結果..終於結束了啊..原來是Nessus耍我們,真的是太雪特了啦... 要關閉Apache 上的 ... -
apache禁止trace或track防止xss***
2016-08-13 09:49:12TRACE和TRACK是用来调试web服务器连接的HTTP方式。 支持该方式的服务器存在跨站脚本漏洞,通常在描述各种浏览器缺陷的时候,把"Cross-Site-Tracing"简称为XST。 ***者可以利用此漏洞欺骗合法用户并得到他们的私人... -
Track and Trace Protocol for SDK
2020-12-08 22:03:57<div><p>Adds track and trace protobuf definition that are compatible with Pike and Schema, as well as their corresponding native objects</p><p>该提问来源于开源项目:hyperledger/grid</p></div> -
HTTP TRACE / TRACK Methods Allowed 漏洞修复
2019-11-26 14:38:40在httpd.conf添加 TraceEnable off 1 -
How to disable TRACK/TRACE as a vulnerability
2020-12-09 10:37:17The remote webserver supports the TRACE and/or TRACK methods. TRACE and TRACK are HTTP methods which are used to debug web server connections.</p> <p>In addition, it has been shown that servers ... -
启用了TRACE 和TRACK HTTP 方法,如何禁用?
2018-01-30 10:56:13http://wenku.baidu.com/view/557d761ea8114431b90dd873.html ... http://www.myhack58.com/Article/html/3/62/2012/32870.htm (http TRACE 跨站攻击漏洞测试 -
Track & Trace Variable for e-mail tremplate
2020-12-30 14:39:50<div><p>Think an important change that needs to happen quite fast, is actually adding Track and Trace variable for the e-mail templates where it could be used and would make sence, so we can actually ... -
WEB安全防御总结二 : 不安全方法( Trace/Track/Options/...)
2019-09-08 18:26:58漏洞简介: 攻击者可以使用OPTIONS和Trace方法来枚举...禁止 Trace|Track|OPTIONS等方法。 作者做了几个地方的修改,现在一个一个列出来: 1. 修改.htaccess文件 在文件中添加代码如下: <IfModule mo... -
Efficiency and Privacy Enhancement for a Track and Trace System of RFID-based Supply Chains
2021-02-10 19:00:47Efficiency and Privacy Enhancement for a Track and Trace System of RFID-based Supply Chains -
[1]禁用TRACE或TRACK方法,IIS可使用URLScan禁用
2016-08-19 14:09:00下载http://www.iis.net/downloads/microsoft/urlscan http://blog.csdn.net/leejin_521/article/details/42772589 http://www.cnblogs.com/stragon/archive/2014/04/25/3689899.html 转载于:... -
启用了TRACE 和TRACK HTTP 方法,如何禁用?(转)
2014-04-29 14:37:00Server 支持 Trace 和 / 或 Track 方式,那么它一定存在跨站脚本漏洞,将有可能受到跨站攻击。Trace 和 Track 是用来调试 Web 服务器连接的 HTTP 方式。 我们通常在描述各种浏览器缺陷的时候,把“Cross-Site-... -
Custom Icons appearing invisible but track trace is there.
2020-12-26 20:54:29<div><p>I am trying to add custom Icons for certain planes but when doing so the icon does not appear. I followed the same format as the default icons tar1090 provides but nothing seems to work. ...