- CVE-2003-1567 主機支持TRACE和/或TRACK方法。 TRACE和TRACK是HTTP用來調試web服務器鏈接的方法。
- 加固建議 禁用TRACE / TRAC方法,參考以下:
- IIS下:IIS信息服務-web服務擴展:禁止"WebDAV;
- apache下:修改httpd.conf配置文件中"TraceEnable on"爲"TraceEnable off"
- springboot
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() {// 1
protected void postProcessContext(Context context) {
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/*");
collection.addMethod("HEAD");
collection.addMethod("PUT");
collection.addMethod("DELETE");
collection.addMethod("OPTIONS");
collection.addMethod("TRACE");
collection.addMethod("COPY");
collection.addMethod("SEARCH");
collection.addMethod("PROPFIND");
securityConstraint.addCollection(collection);
context.addConstraint(securityConstraint);
}
};
//若是須要禁用TRACE請求,需添加如下代碼:
tomcat.addConnectorCustomizers(connector -> {
connector.setAllowTrace(true);
});
return tomcat;
}