SSL stripping
| Class | Authentication |
|---|---|
| Also known as | HTTPS stripping, sslstrip attack |
| OWASP Top 10 | A04:2025 Cryptographic Failures |
| MITRE ATT&CK | T1557 Adversary-in-the-Middle |
| Typical severity | High |
| Affects | Sites that answer on plain HTTP and do not send HSTS, and visitors on a network someone else controls |
A visitor types example.com into the address bar. The browser has no reason to assume HTTPS, so the first request leaves in plain HTTP, and the site answers with a redirect to https://example.com/. SSL stripping is an attack on that first exchange: a manipulator in the middle rewrites the redirect and every https:// link in the page to http://, then talks HTTPS to the real server on the visitor's behalf.1 The visitor stays on an unencrypted connection that the attacker reads and edits, and the server sees an ordinary encrypted session.
The encryption itself is never broken. People reach secure pages through insecure ones, by clicking links and following redirects, and almost nobody types https://.1 The wider problem of traffic sent unencrypted is in Encryption in transit.
How the rewrite works
Moxie Marlinspike presented the technique and a tool for it, sslstrip, at Black Hat DC in February 2009.1 His earlier tool, sslsniff, attacked the encrypted connection and needed a certificate the browser would accept; by 2009 browsers put warnings in front of certificates no authority signed. sslstrip attacked the plain HTTP before the encrypted connection, where no warning appears.1
sslstrip runs as a proxy, a program that relays traffic between the visitor and the site. It watches the HTTP traffic and changes two things. In a redirect, a header such as
HTTP/1.1 301 Moved Permanently
Location: https://example.com/loginreaches the browser with Location: http://example.com/login. In HTML, each <a href="https://... becomes http://. The proxy keeps a map of what it changed. When the browser later asks for one of those addresses over HTTP, the proxy fetches it from the server over HTTPS and passes the answer back, rewritten again.1 A login form now posts the password in clear text to the attacker, who forwards it.
sslstrip also removed the Secure flag from Set-Cookie headers so that cookies would still travel over the stripped connection. To catch a password instead of an existing session, it answered with a redirect to the same address that expired the visitor's cookies, which forces a fresh login; it left cookies alone for the first five minutes, noted the sessions it saw, and afterwards expired only sessions it had not seen in that window, so the logout looked like an ordinary timeout. For stripped addresses it could also serve a padlock as the tab icon (favicon).1 The same slides combined stripping with Look-alike domains, swapping links for HTTPS addresses on a domain the attacker held a valid certificate for.
Getting on the path
Stripping needs control of the network between the visitor and the site. The usual ways are posing as the visitor's DNS server, forging frames on a wireless network, running a look-alike access point (an evil twin), or taking over a home router through Default credentials.2 The sslstrip setup sends a Linux machine's port 80 traffic to the proxy and uses ARP spoofing (answering the local network's address lookups with the attacker's machine) to pull other devices' traffic through it.3 Forged ARP and DNS answers, and downgrading a connection to a weaker protocol version, are common ways to gain this position.4 Adversary-in-the-middle phishing uses the same position in a different way: the victim connects to the attacker's domain over valid HTTPS.
The 2009 demonstration
Marlinspike's slides report 24 hours of sslstrip on one network: 117 email accounts, 16 credit card numbers, 7 PayPal logins and more than 300 other logins that should have gone over HTTPS. Of the sites listed, login.yahoo.com had the most logins with 114, then Gmail with 50. The slide headed "Number of people that balked" shows 0.1
Defences
Redirect, then HSTS
A site on port 80 should answer every HTTP request with a permanent redirect to the same address on HTTPS. The redirect alone does not stop stripping, because it travels over HTTP. The Strict-Transport-Security header does, from the second visit on. Once a browser has received it over HTTPS, it rewrites every http:// address for that host to https:// and port 80 to 443 before sending anything, for max-age seconds.2 The header has to arrive over HTTPS, so a redirect sent over HTTP should not carry it, and a certificate error on an HSTS host offers no button to continue.5
Strict-Transport-Security: max-age=31536000; includeSubDomainsThe first visit, before the browser has seen the header, remains open. RFC 6797 calls this the bootstrap MITM vulnerability.2 Full detail is in HTTP Strict Transport Security, and the settings per host in Certificates and TLS settings.
Preloading
Browsers ship a preload list of domains that are HTTPS-only before any visit. Entry requires a valid certificate, the HTTP redirect, HTTPS on every subdomain, and a header on the base domain with max-age of at least 31536000, includeSubDomains and preload. New entries take months to reach stable Chrome, and removal is slow.6 The list's maintainers now advise against preloading for most sites, because Chrome and Safari already upgrade HTTP navigations to HTTPS and the list adds value only when that upgrade fails under an active attacker.6
Cookies
A page served over plain HTTP cannot set a cookie with the Secure attribute. A cookie named with the __Host- prefix is accepted only if it carries Secure, comes from an HTTPS origin, has Path=/ and no Domain.7 On a stripped connection the browser therefore refuses a __Host- cookie either way: with Secure left in, an HTTP page may not set it, and with Secure removed, the prefix rule fails. The session does not work over the stripped connection, which defeats the 2009 cookie rewrite. See Cookie attributes.
Set-Cookie: __Host-session=abc123; Secure; HttpOnly; Path=/Browsers
Chrome added an opt-in setting in 2022, Always Use Secure Connections, that tries HTTPS for every navigation and warns before falling back to HTTP.8 An attacker needs only one insecure navigation, and an HTTP request that redirects at once to HTTPS is invisible to the user.8 With Chrome 154 in October 2026 the setting became the default for all users on public sites;8 local addresses such as 192.168.0.1 and single-label names are exempt by default.9
Prompt for a coding agent
Check how this app is served over HTTP and HTTPS. Make every plain HTTP request get a permanent redirect to the same path on HTTPS. Add the header Strict-Transport-Security: max-age=31536000; includeSubDomains to HTTPS responses only, after confirming every subdomain works over HTTPS. Do not add the preload directive. Make every link, form action and redirect inside the app use https:// or a relative path. Give the session cookie the Secure and HttpOnly attributes and, where the code allows, the __Host- prefix with Path=/ and no Domain. List each file you changed.
In SecFlash
On the Security page, SecFlash reports SF-SEC-202 when plain HTTP does not redirect to HTTPS, SF-SEC-101 when the HSTS header is missing, SF-SEC-102 when its max-age is short, and SF-SEC-501 when a login cookie lacks Secure. For a site behind Cloudflare, the Cloud page shows SF-CLD-302 when the zone does not force HTTPS and SF-CLD-311 when it does not send HSTS.
See also
- Encryption in transit
- HTTP Strict Transport Security
- TLS certificates
- Certificates and TLS settings
- Cookie attributes
- HTTP security headers
- Adversary-in-the-middle phishing
- Category: Authentication
References
- a b c d e f g Marlinspike, M. (February 2009). "New Tricks For Defeating SSL In Practice" (slides). Black Hat DC 2009.
- a b c Hodges, J., Jackson, C. and Barth, A. (November 2012). "HTTP Strict Transport Security (HSTS)". RFC 6797. IETF.
- back Marlinspike, M. "sslstrip" README. GitHub.
- back MITRE. "Adversary-in-the-Middle (T1557)". MITRE ATT&CK.
- back "Strict-Transport-Security header". MDN Web Docs. Mozilla.
- a b Chromium project. "HSTS Preload List Submission". hstspreload.org.
- a b c Google Chrome Security (28 October 2025). "HTTPS by default". Google blog.
- back Google Chrome Security (21 October 2026). "Chrome Now Warns Before Insecure HTTP Connections". Google blog.
External links
- Strict-Transport-Security header, MDN Web Docs