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
- 1Limit session cookies to 7-30 days with idle timeout (invalidate server-side on inactivity).
- 2Limit preference/remember-me cookies to 90-365 days maximum.
- 3Implement server-side session rotation so long-lived cookies do not equal long-lived sessions.
Code examples
Session cookie (7-day max)
Set-Cookie: __Host-session=abc123; HttpOnly; Secure; SameSite=Lax; Path=/; Max-Age=604800References
Detected automatically by VulnRadar. The check id is cookie-expires-too-far, stable across every scan so you can filter or diff on it.
More cookies checks
- LowCookie Domain Attribute Is Too Broad
- LowCookie Missing Secure Attribute
- InfoThird-Party Cookie Missing Partitioned Attribute
- High__Host- Prefix Cookie Missing Secure Attribute
- High__Host- Prefix Cookie with Non-Root Path
- High__Secure- Prefix Cookie Missing Secure Attribute
- InfoCookie Name Leaks Framework or Language
- MediumCookie Path Crosses Application Boundary
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.