CVE-2026-22709: CWE-94: Improper Control of Generation of Code ('Code Injection') in patriksimek vm2
vm2 is an open source vm/sandbox for Node.js. In vm2 prior to version 3.10.2, `Promise.prototype.then` `Promise.prototype.catch` callback sanitization can be bypassed. This allows attackers to escape the sandbox and run arbitrary code. In lib/setup-sandbox.js, the callback function of `localPromise.prototype.then` is sanitized, but `globalPromise.prototype.then` is not sanitized. The return value of async functions is `globalPromise` object. Version 3.10.2 fixes the issue.
AI Analysis
Technical Summary
The vulnerability CVE-2026-22709 affects vm2, an open-source sandbox library for Node.js designed to safely execute untrusted code. The root cause is improper control over code generation, specifically a code injection flaw (CWE-94). In vm2 versions before 3.10.2, the sanitization mechanism intended to prevent malicious code execution in Promise callbacks is incomplete. The library sanitizes the callback function of localPromise.prototype.then but neglects to sanitize globalPromise.prototype.then. Since async functions return globalPromise objects, attackers can exploit this discrepancy to bypass the sandbox's security controls. This allows arbitrary code execution outside the sandbox environment, potentially compromising the host system. The vulnerability is exploitable remotely without authentication or user interaction, as indicated by the CVSS vector (AV:N/AC:L/PR:N/UI:N). The impact spans confidentiality, integrity, and availability, making it a critical security risk. The fix was introduced in vm2 version 3.10.2, which properly sanitizes all Promise callbacks to close this bypass. No known exploits have been reported yet, but the high severity and ease of exploitation make timely patching imperative.
Potential Impact
For European organizations, this vulnerability poses a significant threat, especially those leveraging vm2 for sandboxing untrusted or third-party JavaScript code in Node.js applications. Successful exploitation can lead to full system compromise, data breaches, and disruption of critical services. Sectors such as finance, healthcare, telecommunications, and government agencies that rely on secure code execution environments are particularly vulnerable. The ability to execute arbitrary code without authentication or user interaction increases the risk of widespread exploitation, potentially affecting cloud services, internal applications, and developer tools. The breach of sandbox isolation can also facilitate lateral movement within networks, exacerbating the impact. Given the critical CVSS score and the nature of the vulnerability, organizations face risks to confidentiality, integrity, and availability of their systems and data.
Mitigation Recommendations
Organizations should immediately upgrade vm2 to version 3.10.2 or later, where the vulnerability is patched. For environments where immediate upgrading is not feasible, consider disabling or restricting the use of vm2 sandboxes, especially in contexts processing untrusted code. Implement strict code review and validation processes for any code executed within vm2. Employ runtime monitoring and anomaly detection to identify suspicious behavior indicative of sandbox escape attempts. Additionally, isolate systems running vm2 sandboxes using network segmentation and least privilege principles to limit potential damage. Regularly audit dependencies and maintain an up-to-date inventory of Node.js packages to quickly identify vulnerable versions. Finally, educate developers and security teams about the risks associated with sandbox bypass vulnerabilities and the importance of timely patching.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Italy, Spain, Poland
CVE-2026-22709: CWE-94: Improper Control of Generation of Code ('Code Injection') in patriksimek vm2
Description
vm2 is an open source vm/sandbox for Node.js. In vm2 prior to version 3.10.2, `Promise.prototype.then` `Promise.prototype.catch` callback sanitization can be bypassed. This allows attackers to escape the sandbox and run arbitrary code. In lib/setup-sandbox.js, the callback function of `localPromise.prototype.then` is sanitized, but `globalPromise.prototype.then` is not sanitized. The return value of async functions is `globalPromise` object. Version 3.10.2 fixes the issue.
AI-Powered Analysis
Technical Analysis
The vulnerability CVE-2026-22709 affects vm2, an open-source sandbox library for Node.js designed to safely execute untrusted code. The root cause is improper control over code generation, specifically a code injection flaw (CWE-94). In vm2 versions before 3.10.2, the sanitization mechanism intended to prevent malicious code execution in Promise callbacks is incomplete. The library sanitizes the callback function of localPromise.prototype.then but neglects to sanitize globalPromise.prototype.then. Since async functions return globalPromise objects, attackers can exploit this discrepancy to bypass the sandbox's security controls. This allows arbitrary code execution outside the sandbox environment, potentially compromising the host system. The vulnerability is exploitable remotely without authentication or user interaction, as indicated by the CVSS vector (AV:N/AC:L/PR:N/UI:N). The impact spans confidentiality, integrity, and availability, making it a critical security risk. The fix was introduced in vm2 version 3.10.2, which properly sanitizes all Promise callbacks to close this bypass. No known exploits have been reported yet, but the high severity and ease of exploitation make timely patching imperative.
Potential Impact
For European organizations, this vulnerability poses a significant threat, especially those leveraging vm2 for sandboxing untrusted or third-party JavaScript code in Node.js applications. Successful exploitation can lead to full system compromise, data breaches, and disruption of critical services. Sectors such as finance, healthcare, telecommunications, and government agencies that rely on secure code execution environments are particularly vulnerable. The ability to execute arbitrary code without authentication or user interaction increases the risk of widespread exploitation, potentially affecting cloud services, internal applications, and developer tools. The breach of sandbox isolation can also facilitate lateral movement within networks, exacerbating the impact. Given the critical CVSS score and the nature of the vulnerability, organizations face risks to confidentiality, integrity, and availability of their systems and data.
Mitigation Recommendations
Organizations should immediately upgrade vm2 to version 3.10.2 or later, where the vulnerability is patched. For environments where immediate upgrading is not feasible, consider disabling or restricting the use of vm2 sandboxes, especially in contexts processing untrusted code. Implement strict code review and validation processes for any code executed within vm2. Employ runtime monitoring and anomaly detection to identify suspicious behavior indicative of sandbox escape attempts. Additionally, isolate systems running vm2 sandboxes using network segmentation and least privilege principles to limit potential damage. Regularly audit dependencies and maintain an up-to-date inventory of Node.js packages to quickly identify vulnerable versions. Finally, educate developers and security teams about the risks associated with sandbox bypass vulnerabilities and the importance of timely patching.
Affected Countries
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-01-08T19:23:09.857Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 69790cec4623b1157c4004b0
Added to database: 1/27/2026, 7:07:24 PM
Last enriched: 1/27/2026, 7:09:13 PM
Last updated: 1/27/2026, 10:13:21 PM
Views: 4
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2026-24770: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in infiniflow ragflow
CriticalCVE-2024-1545: CWE-1256: Improper Restriction of Software Interfaces to Hardware Features in WolfSSL wolfCrypt
MediumCVE-2026-24779: CWE-918: Server-Side Request Forgery (SSRF) in vllm-project vllm
HighCVE-2026-24778: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in TryGhost Ghost
HighCVE-2026-24765: CWE-502: Deserialization of Untrusted Data in sebastianbergmann phpunit
HighActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.