Cookie Without a SameSite Attribute

A sensitive cookie is set without a SameSite attribute, so whether browsers attach it to requests started by other sites depends on each browser's default.

SeverityInformational
CVSS 3.10 CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:N Open in the calculator
CVSS 4.00 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator
CWECWE-1275: Sensitive Cookie with Improper SameSite Attribute
OWASP Top 10A01:2025 Broken Access Control
CategorySecurity Misconfiguration

Description

The SameSite cookie attribute controls whether the browser sends a cookie with requests that another site causes. Strict withholds it from all of them; Lax sends it with them only when they are top-level navigations using a safe method such as GET; and None sends it with all of them and requires Secure. The application sets one or more sensitive cookies without the attribute, so each browser's default applies.

The defaults differ. Chromium-based browsers, such as Chrome and Edge, treat a cookie without the attribute as Lax, but still send it with cross-site top-level POST requests made within two minutes of the cookie being set. Firefox and Safari do not apply Lax by default: they restrict cookies in embedded third-party contexts, but send them with cross-site top-level navigations, including form submissions using POST. The protection users receive therefore depends on their browser.

The missing attribute has no direct impact, but it removes a layer of defence against cross-site request forgery, cross-site WebSocket hijacking and some cross-site information leaks. For users of browsers that do not default to Lax, a page on another site can make requests that carry the session cookie, so any state-changing function without its own anti-forgery protection can be triggered as the logged-in user. The attribute also treats every subdomain of the same registrable domain as the same site, so it offers no protection against requests from those, and where the application uses anti-forgery tokens throughout, its absence adds little.

The issue is identified by inspecting the Set-Cookie headers. A cookie explicitly set to SameSite=None without a need for cross-site use is a related, weaker configuration.

Remediation

Set an explicit SameSite value on every cookie:

  • Use SameSite=Lax for session cookies in most applications. Users still arrive logged in when following links from other sites, while the cookie is withheld from cross-site POST requests and embedded requests.
  • Use SameSite=Strict for cookies that authorise sensitive actions where users never need to arrive from another site already logged in, or pair a Strict cookie for sensitive actions with a Lax cookie for general browsing.
  • Use SameSite=None; Secure only for cookies that must be sent in cross-site contexts, such as an application embedded in another site's frame or some single sign-on flows, and protect those requests in other ways.
  • Set the value through the framework where possible, for example session.cookie_samesite in PHP, Cookie.SameSite in ASP.NET Core cookie options or cookie.sameSite in express-session.
Set-Cookie: __Host-id=38afes7a8; Secure; HttpOnly; SameSite=Lax; Path=/

Keep anti-forgery tokens on state-changing requests as well, since the attribute does not cover requests from other subdomains of the same site or browsers that ignore it. Confirm the fix by inspecting the Set-Cookie headers after login.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More Web Applications Findings

Every Web Applications finding