Skip to main content

Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')


Severity High
Score 8.2/10


All versions of the package mockjs are vulnerable to Prototype Pollution via the "Util.extend" function due to missing checks if the attribute resolves to the object prototype. By adding or modifying attributes of an object prototype, it is possible to create attributes that exist on every object or replace critical attributes with malicious ones. This can be problematic if the software depends on the existence or non-existence of certain attributes, or uses pre-defined attributes of object prototype (such as "hasOwnProperty", "toString" or "valueOf"). User controlled inputs inside the "extend()" method of the "Mock.Handler", "Mock.Random", "Mock.RE.Handler" or "Mock.Util", will allow an attacker to exploit this vulnerability. Workaround By using a denylist of dangerous attributes, this weakness can be eliminated.

  • LOW
  • LOW
  • NONE
  • NONE
  • NONE
  • HIGH

CWE-1321 - Prototype Pollution

Prototype pollution is one of the lesser-known vulnerabilities. It allows attackers to abuse the rules of JavaScript by injecting properties into the general object “Object” in JS. Modifying the prototype of “Object” affects the behavior of all objects in the entire app, potentially resulting in denial of service, arbitrary code execution, cross-site scripting, etc.


Advisory Timeline

  • Published