Skip to main content

Insecurely generated cookies - HttpOnly

Description

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

Impact

Obtain sensitive information by performing a XSS attack.

Recommendation

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

Threat

Authorized attacker from internet network performing a XSS 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: H
  • Privileges required: N
  • User interaction: R
  • Scope: U
  • Confidentiality: L
  • Integrity: N
  • Availability: N

Temporal

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

Result

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

Code Examples

Compliant code

The http headers allow only http to generate cookies

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Set-Cookie: google_analytics=1asdf345; HttpOnly; Path=/
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 Set-Cookie attribute

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

Requirements