我在一个漏洞检查器上审核了我的网站,它建议我需要添加安全标题;
缺少XSS保护的安全头。 缺少安全头以防止内容类型嗅探。 缺少严格-传输-安全标题。 泄露PHP版本。您的站点正在https://www.mywebsite.com/blog/上的headers中显示PHP版本。请把expose_php =关了。
我访问了htaccess文件,并尝试添加本站推荐的一些头文件,下面是我尝试过的内容:
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]除了我的/blog子域之外,上面的所有内容都能工作,它恰好是托管在CMS上的。
当我在下面添加标题时,我的站点立即停止工作。
Strict-Transport-Security: max-age= Strict-Transport-Security: max-age=;
includeSubDomains Strict-Transport-Security: max-age=; preload我完全没有这方面的经验,并希望消除所有的漏洞,审计网站发现。
发布于 2018-11-06 11:07:43
我把这个代码添加到我的htaccess文件中,然后重新扫描网站,问题就解决了。
<IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block" //help protect against XSS
Header always append X-Frame-Options SAMEORIGIN //help protect against page-framing and clickjacking
Header set X-Content-Type-Options nosniff //help protect against content-sniffin
Header add Strict-Transport-Security "max-age=31415926;includeSubDomains;"//I believe this adds https before the domain on all pages.
</IfModule>
<IfModule mod_php5.c>
php_flag expose_php off //This stop divulging the php version
</IfModule>关于更简洁的细节,请访问这里。
发布于 2018-11-07 12:14:41
只需将其添加到头站点:
缺少用于XSS保护的安全头:X-XSS-保护: 1;mode=block
缺少安全头以防止内容类型嗅探:X内容-类型选项: nosniff
缺失严格-传输-安全头:最大年龄=31536000;包含子域;预加载
重新扫描/重测,漏洞将被修复。
一些令人感兴趣的网站给你提供了一个美好而深刻的视角,从你的网站:
https://stackoverflow.com/questions/53153293
复制相似问题