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.
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; }setValueByPath({}, "__proto__.isAdmin", true) setValueByPath({}, "constructor.prototype.isAdmin", true)Vulnerabilities classified as CWE-1321 represent 142 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.