Track 08 · Lesson 1 of 20Attacks and defenses
- 01What HTTPS protects
- 02The same-origin policy
- 03CORS
- 04Security headers
- 05Cookies done right
- 06Cross-site scripting (XSS)
- 07Content Security Policy
- 08Cross-site request forgery (CSRF)
- 09Clickjacking
- 10Unsafe URLs and open redirects
- 11Prompt injection
- 12SQL and command injection
- 13Prototype pollution, CRLF and SVG
- 14Server-side request forgery (SSRF)
- 15Remote code execution and denial of service
- 16Spoofed headers
- 17Rate limiting
- 18Cache poisoning
- 19The OWASP Top 10
- 20The attack lab
Track 08 · Attacks and defenses
What HTTPS protects
Lesson 1 of 20· 6 min
The “S” in HTTPS is TLS encryption. Without it, anyone on the same network can read and change everything you send: pages, cookies, passwords.
Log in on café Wi-Fi
Mallory at the next table records everything
What Mallory captures
Nothing captured yet.Three promises#
- Privacy. Nobody in between can read the page, the cookies or the password.
- Integrity. Nobody can change the data in transit, like injecting ads, malware or a fake login form.
- Authentication. The certificate proves you’re talking to the real site, signed by an authority your browser trusts.
What HTTPS doesn’t hide: which site you’re visiting (the server name travels in the clear), roughly how much data moves, and when.
HSTS closes the very first gap#
Even an HTTPS site can be attacked if someone types shop.example.com without https://, because the browser’s first request may go out as plain HTTP. Whoever answers that request can keep you on HTTP forever while talking HTTPS to the real site. That’s SSL stripping.
Type a bare domain
With and without the header
- Press the button to watch the first request.
Strict-Transport-Security tells the browser to use HTTPS for this site from now on, before anything leaves the computer. Sites that add preload and submit themselves to the HSTS preload list are protected even on a first visit.
A padlock isn’t a promise of honesty#
Certificates are free from Let’s Encrypt, so most phishing sites have a padlock too. It means the connection is private, not that the people at the other end are who you hoped.
Check yourself