How to fix: Session Cookie Missing Security Flags
A session cookie (identified by name pattern: session, sid, auth, token) is missing one or more critical security attributes: HttpOnly, Secure, or SameSite.
Why it matters
A session cookie without HttpOnly is stealable via XSS. Without Secure it can be intercepted on HTTP. Without SameSite it is vulnerable to CSRF. Missing any one of these flags weakens the session's resistance to common attacks.
Session cookies are the primary authentication token in most web applications. They require all three protections: HttpOnly (no JS access), Secure (HTTPS only), and SameSite (CSRF protection). Omitting any one creates a gap that specific attacks exploit.
How to fix it
- 1Ensure session cookies have HttpOnly; Secure; SameSite=Lax (minimum) or SameSite=Strict.
- 2Use the __Host- prefix to enforce these properties at the browser level.
Code examples
Fully secured session cookie
Set-Cookie: __Host-session=abc123; HttpOnly; Secure; SameSite=Lax; Path=/Node.js (express-session)
app.use(session({
name: '__Host-sid',
secret: process.env.SESSION_SECRET,
cookie: {
httpOnly: true,
secure: true,
sameSite: 'lax',
path: '/',
maxAge: 7 * 24 * 60 * 60 * 1000,
},
resave: false,
saveUninitialized: false,
}));References
Detected automatically by VulnRadar. The check id is session-cookie-flags, stable across every scan so you can filter or diff on it.
More cookies checks
- LowCookie Domain Attribute Is Too Broad
- LowCookie Missing Secure Attribute
- InfoThird-Party Cookie Missing Partitioned Attribute
- High__Host- Prefix Cookie Missing Secure Attribute
- High__Host- Prefix Cookie with Non-Root Path
- High__Secure- Prefix Cookie Missing Secure Attribute
- LowCookie Expires/Max-Age Exceeds 1 Year
- InfoCookie Name Leaks Framework or Language
Questions
- How severe is Session Cookie Missing Security Flags?
- VulnRadar rates this high severity in the cookies category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id session-cookie-flags, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Session Cookie Missing Security Flags map to?
- It maps to CWE-614. In the OWASP Top 10 it falls under A07:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.