我的公司正在使用 Tenable 来识别安全漏洞。最近发现了丢失的 HSTS。我们的服务器使用的是 IIS 10。
我已经添加了多个博客中概述的 HSTS 标头,以及此处的问题。
我的根 web.config 看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="Environment" value="Local" />
</appSettings>
<system.webServer>
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect global" stopProcessing="true" >
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}"
redirectType="Permanent" />
</rule>
</rules>
<outboundRules>
<rule name="Add Strict-Transport-Security when HTTPS" enabled="true">
<match serverVariable="RESPONSE_Strict_Transport_Security"
pattern=".*" />
<conditions>
<add input="{HTTPS}" pattern="on" ignoreCase="true" />
</conditions>
<action type="Rewrite" value="max-age=31536000; includeSubDomains; preload" />
</rule>
</outboundRules>
</rewrite>
</system.webServer>
</configuration>
问题:应用更改后,Tenable 仍然显示漏洞。此外,在 FireFox 的开发工具中检查站点时,我可以看到标头存在,但安全选项卡表明 HSTS 已禁用。
问题:如何让 Firefox 和 Tenable 显示此更改?
@rogerdeuce,您好,我在 apache 中面临同样的问题,标头存在,但在安全选项卡中 hsts 被禁用,并且 Tenable 扫描显示缺少 HSTS 标头。你解决了吗。谢谢你。
它也可能与您在 HSTS 标头中提到的预加载标签有关。您确定您的网站已添加到预加载列表中(由 google/chrome 维护)
如果您将站点部署为子域,那么您可能还需要将 HSTS 添加到父域(不是子域)并提交进行预加载。
完成后,您可以在 https://hstspreload.org/
验证并查找更多详细信息