<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Vm2 (&lt;= 3.10.5) — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/vm2--3.10.5/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata — refreshed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Thu, 07 May 2026 04:26:39 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/vm2--3.10.5/feed.xml" rel="self" type="application/rss+xml"/><item><title>vm2 Sandbox Escape via Buffer.alloc Memory Exhaustion</title><link>https://feed.craftedsignal.io/briefs/2024-01-03-vm2-buffer-alloc-dos/</link><pubDate>Thu, 07 May 2026 04:26:39 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-03-vm2-buffer-alloc-dos/</guid><description>A vulnerability exists in the vm2 npm package (&lt;= 3.10.5) where sandboxed code can bypass the timeout protection by calling Buffer.alloc() with an arbitrary size, leading to memory exhaustion on the host system.</description><content:encoded><![CDATA[<p>The vm2 npm package, a sandbox environment for executing untrusted JavaScript code, is susceptible to a denial-of-service attack.  Specifically, versions 3.10.5 and earlier allow sandboxed code to bypass the configured timeout by calling <code>Buffer.alloc()</code> with a large, attacker-controlled size. Because <code>Buffer.alloc</code> is a synchronous C++ native call, vm2&rsquo;s <code>timeout</code> option cannot interrupt it.  This bypass enables a malicious actor to exhaust the host system&rsquo;s memory, leading to a crash. This is particularly impactful in memory-constrained environments like Docker containers, Kubernetes pods, and serverless functions (e.g., AWS Lambda), where a single request can trigger an out-of-memory (OOM) error, resulting in service disruption. The amplification factor can be significant, with a small HTTP request (e.g., 100 bytes) triggering a large memory allocation (e.g., 100MB+).</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker sends a malicious HTTP request to an application using vm2.</li>
<li>The request contains JavaScript code intended for execution within the vm2 sandbox via an API endpoint (e.g. <code>/api/execute</code>).</li>
<li>The malicious JavaScript code leverages <code>Buffer.alloc()</code> with a large size (e.g., <code>Buffer.alloc(1024*1024*100)</code>).</li>
<li>The <code>Buffer.alloc()</code> call is proxied to the host environment through the bridge proxy in <code>lib/bridge.js</code> without size validation.</li>
<li>The host system attempts to allocate the requested memory synchronously.</li>
<li>In memory-constrained environments, the allocation exceeds available resources.</li>
<li>The Node.js process crashes with a <code>FATAL ERROR: Reached heap limit</code> due to JavaScript heap exhaustion.</li>
<li>The application becomes unavailable, resulting in a denial-of-service condition.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>This vulnerability allows for denial-of-service (DoS) attacks. A single HTTP request containing malicious JavaScript code can crash the host Node.js process by exhausting its memory. The severity of the impact depends on the environment.  In memory-constrained environments such as Docker containers or Kubernetes pods, the attack causes immediate process termination. Even in unconstrained environments where the memory allocation might succeed and be reclaimed, the attack can cause temporary performance degradation. The vulnerability affects all applications using vm2 version 3.10.5 or earlier in its default configuration.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade to a patched version of the <code>vm2</code> package that addresses this vulnerability.</li>
<li>Apply rate limiting to the API endpoints that execute code within the vm2 sandbox to mitigate the impact of potential attacks.</li>
<li>Monitor application logs for <code>FATAL ERROR: Reached heap limit</code> messages, which may indicate exploitation attempts.</li>
<li>Deploy the Sigma rule to detect suspicious calls to Buffer.alloc with unusually large sizes.</li>
<li>Implement resource limits (e.g., memory limits) for processes running vm2 to prevent complete system exhaustion.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>sandbox-escape</category><category>dos</category><category>memory-exhaustion</category><category>vm2</category></item><item><title>vm2 Sandbox Escape via Promise Constructor Unhandled Rejection</title><link>https://feed.craftedsignal.io/briefs/2024-01-vm2-sandbox-escape/</link><pubDate>Wed, 03 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-vm2-sandbox-escape/</guid><description>A sandbox escape vulnerability exists in vm2 versions 3.10.5 and earlier that allows sandboxed code to crash the host Node.js process via a Promise constructor that triggers an unhandled rejection, leading to a denial-of-service condition.</description><content:encoded><![CDATA[<p>A sandbox escape vulnerability has been identified in vm2 versions 3.10.5 and earlier. This vulnerability enables malicious sandboxed code to crash the host Node.js process through a crafted <code>Promise</code> constructor that triggers an unhandled rejection. The root cause lies in the fact that Promise executor errors are not adequately caught and sanitized before they can propagate as unhandled rejections to the host process. This results in an immediate process crash, effectively causing a denial-of-service condition. Notably, the <code>allowAsync: false</code> setting, intended to mitigate asynchronous code execution, does not prevent this vulnerability and, paradoxically, can exacerbate the issue by blocking <code>.catch()</code> handlers, thereby guaranteeing that rejections remain unhandled. The CVE-2026-22709 patch (v3.10.2) only sanitized <code>.then()</code> and <code>.catch()</code> callback chains but left the executor-to-unhandledRejection path completely open.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker crafts malicious JavaScript code designed to be executed within a vm2 sandbox.</li>
<li>The malicious code constructs a <code>Promise</code> object using the <code>Promise</code> constructor.</li>
<li>Within the <code>Promise</code> executor function, an <code>Error</code> object is created.</li>
<li>The <code>Error</code> object&rsquo;s <code>name</code> property is set to a <code>Symbol()</code>.</li>
<li>The code then attempts to access the <code>stack</code> property of the <code>Error</code> object, triggering V8&rsquo;s internal <code>FormatStackTrace</code> function.</li>
<li><code>FormatStackTrace</code> attempts <code>Symbol.toString()</code>, resulting in a host-realm <code>TypeError</code>.</li>
<li>Because no <code>.catch()</code> handler is attached, the error becomes an unhandled rejection.</li>
<li>The unhandled rejection propagates to the host Node.js process, causing it to crash.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability leads to a denial-of-service (DoS) condition. A single malicious request can crash the entire host Node.js process, disrupting service for all concurrent users. The persistent nature of this DoS, coupled with the ease of triggering it, renders the application unavailable even with standard recovery mechanisms like Docker restart policies or Kubernetes liveness probes. The attacker only needs to send a small request (approximately 150 bytes) to bring down the entire server, demonstrating a high amplification factor. All applications using vm2 are vulnerable, regardless of the <code>allowAsync</code> setting.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade to a patched version of vm2 that addresses this vulnerability. As of this writing, no patched version exists, but monitor the project for updates.</li>
<li>Implement rate limiting on API endpoints that execute user-provided JavaScript code to reduce the impact of DoS attacks.</li>
<li>Deploy the Sigma rule &ldquo;Detect vm2 Sandbox Escape Attempt via Symbol Error Name&rdquo; to identify attempts to exploit this vulnerability within your environment.</li>
<li>Monitor application logs for unhandled promise rejections, which could indicate exploitation attempts.</li>
<li>Consider implementing a custom error handler within the vm2 sandbox to catch and sanitize errors before they can propagate to the host process.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>vm2</category><category>sandbox-escape</category><category>denial-of-service</category><category>nodejs</category></item></channel></rss>