Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CWE-1321 — Vulnerability Class 142

142 vulnerabilities classified as CWE-1321. AI Chinese analysis included.

CWE-1321 represents a critical vulnerability where applications fail to restrict modifications to an object’s prototype attributes, allowing attackers to inject malicious properties into the global prototype chain. This weakness is typically exploited by crafting specific input payloads that target JavaScript objects, enabling the injection of arbitrary keys such as constructor or prototype references. Successful exploitation can lead to severe consequences, including remote code execution, denial of service, or privilege escalation, as the injected properties affect all subsequent instances of the affected object. To mitigate this risk, developers must implement strict input validation, utilize libraries that freeze prototypes, or employ object creation methods that do not inherit from the global prototype, such as Object.create(null). Additionally, avoiding the use of unsafe recursive merge functions and sanitizing user-controlled data before processing are essential practices for preventing prototype pollution attacks in modern web applications.

MITRE 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.
Common Consequences (2)
Confidentiality, Integrity, AvailabilityRead 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 …
AvailabilityDoS: Crash, Exit, or Restart
An attacker can override existing attributes with ones that have incompatible type, which may lead to a crash.
Mitigations (5)
ImplementationBy freezing the object prototype first (for example, Object.freeze(Object.prototype)), modification of the prototype becomes impossible.
Effectiveness: High
Architecture and DesignBy blocking modifications of attributes that resolve to object prototype, such as proto or prototype, this weakness can be mitigated.
Effectiveness: High
ImplementationWhen handling untrusted objects, validating using a schema can be used.
Effectiveness: Limited
ImplementationBy 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
ImplementationMap 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
Examples (1)
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; }
Bad · JavaScript
setValueByPath({}, "__proto__.isAdmin", true) setValueByPath({}, "constructor.prototype.isAdmin", true)
Bad · JavaScript
CVE IDTitleCVSSSeverityPublished
CVE-2020-36632 hughsk flat index.js unflatten prototype pollution — flat 6.3 Medium2022-12-25
CVE-2021-4278 cronvel tree-kit prototype pollution — tree-kit 5.5 Medium2022-12-25
CVE-2022-46175 Tauri 安全漏洞 — json5 7.1 High2022-12-24
CVE-2021-4264 LinkedIn dustjs prototype pollution — dustjs 6.3 Medium2022-12-21
CVE-2022-39396 Parse Server vulnerable to Remote Code Execution via prototype pollution in MongoDB BSON parser — parse-server 9.8 Critical2022-11-10
CVE-2022-41879 Parse Server subject to Prototype pollution via Cloud Code Webhooks — parse-server 7.2 High2022-11-10
CVE-2022-39357 Winter vulnerable to Prototype Pollution in Snowboard framework — winter 8.1 High2022-10-26
CVE-2022-29823 Feathers - Query “__proto__” is converted to real prototype — Feathers-Sequalize 10.0 Critical2022-10-25
CVE-2022-2564 Prototype Pollution in automattic/mongoose — automattic/mongoose 9.8 -2022-07-28
CVE-2022-1295 Prototype Pollution in alvarotrigo/fullpage.js — alvarotrigo/fullpage.js 9.8 -2022-04-11
CVE-2022-0432 Prototype Pollution in mastodon/mastodon — mastodon/mastodon 9.6 -2022-02-02
CVE-2021-3815 Prototype Pollution in fabiocaccamo/utils.js — fabiocaccamo/utils.js 9.8 -2021-12-08
CVE-2021-3918 Prototype Pollution in kriszyp/json-schema — kriszyp/json-schema 9.8 -2021-11-13
CVE-2021-41097 Prototype pollution in aurelia-path — path 9.1 Critical2021-09-27
CVE-2021-39227 Fix prototype pollution in the zrender merge and clone helper methods — zrender 6.2 Medium2021-09-17
CVE-2021-3805 Prototype Pollution in mariocasciaro/object-path — mariocasciaro/object-path 9.1 -2021-09-17
CVE-2021-3666 Prototype Pollution in fiznool/body-parser-xml — fiznool/body-parser-xml 9.8 -2021-09-13
CVE-2021-3645 Prototype Pollution in viking04/merge — viking04/merge 9.8 -2021-09-10
CVE-2021-3766 Prototype Pollution in vincit/objection.js — vincit/objection.js 9.8 -2021-09-06
CVE-2021-3757 Prototype Pollution in immerjs/immer — immerjs/immer 9.8 -2021-09-02
CVE-2021-32736 Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') in think-helper — think-helper 7.5 High2021-06-30
CVE-2021-21297 Prototype Pollution in Node-Red — node-red 7.7 High2021-02-26

Vulnerabilities classified as CWE-1321 represent 142 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.