AI Security AI安全 1d ago Updated 1d ago 更新于 1天前 41

Isolated-vm Flaw Lets Sandboxed JavaScript Escape to Host for Potential RCE isolated-vm漏洞允许沙箱JavaScript逃逸至宿主机,可能导致远程代码执行

A critical vulnerability (GHSA-864f-rcv7-6rh4) in the popular Node.js sandbox library isolated-vm allows guest JavaScript code to escape the isolated environment and corrupt memory in the host process The flaw resides in the ExternalCopy class's handling of the transferList option, specifically a type confusion bug in the C++ glue code that marshals values across V8 Isolate boundaries Impact ranges from reliable denial-of-service (controlled-address crash/SIGSEGV) to full guest-to-host sandbox e isolated-vm库存在关键安全漏洞(GHSA-864f-rcv7-6rh4),影响所有≤7.0.0版本,可导致沙箱逃逸和潜在远程代码执行(RCE) 漏洞位于ExternalCopy组件的transferList选项处理中,存在类型混淆问题,允许沙箱内代码破坏主机进程内存 攻击者可从单个ivm.Reference出发,实现从受控崩溃到控制流劫持的完整利用链 漏洞已在6.2.0和7.0.1版本中修复,完整利用细节已被保密以防止恶意攻击 该库每周下载量近100万次,GitHub拥有2900+星标,影响范围广泛

62
Hot 热度
58
Quality 质量
55
Impact 影响力

Analysis 深度分析

TL;DR

  • A critical vulnerability (GHSA-864f-rcv7-6rh4) in the popular Node.js sandbox library isolated-vm allows guest JavaScript code to escape the isolated environment and corrupt memory in the host process
  • The flaw resides in the ExternalCopy class's handling of the transferList option, specifically a type confusion bug in the C++ glue code that marshals values across V8 Isolate boundaries
  • Impact ranges from reliable denial-of-service (controlled-address crash/SIGSEGV) to full guest-to-host sandbox escape with potential remote code execution (control-flow hijack)
  • The vulnerability affects all versions up to and including 7.0.0, with patches released in versions 6.2.0 and 7.0.1
  • The isolation primitive itself (V8's Isolate boundary) remains sound; the failure was in the binding layer wrapping it, not the core isolation mechanism

Why It Matters

This vulnerability is significant for AI practitioners and developers who rely on isolated-vm to execute untrusted JavaScript code in sandboxed environments, as it completely undermines the trust boundary that the library is designed to enforce. The fact that a type confusion in marshaling code can escalate from a simple crash to full remote code execution highlights the critical importance of rigorous security auditing in C++ binding layers that sit atop otherwise secure primitives. With nearly 1 million npm downloads in a single week and widespread use in production environments, this flaw poses an immediate risk to any application depending on isolated-vm for code isolation.

Technical Details

  • Vulnerability Location: The bug exists in isolated-vm's ExternalCopy class, which is responsible for securely serializing JavaScript objects from the host isolate and deserializing them into guest isolates across V8 Isolate boundaries
  • Root Cause: A type confusion in the handling of the transferList option within the C++ glue code that marshals values across the V8 Isolate boundary, allowing a guest to corrupt host memory
  • Exploit Chain: Starting from a single ivm.Reference (the standard capability-granting mechanism), researchers escalated from a controlled-address crash to full control-flow hijack of the host process, demonstrating complete guest-to-host sandbox escape
  • Affected Versions: All versions before and including 7.0.0; patched in versions 6.2.0 and 7.0.1 released earlier this month
  • Discovery & Reporting: Identified by Endor Labs researcher Cristian-Alexandru Staicu, who reported the flaw through responsible disclosure; full exploit details have been withheld to prevent malicious exploitation
  • Architecture Context: isolated-vm runs untrusted JavaScript inside independent V8 Isolate instances with separate heaps, preventing direct object sharing between host and guest environments

Industry Insight

  • Supply Chain Security: Developers using isolated-vm should immediately audit their dependency trees and update to patched versions (6.2.0+ or 7.0.1+), as the library's popularity (2,900+ GitHub stars, ~1M weekly npm downloads) makes it a high-value target for attackers seeking host compromise
  • Binding Layer Vigilance: This incident reinforces the principle that secure primitives (like V8 Isolate boundaries) can be undermined by insecure binding layers; organizations should prioritize security reviews of C++/native code wrappers around language-level isolation features, especially in open-source libraries handling untrusted input
  • Defense-in-Depth for Sandboxing: Relying solely on language-level sandboxing is insufficient; applications should implement additional containment strategies such as running sandboxed code in separate processes, containers, or with mandatory access controls to mitigate the impact of potential escape vulnerabilities

TL;DR

  • isolated-vm库存在关键安全漏洞(GHSA-864f-rcv7-6rh4),影响所有≤7.0.0版本,可导致沙箱逃逸和潜在远程代码执行(RCE)
  • 漏洞位于ExternalCopy组件的transferList选项处理中,存在类型混淆问题,允许沙箱内代码破坏主机进程内存
  • 攻击者可从单个ivm.Reference出发,实现从受控崩溃到控制流劫持的完整利用链
  • 漏洞已在6.2.0和7.0.1版本中修复,完整利用细节已被保密以防止恶意攻击
  • 该库每周下载量近100万次,GitHub拥有2900+星标,影响范围广泛

为什么值得看

isolated-vm作为Node.js生态中广泛使用的沙箱解决方案,其安全漏洞直接影响依赖该库进行代码隔离的应用场景。对于AI从业者而言,许多AI应用需要执行不受信任的代码(如用户提交的模型推理、插件执行等),这类漏洞可能导致严重的安全风险。

技术解析

  • 漏洞位于ExternalCopy组件,该组件用于在V8 Isolate之间安全地序列化/反序列化JavaScript对象,通过transferList选项处理跨隔离区数据传输时存在类型混淆
  • 攻击利用链:从单个ivm.Reference(主机授予沙箱能力的标准方式)开始,可升级为受控地址崩溃(DoS),最终实现控制流劫持(潜在RCE)
  • V8的Isolate隔离原语本身未被破坏,问题出在C++胶水代码层,负责跨边界marshal值的绑定层存在缺陷
  • 成功利用可导致主机进程内存破坏、SIGSEGV崩溃,或完全逃逸沙箱信任边界
  • 完整利用细节已被保密,以防止恶意行为者发动攻击

行业启示

  • 开源库的安全维护至关重要,isolated-vm作为热门开源项目,其漏洞影响广泛,开发者应定期审查和更新依赖,建立自动化安全更新机制
  • 沙箱安全不能仅依赖底层隔离原语,应用层(如C++绑定代码)的安全同样需要严格审查,安全架构需覆盖完整技术栈
  • AI应用中执行用户代码的场景(如代码解释器、插件系统、AI代理)应优先考虑使用已验证安全的沙箱方案,并及时跟进安全更新,避免成为攻击跳板

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Security 安全 Open Source 开源