Skip to main content
HighCookiesOWASP A07:2021CWE-614

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

  1. 1Ensure session cookies have HttpOnly; Secure; SameSite=Lax (minimum) or SameSite=Strict.
  2. 2Use the __Host- prefix to enforce these properties at the browser level.

Code examples

Fully secured session cookie

HTTP
Set-Cookie: __Host-session=abc123; HttpOnly; Secure; SameSite=Lax; Path=/

Node.js (express-session)

JavaScript
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.

See every cookies check

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.

Propose a checkHow a check is built

Scan your own site for session cookie missing security flags

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

Session Cookie Missing Security Flags fix | VulnRadar