Skip to main content
LowCookiesOWASP A05:2021CWE-614

How to fix: Cookie Missing Secure Attribute

A cookie was set without the Secure attribute. Without Secure, the browser will send the cookie over both HTTP and HTTPS connections, exposing it to network interception.

Why it matters

An on-path attacker who can intercept plain HTTP traffic (Wi-Fi eavesdropping, SSRF, HTTP downgrade) receives the cookie in cleartext and can hijack the user's session.

The Secure attribute instructs the browser to transmit the cookie only over HTTPS connections. Without it, the cookie is also sent over plain HTTP. Even if the site enforces HTTPS via HSTS, mixed-content resources or HTTP redirects before HSTS kicks in can expose the cookie.

How to fix it

  1. 1Add the Secure attribute to all cookies that carry session or authentication data.
  2. 2Prefer the __Host- or __Secure- prefix to enforce Secure at the browser level.
  3. 3Ensure the site is fully HTTPS and HSTS is configured.

Code examples

Set-Cookie with Secure

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

Node.js response.cookie()

JavaScript
res.cookie('session', token, {
  httpOnly: true,
  secure: process.env.NODE_ENV === 'production',
  sameSite: 'lax',
  path: '/',
});

References

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

See every cookies check

Questions

How severe is Cookie Missing Secure Attribute?
VulnRadar rates this low 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 cookie-secure-missing, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Cookie Missing Secure Attribute 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 cookie missing secure attribute

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: Cookie Missing Secure Attribute | VulnRadar