undefsafe@1.2.0 vulnerabilities

Undefined safe way of extracting object properties

Direct Vulnerabilities

Known vulnerabilities in the undefsafe package. This does not include vulnerabilities belonging to this package’s dependencies.

Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.
Fix for free
Vulnerability Vulnerable Version
  • M
Prototype Pollution

undefsafe is a Simple function for retrieving deep object properties without getting "Cannot read property 'X' of undefined".

Affected versions of this package are vulnerable to Prototype Pollution. The a function could be tricked into adding or modifying properties of Object.prototype using a __proto__ payload.

PoC by JHU System Security Lab

var a = require("undefsafe");
var payload = "__proto__.toString";
a({},payload,"JHU");
console.log({}.toString);

How to fix Prototype Pollution?

Upgrade undefsafe to version 2.0.3 or higher.

<2.0.3