For faster navigation, this Iframe is preloading the Wikiwand page for HTTP严格传输安全.

HTTP严格传输安全

HTTP严格传输安全(英语:HTTP Strict Transport Security,缩写:HSTS)是一套由互联网工程任务组发布的互联网安全策略机制。网站可以选择使用HSTS策略,来让浏览器强制使用HTTPS与网站进行通信,以减少会话劫持风险。[1][2]

征求修正意见书文件编号是RFC 6797,发布于2012年11月。

内容

HSTS的作用是强制客户端(如浏览器)使用HTTPS与伺服器建立连接。伺服器开启HSTS的方法是,当客户端通过HTTPS发出请求时,在伺服器返回的超文本传输协议(HTTP)响应头中包含Strict-Transport-Security字段。非加密传输时设置的HSTS字段无效。[3]

比如,https://example.com/ 的响应头含有Strict-Transport-Security: max-age=31536000; includeSubDomains。这意味着两点:

  1. 在接下来的31536000秒(即一年)中,浏览器向example.com或其子域名发送HTTP请求时,必须采用HTTPS来发起连接。比如,用户点击超链接或在地址栏输入 http://www.example.com/ ,浏览器应当自动将 http 转写成 https,然后直接向 https://www.example.com/ 发送请求。
  2. 在接下来的一年中,如果 example.com 伺服器发送的TLS证书无效,用户不能忽略浏览器警告继续访问网站。

历史

HSTS的雏形来自于2008年4月在北京召开的第十七届国际万维网大会英语International World Wide Web Conference上柯林·杰克逊(Collin Jackson)和亚当·巴斯(Adam Barth)的题为“ForceHTTPS: Protecting High-Security Web Sites from Network Attacks”的演讲。他们的提议是使用“ForceHTTPS” Cookie来强制浏览器使用HTTPS[4]

2009年9月18日,他们和杰夫·霍奇斯(Jeff Hodges)发布了最初的草案,题目为"Strict Transport Security"[5],这个草案基于ForceHTTPS,并有所修改[4]

2010年6月17日,这三位作者经由互联网工程任务组发布了首版互联网草案英语Internet Draft,"HTTP Strict Transport Security"[6]

2012年10月2日,互联网工程指导组英语Internet Engineering Steering Group批准了将第14版HSTS草案发布为RFC的请求[7]

2012年11月19日,互联网工程任务组发布RFC 6797[8]

作用

HSTS可以用来抵御SSL剥离攻击。SSL剥离攻击是中间人攻击的一种,由Moxie Marlinspike英语Moxie Marlinspike于2009年发明。他在当年的黑帽大会上发表的题为“New Tricks For Defeating SSL In Practice”的演讲中将这种攻击方式公开。SSL剥离的实施方法是阻止浏览器与伺服器建立HTTPS连接。它的前提是用户很少直接在地址栏输入https://,用户总是通过点击链接或3xx重定向,从HTTP页面进入HTTPS页面。所以攻击者可以在用户访问HTTP页面时替换所有https://开头的链接为http://,达到阻止HTTPS的目的。[9]

HSTS可以很大程度上解决SSL剥离攻击,因为只要浏览器曾经与伺服器建立过一次安全连接,之后浏览器会强制使用HTTPS,即使链接被换成了HTTP[3][10]

另外,如果中间人使用自己的自签名证书来进行攻击,浏览器会给出警告,但是许多用户会忽略警告。HSTS解决了这一问题,一旦伺服器发送了HSTS字段,将不再允许用户忽略警告。

不足

用户首次访问某网站是不受HSTS保护的。这是因为首次访问时,浏览器还未收到HSTS,所以仍有可能通过明文HTTP来访问。解决这个不足目前有两种方案,一是浏览器预置HSTS域名列表,Google ChromeFirefoxInternet ExplorerMicrosoft Edge实现了这一方案[11][12]。二是将HSTS资讯加入到域名系统记录中。但这需要保证DNS的安全性,也就是需要部署域名系统安全扩展。截至2016年这一方案没有大规模部署。

由于HSTS会在一定时间后失效(有效期由max-age指定),所以浏览器是否强制HSTS策略取决于当前系统时间。部分操作系统经常通过网络时间协议更新系统时间,如Ubuntu每次连接网络时、OS X Lion每隔9分钟会自动连接时间伺服器。攻击者可以通过伪造NTP资讯,设置错误时间来绕过HSTS。解决方法是认证NTP资讯,或者禁止NTP大幅度增减时间。比如Windows 8每7天更新一次时间,并且要求每次NTP设置的时间与当前时间不得超过15小时。[13]

浏览器支持

网站支持

根据SSL Pulse的调查,截至2015年2月,仅有2.7%的网站开启了HSTS[17],至2023年11月的统计,有34.2%的网站开启HSTS。

目前支持HSTS的主流网站有:支付宝[18]PayPal[2]Twitter[2]维基百科[19]等。

参见

参考文献

  1. ^ Steven Musil. Web security protocol HSTS wins proposed standard status. CNET. 2012-10-02 [2014-11-09]. (原始内容存档于2014-11-10). 
  2. ^ 2.0 2.1 2.2 邹铮编译. HTTP严格传输安全协议成互联网标准. 网界网. 2012-11-23 [2014-11-06]. (原始内容存档于2014-11-06). 
  3. ^ 3.0 3.1 HTTP Strict Transport Security (HSTS). Internet Engineering Task Force. November 2012 [2014-11-06]. (原始内容存档于2020-02-26). 
  4. ^ 4.0 4.1 Collin Jackson, Adam Barth. ForceHTTPS: Protecting High-Security Web Sites from Network Attacks. [2014-11-08]. (原始内容存档于2020-02-28). 
  5. ^ Jeff Hodges, Collin Jackson, Adam Barth. Strict Transport Security. 18 September 2009 [2014-11-08]. (原始内容存档于2014-10-12). 
  6. ^ Jeff Hodges, Collin Jackson, Adam Barth. draft-hodges-strict-transport-sec-00 - HTTP Strict Transport Security (HSTS). June 17, 2010 [2014-11-08]. (原始内容存档于2014-11-11). 
  7. ^ The IESG. [websec] Protocol Action: 'HTTP Strict Transport Security (HSTS)' to Proposed Standard (draft-ietf-websec-strict-transport-sec-14.txt). 2 Oct 2012 [2014-11-08]. (原始内容存档于2017-01-29). 
  8. ^ The RFC Editor Team. [websec] RFC 6797 on HTTP Strict Transport Security (HSTS). 19 Nov 2012 [2014-11-08]. (原始内容存档于2014-11-08). 
  9. ^ Moxie Marlinspike. New Tricks For Defeating SSL In Practice (PDF). [2014-11-06]. (原始内容 (PDF)存档于2014-12-30). 
  10. ^ 通过HTTPS保护网站的安全. Google. [2014-11-06]. (原始内容存档于2014-12-23). 
  11. ^ David Keeler. Preloading HSTS. Mozilla. 2012年11月1日 [2014-11-06]. (原始内容存档于2020-02-24). 
  12. ^ Bell, Mike; Walp, David. HTTP Strict Transport Security comes to Internet Explorer. February 16, 2015 [16 February 2015]. (原始内容存档于2015-11-15). 
  13. ^ Jose Selvi. Bypassing HTTP Strict Transport Security (PDF). Blackhat Europe 2014. [2014-11-06]. (原始内容 (PDF)存档于2014-10-22). 
  14. ^ HTTP Strict Transport Security. Mozilla. [2011-03-17]. (原始内容存档于2012-08-13). 
  15. ^ Opera Software ASA. Web specifications support in Opera Presto 2.10. 23 April 2012 [2012-05-08]. (原始内容存档于2016-09-11). 
  16. ^ Internet Explorer Web Platform Status and Roadmap. [2014-04-11]. (原始内容存档于2015-06-29). 
  17. ^ SSL Pulse - Survey of the SSL Implementation of the Most Popular Web Sites. TIM Trustworthy Internet Movement. [2015-02-16]. (原始内容存档于2017-05-15). 
  18. ^ Qualys SSL Labs - Projects / SSL Server Test / alipay.com. Qualys SSL Labs. [2014-11-06]. 
  19. ^ Chmarkine, CSteipp, Dzahn, Filippo Giunchedi, JanZerebecki, John F. Lewis. lists.wm.org - raise HSTS max-age to 1 year. Wikimedia Code Review. Oct 7, 2014 [2014-11-06]. 

外部链接

{{bottomLinkPreText}} {{bottomLinkText}}
HTTP严格传输安全
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?