Description
The software 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.
Modes of Introduction:
– Architecture and Design
Related Weaknesses
Consequences
Integrity: Modify Application Data
An attacker can inject attributes that are used in other components.
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
Phase: Implementation
Effectiveness: High
Description:
By freezing the object prototype first (for example, Object.freeze(Object.prototype)), modification of the prototype becomes impossible.
While this can mitigate this weakness completely, other methods are recommended when possible, especially in components used by upstream software (“libraries”).
Phase: Architecture and Design
Effectiveness: High
Description:
By blocking modifications of attributes that resolve to object prototype, such as proto or prototype, this weakness can be mitigated.
Phase: Implementation
Effectiveness: Limited
Description:
When handling untrusted objects, validating using a schema can be used.
Phase: Implementation
Effectiveness: High
Description:
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.
Phase: Implementation
Effectiveness: Moderate
Description:
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.
CVE References
- 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.
More Stories
The Most Dangerous Vulnerabilities in Apache Tomcat and How to Protect Against Them
Apache Tomcat is an open-source web server and servlet container that is widely used in enterprise environments to run Java...
ZDI-CAN-18333: A Critical Zero-Day Vulnerability in Microsoft Windows
Zero-day vulnerabilities are a serious threat to cybersecurity, as they can be exploited by malicious actors to gain unauthorized access...
CWE-669 – Incorrect Resource Transfer Between Spheres
Description The product does not properly transfer a resource/behavior to another sphere, or improperly imports a resource/behavior from another sphere,...
CWE-67 – Improper Handling of Windows Device Names
Description The software constructs pathnames from user input, but it does not handle or incorrectly handles a pathname containing a...
CWE-670 – Always-Incorrect Control Flow Implementation
Description The code contains a control flow path that does not reflect the algorithm that the path is intended to...
CWE-671 – Lack of Administrator Control over Security
Description The product uses security features in a way that prevents the product's administrator from tailoring security settings to reflect...