Insecure Cookie Flags (HttpOnly / SameSite / Secure)
Cookie attributes are cheap, high-leverage defenses. Their absence amplifies other vulnerabilities.
The flags
- HttpOnly — blocks JavaScript from reading the cookie. Without it, any XSS becomes session theft.
- Secure — sends the cookie only over HTTPS. Without it, a single HTTP request can leak the session on a hostile network.
- SameSite — controls cross-site sending.
LaxorStrictmitigates CSRF;None(required for cross-site) must be paired withSecure. - Domain/Path scope — overly broad
Domainshares cookies with subdomains an attacker might control.
How to test
Inspect Set-Cookie headers on the session cookie. Flag any session cookie missing HttpOnly or Secure, or set to SameSite=None without justification, or scoped to a parent domain unnecessarily.
Impact
Enables XSS-to-session-theft, CSRF, and cookie leakage over insecure transport.
Defenses
- Set
HttpOnly; Secure; SameSite=Lax(orStrict) on session cookies by default. - Scope
Domain/Pathas narrowly as possible; use__Host-prefixed cookies where applicable.