This vulnerability occurs when a sensitive cookie does not have a secure SameSite attribute configured, leaving it exposed to cross-site request forgery (CSRF) attacks.
The SameSite cookie attribute is a critical browser security feature that controls whether a cookie is sent with cross-site requests. It has three possible values: 'Strict' (most secure, never sent cross-site), 'Lax' (sent with safe top-level navigation like links), and 'None' (always sent, requiring the Secure flag). When this attribute is omitted or set insecurely for sensitive cookies—like session or authentication tokens—those credentials can be automatically included in malicious cross-site requests, bypassing the browser's default protections. This creates a direct path for CSRF attacks, where an attacker's site can trigger authenticated actions on the target site without the user's consent. While other defenses like anti-CSRF tokens are important, properly configuring SameSite provides a fundamental, browser-enforced layer of security. For maximum protection, set sensitive cookies to 'Strict' or 'Lax' unless a specific cross-site functionality requires 'None', in which case the Secure flag is mandatory.
Impact: Modify Application Data
If the website does not impose additional defense against CSRF attacks, failing to use the 'Lax' or 'Strict' values could increase the risk of exposure to CSRF attacks. The likelihood of the integrity breach is Low because a successful attack does not only depend on an insecure SameSite attribute. In order to perform a CSRF attack there are many conditions that must be met, such as the lack of CSRF tokens, no confirmations for sensitive actions on the website, a "simple" "Content-Type" header in the HTTP request and many more.
Effectiveness: High
let sessionId = generateSessionId() let cookieOptions = { domain: 'example.com' } response.cookie('sessionid', sessionId, cookieOptions)
htmllet sessionId = generateSessionId() let cookieOptions = { domain: 'example.com', sameSite: 'Strict' } response.cookie('sessionid', sessionId, cookieOptions)
Medium