Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
3
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

HTTP Strict-Transport-Security (HSTS)

概要

ブラウザに次回のアクセス以降(指定した期間内であれば)ではHTTPSを使ってアクセスさせる

Strict-Transport-Security: max-age=<expire-time>
Strict-Transport-Security: max-age=<expire-time>; includeSubDomains
Strict-Transport-Security: max-age=<expire-time>; preload

max-age

  • HTTPSでのアクセスを強制させる期間

includeSubDomains

  • このオプションが指定された場合は全てのサブドメインに適用される

preload

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
https://hstspreload.org/
https://tools.ietf.org/html/rfc6797

HSTS 事前リスト

  • HSTSをあらかじめ有効にするサイト一覧
  • 事前リストに含めてもらうにはここで申請が必要 (一見怪しいサイトにみえるが、証明書を見る限りgoogleが管理してるっぽい)

その他

HSTSが有効なサイトはユーザが証明書エラーを無視することができなくなる(UAがそのケースはコネクションを切断してしまうため)

8.4. Errors in Secure Transport Establishment

When connecting to a Known HSTS Host, the UA MUST terminate the
connection (see also Section 12 ("User Agent Implementation Advice"))
if there are any errors, whether "warning" or "fatal" or any other
error level, with the underlying secure transport. For example, this
includes any errors found in certificate validity checking that UAs
employ, such as via Certificate Revocation Lists (CRLs) [RFC5280], or
via the Online Certificate Status Protocol (OCSP) [RFC2560], as well
as via TLS server identity checking [RFC6125].

防げる問題

  • httpアクセスをMITMで攻撃するケース
  • httpsサイトにhttpのリンクやコンテンツを意図せず含めてしまったケース
  • 不正な証明書をユーザが無視するようなケースを狙った攻撃

実際のレスポンスの例

$ curl -s -D - 'https://www.facebook.com/' -o /dev/null | grep Strict-Transport-Security
Strict-Transport-Security: max-age=15552000; preload
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
3
Help us understand the problem. What are the problem?