| Impact | Details |
|---|---|
|
Read Application Data; Modify Application Data |
Scope: Confidentiality, Integrity, Availability
Likelihood: 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).
|
|
DoS: Crash, Exit, or Restart |
Scope: Availability
Likelihood: High
An attacker can override existing attributes with ones that have incompatible type, which may lead to a crash.
|
| Phase(s) | Mitigation |
|---|---|
|
Implementation |
By freezing the object prototype first (for example, Object.freeze(Object.prototype)), modification of the prototype becomes impossible.
Effectiveness: High Note:
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 |
Strategy: 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 |
| Nature | Type | ID | Name |
|---|---|---|---|
| ChildOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 915 | Improperly Controlled Modification of Dynamically-Determined Object Attributes |
| CanPrecede | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 471 | Modification of Assumed-Immutable Data (MAID) |
| Nature | Type | ID | Name |
|---|---|---|---|
| ChildOf | Class Class - a weakness that is described in a very abstract fashion, typically independent of any specific language or technology. More specific than a Pillar Weakness, but more general than a Base Weakness. Class level weaknesses typically describe issues in terms of 1 or 2 of the following dimensions: behavior, property, and resource. | 913 | Improper Control of Dynamically-Managed Code Resources |
| 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. |
JavaScript (Undetermined Prevalence)
Example 1
This function sets object attributes based on a dot-separated path.
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.
By using a denylist of dangerous attributes, this weakness can be eliminated.
Note: this is a curated list of examples for users to understand the variety of ways in which this weakness can be introduced. It is not a complete list of all CVEs that are related to this CWE entry.
| Reference | Description |
|---|---|
|
Prototype pollution by merging objects.
|
|
|
Prototype pollution by setting default values to object attributes recursively.
|
|
|
Prototype pollution by merging objects recursively.
|
|
|
Prototype pollution by setting object attributes based on dot-separated path.
|
| Nature | Type | ID | Name |
|---|---|---|---|
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1415 | Comprehensive Categorization: Resource Control |
Rationale
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.Comments
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.| Submissions | ||
|---|---|---|
| Submission Date | Submitter | Organization |
|
2020年08月25日
(CWE 4.3, 2020年12月10日) |
Anonymous External Contributor | |
| Modifications | ||
| Modification Date | Modifier | Organization |
|
2025年09月09日
(CWE 4.18, 2025年09月09日) |
CWE Content Team | MITRE |
| updated Common_Consequences, Description, Diagram, Modes_of_Introduction | ||
|
2024年02月29日
(CWE 4.14, 2024年02月29日) |
CWE Content Team | MITRE |
| updated Demonstrative_Examples | ||
| 2023年06月29日 | CWE Content Team | MITRE |
| updated Mapping_Notes | ||
| 2023年04月27日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2023年01月31日 | CWE Content Team | MITRE |
| updated Description | ||
| 2021年10月28日 | CWE Content Team | MITRE |
| updated Relationships | ||
Use of the Common Weakness Enumeration (CWE™) and the associated references from this website are subject to the Terms of Use. CWE is sponsored by the U.S. Department of Homeland Security (DHS) Cybersecurity and Infrastructure Security Agency (CISA) and managed by the Homeland Security Systems Engineering and Development Institute (HSSEDI) which is operated by The MITRE Corporation (MITRE). Copyright © 2006–2025, The MITRE Corporation. CWE, CWSS, CWRAF, and the CWE logo are trademarks of The MITRE Corporation.