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
- 1Add Secure to prevent sending over HTTP
- 2Add HttpOnly to prevent JavaScript access
- 3Add SameSite=Strict or Lax to prevent CSRF
Code examples
Secure cookie attributes
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.
More headers checks
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.