Posted in

Critical isolated-vm Vulnerability Enables Node.js Sandbox Escape and Potential RCE

Cybersecurity researchers have disclosed a critical security vulnerability in isolated-vm, a widely used open-source Node.js library designed to safely execute untrusted JavaScript in isolated environments.

The flaw could allow malicious code running inside a sandbox to escape its isolation boundary, corrupt memory in the host process, and potentially hijack the host’s control flow, undermining the security model of applications that rely on the library to execute untrusted code.

The vulnerability, tracked as GHSA-864f-rcv7-6rh4, has not yet been assigned a CVE identifier. It affects isolated-vm versions 7.0.0 and earlier and has been addressed in versions 6.2.0 and 7.0.1, released earlier this month.

The project has more than 2,900 stars and 190 forks on GitHub, while its npm package recorded nearly 1 million downloads over the past week, highlighting its widespread use in JavaScript development environments.

isolated-vm Vulnerability Enables Sandbox Escape

isolated-vm is a Node.js library that allows developers to execute untrusted JavaScript inside V8 Isolates. These are independent instances of Google’s V8 JavaScript engine that can run concurrently while maintaining separate state and memory.

The isolation mechanism is intended to prevent code running inside a guest environment from accessing or interfering with the host application.

Because JavaScript objects cannot be directly transferred between the main Node.js thread and a worker isolate, isolated-vm provides a component called ExternalCopy. The component is responsible for serializing JavaScript values in one isolate and making them available in another.

Researchers from Endor Labs discovered that a type confusion vulnerability in this functionality can be abused by code running inside the sandbox to corrupt memory belonging to the host process.

“Starting from nothing but a single ivm.Reference, the standard way hosts hand a sandbox any capability at all, we escalated the bug from a controlled-address crash all the way to hijacking the host’s control flow, demonstrating a full guest-to-host sandbox escape,” Endor Labs researcher Cristian-Alexandru Staicu, who discovered and reported the issue, said in a technical analysis.

From Denial-of-Service to Potential Remote Code Execution

Successful exploitation can result in memory corruption within the host process. At a minimum, an attacker can trigger a reliable crash, causing the host application to terminate with a segmentation fault (SIGSEGV).

More seriously, researchers demonstrated that the vulnerability could be escalated into a guest-to-host sandbox escape, allowing code running within the isolated environment to gain control over the host process.

According to project maintainer Marcel Laverdet, the minimum demonstrated impact is a reliable, controlled-address denial-of-service condition that can be triggered by a guest possessing an ivm.Reference.

The maximum demonstrated impact is significantly more severe: control-flow hijacking of the host process, potentially resulting in remote code execution on the host.

This makes the vulnerability particularly concerning for applications that use isolated-vm as a security boundary for executing JavaScript supplied by users or other untrusted sources.

V8 Isolate Boundary Was Not the Root Cause

Despite the severity of the issue, researchers emphasized that the underlying V8 isolation mechanism itself was not compromised.

Instead, the vulnerability exists in the C++ binding layer responsible for transferring data between the isolated JavaScript environments.

“The most important takeaway is that what was not broken was the isolation primitive itself,” Staicu explained. “V8’s Isolate boundary held. What failed was the C++ glue code that marshals values across that boundary.”

The finding highlights the security risks associated with native-language bindings surrounding otherwise robust sandboxing primitives. Even when the underlying isolation mechanism works as intended, vulnerabilities in code responsible for transferring objects across the boundary can undermine the overall security model.

Users Urged to Update isolated-vm

Developers and organizations using isolated-vm are strongly advised to upgrade to a patched release.

The vulnerability affects versions through 7.0.0, while fixes are available in 6.2.0 and 7.0.1. Users should upgrade to the latest supported version appropriate for their environment.

Researchers have withheld additional details of the complete exploit chain to reduce the risk of the vulnerability being weaponized before affected users have had an opportunity to update.

Applications that use isolated-vm to execute untrusted JavaScript should treat the issue as a high-priority security update, particularly when the sandbox is relied upon as a barrier between attacker-controlled code and sensitive host resources.

Key Takeaways
GHSA-864f-rcv7-6rh4 is a critical vulnerability in isolated-vm.
The flaw affects versions 7.0.0 and earlier.
Patched versions include 6.2.0 and 7.0.1.
The vulnerability exists in the ExternalCopy component.
Malicious sandbox code can potentially corrupt host-process memory.
Exploitation can cause a SIGSEGV crash and denial of service.
Researchers demonstrated a potential guest-to-host sandbox escape.
Maximum demonstrated impact includes potential remote code execution on the host.
The underlying V8 Isolate security boundary was not directly broken.
Users should upgrade to the latest available isolated-vm release as soon as possible.

Leave a Reply

Your email address will not be published. Required fields are marked *