Skip to main content

How to fix: Cookie Set Multiple Times With Different Paths

The same cookie name is set more than once in the response, each with a different Path attribute.

Why it matters

The browser stores both cookies simultaneously and sends whichever one matches the current request path, so server-side code reading a single 'the' value for that name can silently read stale or unintended data.

Cookies are keyed by (name, domain, path) as a tuple, not by name alone. Setting 'session' at Path=/ and again at Path=/app creates two independent cookies that both appear as 'session' in document.cookie on paths under /app, and which one wins depends on cookie ordering rules that vary by browser.

How to fix it

  1. 1Use a single, consistent Path (usually /) for each cookie name across the whole application.
  2. 2If you need path-scoped cookies, give them distinct names instead of relying on Path to disambiguate.

Code examples

Use one Path per cookie name

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

References

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

See every cookies check

Questions

How severe is Cookie Set Multiple Times With Different Paths?
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-duplicate-name-different-path, 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 set multiple times with different paths

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 Set Multiple Times With Different Paths | VulnRadar