Skip to main content
LowCookiesOWASP A07:2021CWE-613

How to fix: Cookie Expires/Max-Age Exceeds 1 Year

A cookie is set with an Expires or Max-Age value more than 1 year in the future. Long-lived cookies remain in browser storage indefinitely, increasing exposure from browser theft and reducing the effectiveness of logout.

Why it matters

A session cookie that persists for years can be stolen from a compromised device months after the original session ended. Long-lived cookies also violate GDPR and other privacy regulations requiring user data to not be retained longer than necessary.

Browser storage (including cookies) can be extracted from devices. Shorter cookie lifetimes limit the window during which a stolen cookie remains usable. Most privacy regulations recommend not storing tracking or session data beyond necessity.

How to fix it

  1. 1Limit session cookies to 7-30 days with idle timeout (invalidate server-side on inactivity).
  2. 2Limit preference/remember-me cookies to 90-365 days maximum.
  3. 3Implement server-side session rotation so long-lived cookies do not equal long-lived sessions.

Code examples

Session cookie (7-day max)

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

References

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

See every cookies check

Questions

How severe is Cookie Expires/Max-Age Exceeds 1 Year?
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-expires-too-far, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Cookie Expires/Max-Age Exceeds 1 Year map to?
It maps to CWE-613. 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 cookie expires/max-age exceeds 1 year

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

Cookie Expires/Max-Age Exceeds 1 Year fix | VulnRadar