我在apache / conf / httpd.conf文件中添加了以下几行来解决 XSS跨站点脚本漏洞。
1)
<IfModule mod_headers.c>
# (1) (2)
Header set X-XSS-Protection "1; mode=block"
# `mod_headers` cannot match based on the content-type, however,
# the `X-XSS-Protection` response header should be sent only for
# HTML documents and not for the other resources.
<FilesMatch "\.(%FilesMatchPattern%)$">
Header unset X-XSS-Protection
</FilesMatch>
</IfModule>
2 ) header always set x-xss-protection "1; mode=block"
3) <IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
</IfModule>
使用以下命令重新启动apache服务器
httpd -k重新启动
但是他们都没有成功,但IBM BAVA安全扫描仍显示(跨站点脚本)是POSITIVE,并且Web服务器漏洞仍然存在。
答案 0 :(得分:0)
X-XSS-protection标头的添加是一项通知您使用客户端浏览器的功能。另外,除非您的浏览器支持,否则它根本不起作用。 这无助于解决服务器端的XSS漏洞。
请参阅this。