---
title: "CWE-1321: Improperly Controlled Modification of Object Prototype Attributes"
url: https://radicalnotion.ai/cwe/cwe-1321
type: cwe
description: "The product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-1321: Improperly Controlled Modification of Object Prototype Attributes

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Incomplete
- **CVEs with this as primary weakness:** 610
- **Of those, in CISA KEV:** 1
- **New in 2026:** 203
- **CWE catalog version:** 4.21

## Description

The product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.

## Alternate terms

- Prototype Pollution

## Modes of introduction

| Phase | Note |
| --- | --- |
| Architecture and Design | - |
| Implementation | This weakness is often found in code that assigns object attributes based on user input, or merges or clones objects recursively. |

## Applicable platforms

**Languages:** JavaScript (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality, Integrity, Availability | Read Application Data, Modify Application Data | This weakness is usually exploited by using a special attribute of objects called proto, constructor, or prototype. Such attributes give access to the object prototype. An attacker can inject attributes that are used in other components by adding or modifying attributes of an object prototype. This creates attributes that exist on every object, or replace critical attributes with malicious ones. This can be problematic if the product depends on existence or non-existence of certain attributes, or uses pre-defined attributes of the object prototype (such as hasOwnProperty, toString, or valueOf). |
| Availability | DoS: Crash, Exit, or Restart | An attacker can override existing attributes with ones that have incompatible type, which may lead to a crash. |

## Potential mitigations

### Implementation

By freezing the object prototype first (for example, Object.freeze(Object.prototype)), modification of the prototype becomes impossible.

Effectiveness: High. While this can mitigate this weakness completely, other methods are recommended when possible, especially in components used by upstream software ("libraries").

### Architecture and Design

By blocking modifications of attributes that resolve to object prototype, such as proto or prototype, this weakness can be mitigated.

Effectiveness: High

### Implementation (Input Validation)

When handling untrusted objects, validating using a schema can be used.

Effectiveness: Limited

### Implementation

By using an object without prototypes (via Object.create(null) ), adding object prototype attributes by accessing the prototype via the special attributes becomes impossible, mitigating this weakness.

Effectiveness: High

### Implementation

Map can be used instead of objects in most cases. If Map methods are used instead of object attributes, it is not possible to access the object prototype or modify it.

Effectiveness: Moderate

## 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

This function sets object attributes based on a dot-separated path.

Bad code:

```javascript
function setValueByPath (object, path, value) {
    const pathArray = path.split(".");
    const attributeToSet = pathArray.pop();
    let objectToModify = object;
    for (const attr of pathArray) {
        if (typeof objectToModify[attr] !== 'object') {
            objectToModify[attr] = {};
            }

        objectToModify = objectToModify[attr];
        }

    objectToModify[attributeToSet] = value;
    return object;
    }
```

Bad code:

```javascript
setValueByPath({}, "__proto__.isAdmin", true)
setValueByPath({}, "constructor.prototype.isAdmin", true)
```

Good code:

```javascript
function setValueByPath (object, path, value) {
    const pathArray = path.split(".");
    const attributeToSet = pathArray.pop();
    let objectToModify = object;
    for (const attr of pathArray) {
        // Ignore attributes which resolve to object prototype
        if (attr === "__proto__" || attr === "constructor" || attr === "prototype") {
            continue;
            }
        if (typeof objectToModify[attr] !== "object") {
            objectToModify[attr] = {};
            }
        objectToModify = objectToModify[attr];
        }
    objectToModify[attributeToSet] = value;
    return object;
    }
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2018-3721 | Prototype pollution by merging objects. |
| CVE-2019-10744 | Prototype pollution by setting default values to object attributes recursively. |
| CVE-2019-11358 | Prototype pollution by merging objects recursively. |
| CVE-2020-8203 | Prototype pollution by setting object attributes based on dot-separated path. |

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

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-34621 | Acrobat Reader \| Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') (CWE-1321) | critical | 9.3 | - | Yes | 2026-04-11 |
| CVE-2026-44005 | vm2: Sandbox escape | critical | 10.0 | - | No | 2026-05-13 |
| CVE-2026-42231 | n8n: Prototype Pollution in XML Webhook Body Parser Leads to RCE | critical | 10.0 | - | No | 2026-05-04 |
| CVE-2026-25881 | @nyariv/sandboxjs has host prototype pollution from sandbox via array intermediary (sandbox escape) | critical | 10.0 | - | No | 2026-02-09 |
| CVE-2026-25150 | Prototype Pollution via FormData Processing in Qwik City | critical | 10.0 | - | No | 2026-02-03 |
| CVE-2023-26121 | safe-eval vulnerable to Prototype Pollution via the safeEval function | critical | 10.0 | - | No | 2023-04-11 |
| CVE-2022-29823 | Feathers - Query “\_\_proto\_\_” is converted to real prototype | critical | 10.0 | - | No | 2022-10-25 |
| CVE-2021-23594 | Sandbox Bypass | critical | 10.0 | - | No | 2022-01-07 |
| CVE-2021-23449 | Sandbox Bypass | critical | 10.0 | - | No | 2021-10-18 |
| CVE-2020-12079 | - | critical | 10.0 | - | No | 2020-04-23 |
| CVE-2026-49252 | deepstream is vulnerable to prototype pollution | critical | 9.9 | - | No | 2026-06-18 |
| CVE-2026-32621 | Apollo Federation has prototype pollution via incomplete key sanitization | critical | 9.9 | - | No | 2026-03-13 |

## Related attack patterns (CAPEC)

- [CAPEC-1](https://radicalnotion.ai/capec/capec-1): Accessing Functionality Not Properly Constrained by ACLs
- [CAPEC-180](https://radicalnotion.ai/capec/capec-180): Exploiting Incorrectly Configured Access Control Security Levels
- [CAPEC-77](https://radicalnotion.ai/capec/capec-77): Manipulating User-Controlled Variables

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-913](https://radicalnotion.ai/cwe/cwe-913) | Improper Control of Dynamically-Managed Code Resources |
| Parent | [CWE-915](https://radicalnotion.ai/cwe/cwe-915) | Improperly Controlled Modification of Dynamically-Determined Object Attributes |
| Can precede | [CWE-471](https://radicalnotion.ai/cwe/cwe-471) | Modification of Assumed-Immutable Data (MAID) |

## Frequently asked questions

### What is CWE-1321?

The product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.

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

610 recorded CVEs are attributed to CWE-1321, including CVE-2026-34621, CVE-2026-44005 and CVE-2026-42231. 1 is listed in CISA's Known Exploited Vulnerabilities (KEV) catalog.

### How do you prevent CWE-1321?

By freezing the object prototype first (for example, Object.freeze(Object.prototype)), modification of the prototype becomes impossible.

### How is CWE-1321 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-1321?

Exploiting CWE-1321 can lead to: Read Application Data, Modify Application Data, DoS: Crash, Exit, or Restart.

### Is CWE-1321 actively exploited?

Yes. 1 CWE-1321 vulnerability is in CISA's KEV catalog of actively exploited flaws, out of 610 recorded CVEs.

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

---

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