---
title: "CWE-784: Reliance on Cookies without Validation and Integrity Checking in a Security Decision"
url: https://radicalnotion.ai/cwe/cwe-784
type: cwe
description: "The product uses a protection mechanism that relies on the existence or values of a cookie, but it does not properly ensure that the cookie is valid for the associated user."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-784: Reliance on Cookies without Validation and Integrity Checking in a Security Decision

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Draft
- **Likelihood of exploit:** High
- **CVEs with this as primary weakness:** 5
- **Of those, in CISA KEV:** 0
- **New in 2026:** 1
- **CWE catalog version:** 4.21

## Description

The product uses a protection mechanism that relies on the existence or values of a cookie, but it does not properly ensure that the cookie is valid for the associated user.

## Modes of introduction

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

## Applicable platforms

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

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Access Control | Bypass Protection Mechanism, Gain Privileges or Assume Identity | It is dangerous to use cookies to set a user's privileges or perform other security-critical actions. Attackers can easily modify cookies, within the browser or by implementing the client-side code outside of the browser. The cookie can be manipulated to claim a high level of authorization, or to claim that successful authentication has occurred. |

## Potential mitigations

### Architecture and Design

Avoid using cookie data for a security-related decision.

### Implementation

Perform thorough input validation (i.e.: server side validation) on the cookie data if you're going to use it for a security related decision.

### Architecture and Design

Add integrity checks to detect tampering.

### Architecture and Design

Protect critical cookies from replay attacks, since cross-site scripting or other attacks may allow attackers to steal a strongly-encrypted cookie that also passes integrity checks. This mitigation applies to cookies that should only be valid during a single transaction or session. By enforcing timeouts, you may limit the scope of an attack. As part of your integrity check, use an unpredictable, server-side value that is not exposed to the client.

## Demonstrative examples

### Example 1

The following code excerpt reads a value from a browser cookie to determine the role of the user.

Bad code:

```java
Cookie[] cookies = request.getCookies();
for (int i =0; i< cookies.length; i++) {
    Cookie c = cookies[i];
    if (c.getName().equals("role")) {
        userRole = c.getValue();
    }
}
```

### Example 2

The following code could be for a medical records application. It performs authentication by checking if a cookie has been set.

Bad code:

```php
$auth = $_COOKIES['authenticated'];
if (! $auth) {
    if (AuthenticateUser($_POST['user'], $_POST['password']) == "success") {
        // save the cookie to send out in future responses
        setcookie("authenticated", "1", time()+60*60*2);
    }
    else {
        ShowLoginScreen();
        die("\n");
    }
}
DisplayMedicalHistory($_POST['patient_ID']);
```

### Example 3

In the following example, an authentication flag is read from a browser cookie, thus allowing for external control of user state data.

Bad code:

```java
Cookie[] cookies = request.getCookies();
for (int i =0; i< cookies.length; i++) {
    Cookie c = cookies[i];
    if (c.getName().equals("authenticated") && Boolean.TRUE.equals(c.getValue())) {
        authenticated = true;
    }
}
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2009-1549 | Attacker can bypass authentication by setting a cookie to a specific value. |
| CVE-2009-1619 | Attacker can bypass authentication and gain admin privileges by setting an "admin" cookie to 1. |
| CVE-2009-0864 | Content management system allows admin privileges by setting a "login" cookie to "OK." |
| CVE-2008-5784 | e-dating application allows admin privileges by setting the admin cookie to 1. |
| CVE-2008-6291 | Web-based email list manager allows attackers to gain admin privileges by setting a login cookie to "admin." |

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2023-3050 | Authentication Bypass in TMT's Lockcell | critical | 9.8 | - | No | 2023-06-13 |
| CVE-2026-60134 | Weintek cMT3092X Reliance on Cookies without Validation and Integrity Checking in a Security Decision | high | 8.7 | - | No | 2026-07-24 |
| CVE-2024-9820 | WP 2FA with Telegram \<= 3.0 - Two-Factor Authentication Bypass | high | 7.5 | - | No | 2024-10-15 |
| CVE-2020-8184 | Rack allows Percent-encoded cookies to overwrite existing prefixed cookie names | high | 7.5 | - | No | 2020-06-19 |
| CVE-2022-3083 | Reliance on Cookies without Validation and Integrity Checking in a Security Decision in Landis+Gyr E850 | medium | 5.4 | - | No | 2023-02-01 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-565](https://radicalnotion.ai/cwe/cwe-565) | Reliance on Cookies without Validation and Integrity Checking |
| Parent | [CWE-807](https://radicalnotion.ai/cwe/cwe-807) | Reliance on Untrusted Inputs in a Security Decision |

## Frequently asked questions

### What is CWE-784?

The product uses a protection mechanism that relies on the existence or values of a cookie, but it does not properly ensure that the cookie is valid for the associated user.

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

5 recorded CVEs are attributed to CWE-784, including CVE-2023-3050, CVE-2026-60134 and CVE-2024-9820.

### How do you prevent CWE-784?

Avoid using cookie data for a security-related decision.

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

Exploiting CWE-784 can lead to: Bypass Protection Mechanism, Gain Privileges or Assume Identity.

### Is CWE-784 actively exploited?

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

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

---

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