QA
Beginner LevelWeb Security & Cyber Defense

What is HSTS (HTTP Strict Transport Security) and how does it prevent SSL Stripping attacks?

❓ Interview Prompt: Explain HSTS, SSL Stripping attacks, `Strict-Transport-Security` header, `includeSubDomains`, `preload`, and browser HTTPS enforcement.

HSTS (HTTP Strict Transport Security) (RFC 6797) protects websites against SSL Stripping and Man-in-the-Middle (MitM) downgrade attacks:

SSL Stripping Scenario:

A user types 'example.com'. The browser makes an initial unencrypted 'http://example.com' request. A rogue Wi-Fi router intercepts it and strips HTTPS, keeping the victim on unencrypted HTTP!

HSTS Solution:

When the browser receives 'Strict-Transport-Security: max-age=31536000; includeSubDomains; preload', it records this rule. For 1 year, the browser will automatically convert ALL 'http://' URLs to 'https://' locally before issuing network requests!

Code Implementation Example

http
HTTP/1.1 200 OK
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
💡HSTS HTTP response header forcing 1-year browser HTTPS upgrade.
🎯 Interview Key Takeaway

HSTS forces browsers to convert HTTP URLs to HTTPS locally, neutralizing SSL stripping attacks.

More Web Security & Cyber Defense Interview Questions

Beginner LevelSecurity & Web Security

Explain OWASP Top 10 vulnerabilities (XSS, CSRF, SQL Injection) and their defenses.

Beginner LevelSecurity & Web Security

What are the 3 types of XSS (Stored, Reflected, DOM-based) and how do they differ?

Beginner LevelSecurity & Web Security

How do Parameterized Queries (Prepared Statements) prevent SQL Injection attacks?