Skip to main content

How to fix: Cookie Prefix Used Incorrectly

A cookie uses the __Host- or __Secure- prefix but does not satisfy the prefix's requirements (Secure attribute, Path=/, no Domain= attribute for __Host-). The browser will reject or ignore the prefix semantics.

Why it matters

Invalid prefix usage means the browser does not enforce the security properties the prefix is supposed to guarantee, leaving the cookie vulnerable to subdomain override, HTTP transmission, or path-based injection attacks.

__Host- requires: Secure, Path=/, and no Domain=. __Secure- requires: Secure. If any required attribute is missing, compliant browsers either reject the cookie entirely or ignore the prefix, stripping its security guarantees.

How to fix it

  1. 1For __Host-: ensure Secure; Path=/; no Domain= is set.
  2. 2For __Secure-: ensure Secure is present.
  3. 3Validate all prefixed cookie names at startup with a unit test.

Code examples

Correct __Host- cookie

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

Correct __Secure- cookie

HTTP
Set-Cookie: __Secure-prefs=dark-mode; Secure; SameSite=Lax; Path=/settings

References

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

See every cookies check

Questions

How severe is Cookie Prefix Used Incorrectly?
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-prefix-invalid, 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 prefix used incorrectly

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 Prefix Used Incorrectly | VulnRadar