Skip to main content
HighHeadersOWASP A05:2021CWE-614

How to fix: Cookies missing security attributes

One or more cookies are set without required security attributes (Secure, HttpOnly, SameSite).

Why it matters

Cookies without Secure can be sent over HTTP (interceptable). Without HttpOnly, scripts can steal session cookies via XSS. Without SameSite, cookies are sent on cross-site requests, enabling CSRF attacks.

All session and authentication cookies must have Secure, HttpOnly, and SameSite attributes set.

How to fix it

  1. 1Add Secure to prevent sending over HTTP
  2. 2Add HttpOnly to prevent JavaScript access
  3. 3Add SameSite=Strict or Lax to prevent CSRF

Code examples

Secure cookie attributes

TypeScript
res.setHeader("Set-Cookie",
  `session=${token}; HttpOnly; Secure; SameSite=Strict; Path=/; Max-Age=86400`
);
// For session cookies: omit Max-Age (expires on browser close)
// For remember-me: Max-Age=2592000 (30 days)

References

Detected automatically by VulnRadar. The check id is cookie-security, stable across every scan so you can filter or diff on it.

See every headers check

Questions

How severe is Cookies missing security attributes?
VulnRadar rates this high severity in the headers 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 cookie-security, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Cookies missing security attributes map to?
It maps to CWE-614. In the OWASP Top 10 it falls under A05: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 cookies missing security attributes

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

How to fix: Cookies missing security attributes | VulnRadar