Page MenuHomePhabricator

Support HTTP Strict Transport Security
ClosedPublic

Authored by epriestley on Feb 19 2015, 2:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 24, 10:48 PM
Unknown Object (File)
Thu, Apr 11, 7:41 AM
Unknown Object (File)
Tue, Apr 9, 12:21 PM
Unknown Object (File)
Mar 15 2024, 10:50 AM
Unknown Object (File)
Mar 12 2024, 6:42 PM
Unknown Object (File)
Mar 12 2024, 2:02 PM
Unknown Object (File)
Mar 8 2024, 2:24 AM
Unknown Object (File)
Mar 8 2024, 2:24 AM
Subscribers

Details

Summary

Ref T4340. The attack this prevents is:

  • An adversary penetrates your network. They acquire one of two capabilities:
    • Your server is either configured to accept both HTTP and HTTPS, and they acquire the capability to observe HTTP traffic.
    • Or your server is configured to accept only HTTPS, and they acquire the capability to control DNS or routing. In this case, they start a proxy server to expose your secure service over HTTP.
  • They send you a link to http://secure.service.com (note HTTP, not HTTPS!)
  • You click it since everything looks fine and the domain is correct, not noticing that the "s" is missing.
  • They read your traffic.

This is similar to attacks where https://good.service.com is proxied to https://good.sorvace.com (i.e., a similar looking domain), but can be more dangerous -- for example, the browser will send (non-SSL-only) cookies and the attacker can write cookies.

This header instructs browsers that they can never access the site over HTTP and must always use HTTPS, defusing this class of attack.

Test Plan
  • Configured HTTPS locally.
  • Accessed site over HTTP (got application redirect) and HTTPS.
  • Enabled HSTS.
  • Accessed site over HTTPS (to set HSTS).
  • Tore down HTTPS part of the server and tried to load the site over HTTP. Browser refused to load "http://" and automatically tried to load "https://". In another browser which had not received the "HSTS" header, loading over HTTP worked fine.
  • Brought the HTTPS server back up, things worked fine.
  • Turned off the HSTS config setting.
  • Loaded a page (to set HSTS with expires 0, diabling it).
  • Tore down the HTTPS part of the server again.
  • Tried to load HTTP.
  • Now it worked.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Support HTTP Strict Transport Security.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
btrahan edited edge metadata.

Take it or leave it doc suggestion.

src/applications/config/option/PhabricatorSecurityConfigOptions.php
242–245

Can you be heavier handed with advice? e.g. "If... you should not enable this option." I worry a user reads this and makes a decision based on how generally gutsy. Maybe we can upsell some desired / recommend HTTPS configuration here?

This revision is now accepted and ready to land.Feb 19 2015, 6:23 PM
epriestley edited edge metadata.
  • Strengthen advice.

Meant to say something more English-like such as "based on how generally gutsy they are."

A "gutsy" is clearly a gut feeling.

This revision was automatically updated to reflect the committed changes.