Executive brief
expand-object is a Node.js library that converts strings into JavaScript objects. A prototype pollution vulnerability in its expand() function allows attackers to inject arbitrary properties into the base Object prototype without authentication or user interaction, potentially affecting all objects created in the application. This can lead to data tampering, denial of service, or in some cases remote code execution if the application evaluates polluted properties.
Technical details
The vulnerability is a prototype pollution issue (CWE-1321) in the expand() function (index.js line 13) of expand-object versions 0.0.0 through 0.4.2. The function expands a string into an object by parsing property paths (e.g., "__proto__.polluted:value") without validating or filtering sensitive keys like __proto__, constructor, or prototype. An unauthenticated attacker with network access can invoke this function with a crafted string to inject properties into Object.prototype, poisoning the prototype chain. The attack is trivial to perform: `expand("__proto__.polluted:Polluted!")` makes the polluted property available to all objects. Impact ranges from denial of service (if polluted properties break application logic) to property injection attacks (tampering with security-relevant values like isAdmin) to remote code execution (if the application evaluates polluted properties). No patch is currently available for this library.
Affected products
- jonschlinkert expand-object 0.0.0 through 0.4.2
Timeline
- 2023-08-06: disclosed
- 2025-04-04: advisory