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.

Primary

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.

Confidentiality
Integrity
Availability
Read Application Data
Modify Application Data
High
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
High
An attacker can override existing attributes with ones that have incompatible type, which may lead to a crash.

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.)
High

Implementation
By freezing the object prototype first (for example, Object.freeze(Object.prototype)), modification of the prototype becomes impossible.
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.
High

Implementation
Input Validation
When handling untrusted objects, validating using a schema can be used.
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.
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.
Moderate

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

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;
}

This function does not check if the attribute resolves to the object prototype. These codes can be used to add "isAdmin: true" to the object prototype.

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

By using a denylist of dangerous attributes, this weakness can be eliminated.

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;
}

CVE-2018-3721
Prototype pollution by merging objects.
https://www.cve.org/CVERecord?id=CVE-2018-3721

CVE-2019-10744
Prototype pollution by setting default values to object attributes recursively.
https://www.cve.org/CVERecord?id=CVE-2019-10744

CVE-2019-11358
Prototype pollution by merging objects recursively.
https://www.cve.org/CVERecord?id=CVE-2019-11358

CVE-2020-8203
Prototype pollution by setting object attributes based on dot-separated path.
https://www.cve.org/CVERecord?id=CVE-2020-8203

Allowed
This CWE entry is at the Variant level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.
Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.

Anonymous External Contributor
2020-08-25
4.3
2020-12-10

CWE Content Team
MITRE
2021-10-28
updated Relationships

CWE Content Team
MITRE
2023-01-31
updated Description

CWE Content Team
MITRE
2023-04-27
updated Relationships

CWE Content Team
MITRE
2023-06-29
updated Mapping_Notes

CWE Content Team
MITRE
2024-02-29
4.14
2024-02-29
updated Demonstrative_Examples

CWE Content Team
MITRE
2025-09-09
4.18
2025-09-09
updated Common_Consequences, Description, Diagram, Modes_of_Introduction

CWE Content Team
MITRE
2025-12-11
4.19
2025-12-11
updated Detection_Factors, Weakness_Ordinalities