Skip to main content

Insecurely generated cookies - SameSite

Description

The applications cookies are generated without properly setting the SameSite attribute.

Impact

Perform a malicious request via a CSRF attack.

Recommendation

The application must set the SameSite attribute in the cookies with sensitive information.

Threat

Attacker from Internet network performing a CSRF attack.

Expected Remediation Time

⌚ 30 minutes.

Score

Default score using CVSS 3.1. It may change depending on the context of the vulnerability.

Base

  • Attack vector: N
  • Attack complexity: L
  • Privileges required: N
  • User interaction: R
  • Scope: U
  • Confidentiality: N
  • Integrity: L
  • Availability: N

Temporal

  • Exploit code madurity: P
  • Remediation level: X
  • Report confidence: X

Result

  • Vector string: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N/E:P/RL:X/RC:X
  • Score:
    • Base: 4.3
    • Temporal: 4.1
  • Severity:
    • Base: Medium
    • Temporal: Medium

Code Examples

Compliant code

The Set-Cookie attribute is correctly configured for the Set-Cookie http header

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Set-Cookie: session=/; Path=/; SameSite=Strict
Server: Werkzeug/2.0.1 Python/3.8.9
Date: Tue, 01 Feb 2022 20:29:25 GMT

Non compliant code

The http headers do not correctly define the Same-Site attribute

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Set-Cookie: session=/; Path=/; SameSite=Lax
Server: Werkzeug/2.0.1 Python/3.8.9
Date: Tue, 01 Feb 2022 20:29:25 GMT

Requirements