Mixing secure and insecure contexts isn't just a problem with HTTP; it's also a problem with e-mail protocols
https://nostarttls.secvuln.info/ |
https://youtu.be/kgR1nQYWBM8 |
Today, we want to talk about mixing insecure HTTP with secure HTTPS
Cookies are bound to the hostname (e.g., www.example.com) or the whole domain (e.g., .example.com)
Set Cookie over HTTPS
Read Cookie over HTTP
Optional. The Secure attribute (with no value) directs the user
agent to use only (unspecified) secure means to contact the origin
server whenever it sends back this cookie.
The user agent (possibly under the user's control) may determine
what level of security it considers appropriate for "secure"
cookies. [...]
The Secure attribute limits the scope of the cookie to "secure" channels (where "secure" is defined by the user agent). When a cookie has the Secure attribute, the user agent will include the cookie in an HTTP request only if the request is transmitted over a secure channel (typically HTTP over Transport Layer Security (TLS) [RFC2818]).
Although seemingly useful for protecting cookies from active network attackers, the Secure attribute protects only the cookie's confidentiality. An active network attacker can overwrite Secure cookies from an insecure channel, disrupting their integrity [...]
A fix for that problem was only provided very recently
Still just a draft, but use them!
Just because we have a Secure flag for cookies does not mean people will use it
Found and reported problems in various PHP web apps and described a practical attack on eBay
Plugin that made Cookie stealing attacks easy
Set-Cookie: __Host-SESSID=c60fu856m8u25vrv; path=/; Secure; HttpOnly; SameSite=Lax
Let's say you want to have a very secure website, so you redirect all HTTP calls to HTTPS
HTTP/1.1 301 Moved Permanently
Location: https://hboeck.de/
The redirect is still HTTP and is not protected!
Moxie Marlinspike, 2009
A network attacker can prevent the redirect and serve a fake webpage over HTTP
I see something like this quite often:
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
_._ _.-="_- _ _.-=" _- | ||"""""""---._______ __.. ___.===""""-.______-,,,,,,,,,,,,`-''----" """"" """"" __' __.--"" __ ,' o \ __ [__| __-""=======.--"" ""--.=================================.--"" ""--.=======: ] [w] : / \ : |========================| : / \ : [w] : V___________:| |: |========================| :| |: _-" V__________: \ / :_|=======================/_____: \ / :__-" -----------' ""____"" `-------------------------------' ""____""
Optional, usually not enabled by default, enable it!
First connection problem
I tried a few things
In Firefox before 122, any subdomain with an HSTS policy without includeSubDomain disables HSTS for all sub-sub-domains.
This even works with preloading!
Contact: https://bugcrowd.com/netflix Policy: https://bugcrowd.com/netflix Hiring: https://jobs.netflix.com/ Acknowledgments: https://bugcrowd.com/netflix/hall-of-fame Expires: 2025-01-01T06:00:00.000Z
Please note: This program or engagement does not allow disclosure.
https://bugzilla.mozilla.org/show_bug.cgi?id=1701192
https://bugzilla.mozilla.org/show_bug.cgi?id=1818984
Always redirect from http:// to https://
This makes sure you protect all subdomains.
No https:// -> http:// -> https://
Should always have the "Secure" flag, HSTS is no excuse for not having it
Enable HTTPS only mode in your browser
Need help with HTTPS, HSTS, TLS?
Contact me:
https://itsec.hboeck.de/