How to fix: JWT-Shaped Cookie Missing HttpOnly
A cookie whose value has the three-part base64url.base64url.base64url shape of a JWT is missing the HttpOnly attribute.
Why it matters
Any script running on the page, including one injected via XSS or a compromised third-party dependency, can read document.cookie and exfiltrate the token, giving the attacker a valid, unexpired session.
A cookie value matching the JWT structure is almost always a session or access token. Storing it without HttpOnly makes it readable from JavaScript, which defeats the entire point of using a cookie (rather than localStorage) as the storage mechanism in the first place.
How to fix it
- 1Set the HttpOnly attribute on any cookie carrying a JWT or other bearer token.
- 2If client-side JavaScript genuinely needs to read the token, split it: keep the signature in an HttpOnly cookie and issue a separate non-sensitive value for JS to read.
Code examples
Set HttpOnly on a JWT cookie
Set-Cookie: access_token=eyJhbGciOi...; HttpOnly; Secure; SameSite=Lax; Path=/References
Detected automatically by VulnRadar. The check id is cookie-jwt-value-not-httponly, 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
- LowCookie Expires/Max-Age Exceeds 1 Year
- InfoCookie Name Leaks Framework or Language
Questions
- How severe is JWT-Shaped Cookie Missing HttpOnly?
- VulnRadar rates this high 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-jwt-value-not-httponly, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does JWT-Shaped Cookie Missing HttpOnly map to?
- It maps to CWE-1004. 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.