Skip to main content

How to fix: Cookie Expires Is in the Past

A Set-Cookie header has an Expires value in the past, causing the browser to delete the cookie immediately. This is usually intentional on logout but may indicate a clock-skew bug on other pages.

Why it matters

If unintentional, an Expires value in the past causes the cookie to be deleted immediately, logging out the user or disabling functionality. On logout, it is correct behavior but should use Max-Age=0 which is more reliable across browsers.

A past Expires date causes user agents to delete the named cookie. Per RFC 6265, Max-Age takes precedence over Expires when both are present, so Max-Age=0 is the more portable mechanism for cookie deletion.

How to fix it

  1. 1Use Max-Age=0 instead of a past Expires date for explicit cookie deletion.
  2. 2If a past Expires is intentional (logout flow), confirm it only appears on logout endpoints.
  3. 3Audit for server clock skew if the past Expires appears on non-logout routes.

Code examples

Correct logout cookie deletion

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

References

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

See every cookies check

Questions

How severe is Cookie Expires Is in the Past?
VulnRadar rates this info 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-in-past, which stays the same between runs so you can filter, diff, or gate CI on it.

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 is in the past

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 Expires Is in the Past | VulnRadar