# Critical remote code execution in vm2, a widely used Node.js sandbox library

DevFeed: [Critical remote code execution in vm2, a widely used Node.js sandbox library](<https://devfeed.tech/articles/critical-remote-code-execution-in-vm2-a-widely-used-node-js-sandbox-library-87.md>)

Original publisher: [Read original article](<https://about.gitlab.com/blog/critical-remote-code-execution-in-vm2/>)

Author: Daniel Abeles

Published: 2026-09-02T00:00:00Z

Content type: news

Language: en

Sources: [GitLab](<https://devfeed.tech/sources/gitlab.md>)

Topics: [vulnerability](<https://devfeed.tech/topics/vulnerability.md>), [Node.js](<https://devfeed.tech/topics/node-js.md>), [configuration](<https://devfeed.tech/topics/configuration.md>), [Threat Research](<https://devfeed.tech/topics/threat-research.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [containers](<https://devfeed.tech/tags/containers.md>), [node-js](<https://devfeed.tech/tags/node-js.md>), [processes](<https://devfeed.tech/tags/processes.md>), [sandbox](<https://devfeed.tech/tags/sandbox.md>), [security](<https://devfeed.tech/tags/security.md>), [security-labs](<https://devfeed.tech/tags/security-labs.md>), [threat-research](<https://devfeed.tech/tags/threat-research.md>), [update](<https://devfeed.tech/tags/update.md>), [vulnerability](<https://devfeed.tech/tags/vulnerability.md>)

## AI overview

GitLab reports a critical vm2 sandbox escape that can enable remote code execution. Version 3.11.7 blocks the reported attack, but the article advises hardening require.root and context settings and avoiding vm2 for truly untrusted code.

## Source excerpt

GitLab's Threat Research Group found a critical sandbox escape vulnerability in vm2, one of the most widely adopted Node.js sandboxing libraries. The vulnerability uses a configuration copied straight from vm2's own README. We found the flaw, rated CVSS 3.1: 10.0, critical, using our own AI automated tools. Anyone running vm2 Version 3.11.6 or earlier with require.external turned on should treat this as directly exploitable. Once we found the vulnerability, we verified GitLab does not use vm2. We also reported it privately to vm2 and the maintainer fixed it fast, in vm2 Version 3.11.7. When we tested that fix again, it blocked the exact attack we reported. For anyone relying on vm2, it's worth flagging that there's a broader configuration risk here that goes beyond this one patch, based on the maintainer's own description of the fix. TL;DR Critical vulnerability: GitLab's Threat Research Group discovered a critical sandbox escape (CVSS 3.1: 10.0) in vm2, a widely used Node.js sandboxing library, which allows for remote code execution. The root cause: The vulnerability stems from default configurations found in the library's own "Quick Examples" README, where the sandbox fails to properly isolate itself from the host system, allowing malicious code to gain unrestricted access. Fix limitations: While updating to Version 3.11.7 blocks the specific attack reported, it does not fully resolve the underlying configuration risk; developers remain vulnerable if they continue to use require.external with overly broad require.root settings. Immediate recommendations: Users should update to Version 3.11.7, but must also manually harden their configurations by restricting require.root to only necessary files and setting context: 'sandbox' instead of relying on the default 'host' setting. Long-term advice: Due to vm2's history of recurring sandbox escape bugs, it is recommended to avoid using it for isolating truly untrusted code and instead opt for more robust methods like conta