Page MenuHomePhabricator

Support HTTP Strict Transport Security
ClosedPublic

Authored by epriestley on Feb 19 2015, 2:25 PM.
Tags
None
Referenced Files
F14066642: D11820.diff
Tue, Nov 19, 10:59 AM
F14059773: D11820.id28489.diff
Sun, Nov 17, 9:36 PM
F14059582: D11820.id28489.diff
Sun, Nov 17, 8:35 PM
F14058270: D11820.id28502.diff
Sun, Nov 17, 10:33 AM
F14058256: D11820.id28489.diff
Sun, Nov 17, 10:28 AM
F14051691: D11820.diff
Fri, Nov 15, 2:59 AM
F14037724: D11820.diff
Sun, Nov 10, 6:36 PM
F14024864: D11820.diff
Thu, Nov 7, 12:51 PM
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
Branch
hsts
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 4570
Build 4584: [Placeholder Plan] Wait for 30 Seconds

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.