# Critical Type Confusion in isolated-vm ExternalCopy Enables Guest-to-Host Sandbox Escape and RCE (GHSA-864f-rcv7-6rh4)

> A critical type confusion vulnerability (GHSA-864f-rcv7-6rh4, CVE pending) in the isolated-vm npm library's ExternalCopy class allows JavaScript code running inside a V8 Isolate sandbox to escape into the host Node.js process. The root cause is a TOCTOU (Time-of-Check/Time-of-Use) gap in the C++ native binding code: the transferList JavaScript array is iterated twice, and a getter can return different values on each read, causing an unchecked reinterpret_cast to dereference an attacker-controlled pointer. Researchers at Endor Labs escalated this from a controlled crash to a full control-flow hijack of the host process, establishing RCE from inside the sandbox with only a single ivm.Reference.

- **Published:** 2026-08-20T00:00:00Z
- **Last reviewed:** 2026-08-20T00:00:00Z
- **Canonical:** https://intel.threadlinqs.com/threat/TL-2026-2084
- **Card image:** https://intel.threadlinqs.com/og/threat/threat-intel-isolated-vm-externalcopy-escape-tl-2026-2084.webp?v=8ef42c13 (Threadlinqs threat intel: isolated-vm GHSA-864f-rcv7-6rh4 Escape: Detection & IOCs (TL-2026-2084) — Critical severity, 7 IOCs, 9 detection rules.)
- **ID:** TL-2026-2084
- **Severity:** CRITICAL (CVSS 9.8)
- **Category:** VULNERABILITY
- **Status:** ACTIVE
- **Detections:** 9 (1 shown free below) · **IOCs:** 7
- **CVEs:** CVE-2021-21413, CVE-2022-39266

## Description

## Vulnerability Overview

GHSA-864f-rcv7-6rh4 is a critical type confusion vulnerability in the `ExternalCopy` class of `isolated-vm`, the most widely used V8-Isolate-based JavaScript sandbox library for Node.js (1M+ weekly downloads, 273 dependents). Discovered by Cristian-Alexandru Staicu of Endor Labs, the bug resides in the C++ native binding code that marshals values across the V8 Isolate boundary — not in V8's isolation primitive itself.

## Root Cause: TOCTOU in ExternalCopy transferList

The `ExternalCopy` constructor (`src/external_copy/serializer.cc`) iterates the `transferList` JavaScript array **twice**:

1. **Walk 1 (Validation):** Checks each element with `IsArrayBuffer()` and registers valid entries with the serializer.
2. **Walk 2 (Transfer):** Calls `handle.As<ArrayBuffer>()` — an **unchecked reinterpret_cast** — to transfer each element without re-validating.

Because array element access invokes JavaScript accessors (`Get()`), an attacker-defined **getter** can return a valid `ArrayBuffer` on the first read and an attacker-controlled value (e.g., the small integer `0x41414141`) on the second read. The `As<ArrayBuffer>()` cast treats the fake value as an `ArrayBuffer*`, causing the host process to dereference attacker-controlled memory.

## Exploitation Chain: Crash → ASLR Bypass → Control-Flow Hijack

The Endor Labs researchers developed a full exploit chain working entirely from inside the sandbox with only a single `ivm.Reference` — the standard mechanism hosts use to expose capabilities to sandboxes:

### Stage 1: Controlled Crash Primitive
The PoC crashes Node.js 26.5.0 on macOS/arm64 with `SIGSEGV` at address `0x4141414100000047`. The `ExternalCopyArrayBuffer::Transfer` function (`src/external_copy/external_copy.cc:397`) calls `IsDetachable()` and `GetBackingStore()` on the confused pointer.

### Stage 2: ASLR Bypass
By controlling the bytes read as the object's fields (a JavaScript string instead of an integer), the researcher recoverd the **host's ASLR base** through leaked pointers — no separate infoleak vulnerability was required.

### Stage 3: VTable Forging → Control-Flow Hijack
The exploit forges a fake control block and vtable in heap-sprayed memory and drives an indirect call to an address of its choosing. The `shared_ptr` destruction path does an indirect call through a vtable pointer read from attacker-controlled memory. This was demonstrated by making the host process invoke a chosen libc function.

The full exploit is withheld from public disclosure.

## The Fix

The maintainer patched both affected version lines by wrapping `ExternalCopy::Copy` in a `v8::Isolate::DisallowJavascriptExecutionScope` (`THROW_ON_FAILURE`), which prevents any user JavaScript (getters, proxies, interceptors) from running during the copy operation, eliminating the TOCTOU window entirely.

- **v7.0.1** (commit `38e244b`) — 1 line added, 0 removed in `src/external_copy/external_copy.cc`
- **v6.2.0** (commit `c1cfe9f`) — same patch backported

## Affected Ecosystem

isolated-vm is a dependency of major open-source platforms that run untrusted JavaScript in sandboxed environments:

- **n8n** (200k GitHub stars) — Integrated via `IsolatedVmBridge` (PR #26142, Feb 2026) for expression evaluation inside V8 isolates (128 MB limit)
- **Activepieces** (23k stars) — `SANDBOX_CODE_ONLY` mode uses isolated-vm for JS automation pieces
- **Mastra AI** (27k stars) — Dedicated `@mastra/isolated-vm` transport (`IsolatedVmCodeModeTransport`) for AI-authored code execution
- **Budibase** (28k stars) — Migrated from vm2 to isolated-vm in v2.20.0 (PR #12769)
- **Directus** (37k stars) — Replaced vm2 for Run Script Flows in v10.6.0 (PR #19332)
- **Sim.ai / Sim Studio** (29k stars) — AI agent code execution in isolated workers
- **Rocket.Chat** (46k stars) — Secure mode for webhook integration scripts (PR #30229)
- **Screeps** — MMO game running player-submitted AI code; original use case for the library
- **Fly.io** — Edge middleware running globally distributed applications
- **Algolia** — Custom Crawler product for user-provided content extraction
- **TripAdvisor** — Server-side rendering of React pages at scale

## Previous CVEs in isolated-vm

This is the third critical vulnerability in isolated-vm, highlighting a pattern of C++ native binding risks:
- **CVE-2021-21413** (GHSA-mmhj-4w6j-76h7, CVSS 9.6): Reference prototype chain traversal in pre-v4.0.0
- **CVE-2022-39266** (GHSA-2jjq-x548-rhpv, CVSS 9.8): Untrusted V8 CachedData bypass in ≤4.3.6
- **GHSA-864f-rcv7-6rh4** (CVE pending, Critical): This TOCTOU type confusion in ExternalCopy

All three share a root pattern: the bug lives in the **C++ binding/glue layer** that marshals values across the V8 Isolate boundary, not in V8's isolation primitive itself.

## Key Lesson

As the Endor Labs researchers emphasize, the V8 Isolate boundary itself held. What failed was the C++ glue code that marshals values across that boundary. This is framed as a recurring security pattern: safe isolation primitives are undermined by memory-unsafe binding layers wrapped around them. The researchers' prior academic work — **SandDriller** (USENIX Security 2023) for automated sandbox seam testing and **Bilingual Problems** (USENIX Security 2023) for native extension memory unsafety — directly informed this discovery.

## MITRE ATT&CK

- T1203 Exploitation for Client Execution
- T1059 Command and Scripting Interpreter
- T1027 Obfuscated Files or Information
- T1055 Process Injection
- T1082 System Information Discovery
- T1057 Process Discovery
- T1485 Data Destruction
- T1071 Application Layer Protocol

## Free detection (Splunk SPL, Microsoft KQL, Sigma)

**Post-Exploitation — Node.js SIGSEGV Crash and Heap Spray Detection** (`TL-2026-2084-SPL-002`)

Detects post-exploitation activity following an isolated-vm sandbox escape. Covers: (1) SIGSEGV crashes in Node.js processes from failed exploit attempts — the crash site at ExternalCopyArrayBuffer::Transfer in external_copy.cc:397 dereferences an attacker-controlled pointer, producing a crash at address 0x{NUMBER}00000047 on arm64; (2) heap spray behavior indicating vtable forging — rapid large allocation patterns atypical for normal Node.js operation; (3) unexpected Node.js process termination or restart following JavaScript sandbox activity.

- **Languages:** Splunk SPL, Microsoft KQL, Sigma
- **ATT&CK:** T1068, T1055, T1027, T1082
- **Data sources:** linux_syslog, linux_auditd, process_heap_telemetry
- **Severity:** critical
- **Confidence:** high

### Splunk SPL

```spl
index=main (sourcetype="linux:syslog" OR sourcetype="linux:audit")
  ("SIGSEGV" "node" OR "signal 11" "node" OR "segfault" "node")
| eval crash_pattern = if(match(_raw, "0x[0-9a-f]+00000047"), "exploit_crash_smi_tag", "other_segv")
| eval is_node = if(match(_raw, "(?i)(node|nodejs|isolated-vm)"), true, false)
| search is_node=true
| stats count by host, process_name, crash_pattern, source
| eval severity = if(crash_pattern="exploit_crash_smi_tag", "critical", "high")
| sort - count
| table _time, host, process_name, crash_pattern, severity, message

| append [search index=perfmon sourcetype="nodejs:heap" "heap" "size" 
  | eval allocation_rate = if('heap_used_percent' > 80 AND 'allocations_per_sec' > median, "high_heap_spray", "normal")
  | where allocation_rate="high_heap_spray"
  | stats avg(heap_used_percent) as avg_heap, avg(allocations_per_sec) as avg_alloc by host
  | eval severity="high"
  | table host, avg_heap, avg_alloc]
```

### Microsoft KQL

```kql
// TL-2026-2084-KQL-002: Post-Exploitation — Node.js SIGSEGV Crash and Heap Spray
// Detects SIGSEGV crashes indicative of failed/fumbled isolated-vm exploit attempts
// and anomalous heap allocation patterns indicative of vtable forging/spray
let CrashWindow = ago(7d);
// Part 1: SIGSEGV crashes in Node.js processes
let NodeSIGSEGV = DeviceEvents
| where Timestamp > CrashWindow
| where ActionType == "CrashEvent" or ActionType == "LinuxSyslogEvent"
| extend CrashMessage = tostring(AdditionalFields.SyslogMessage)
| where CrashMessage contains "SIGSEGV"
  and (CrashMessage contains "node" or CrashMessage contains "nodejs")
| extend CrashAddress = extract(@"0x([0-9a-f]+)", 1, CrashMessage)
| extend SmiCrashSignature = iff(
    CrashMessage matches regex @"0x[0-9a-f]{5,}00000047",
    "SIGSEGV_SMI_TAG_EXPLOIT", "SIGSEGV_OTHER")
| where SmiCrashSignature == "SIGSEGV_SMI_TAG_EXPLOIT"
| project Timestamp, DeviceName, CrashAddress, SmiCrashSignature, CrashMessage;
// Part 2: Anomalous heap allocation — vtable spray pattern
let HeapSpray = DeviceProcessEvents
| where Timestamp > CrashWindow
| where FileName == "node" or FileName == "nodejs"
| extend HeapAllocMB = toint(ProcessHeapMemoryUsageMB)
| where HeapAllocMB > 80
| project Timestamp, DeviceName, HeapAllocMB, ProcessId, FileName;
// Combine
NodeSIGSEGV
| join kind=fullouter (HeapSpray) on DeviceName
| project Timestamp, DeviceName, CrashAddress, SmiCrashSignature, HeapAllocMB, CrashMessage
| order by Timestamp desc
```

### Sigma

```yaml
title: Node.js SIGSEGV Crash with Exploit Signature — isolated-vm Sandbox Escape Attempt
description: Detects SIGSEGV crashes in Node.js processes at addresses matching the known isolated-vm ExternalCopy exploit pattern (arm64 Smi-tagged address 0x{NUMBER}00000047), indicating a failed or partially successful sandbox escape attempt via the ExternalCopyArrayBuffer::Transfer type confusion. Also flags anomalous heap allocation patterns consistent with vtable/heap spray required for control-flow hijack.
id: b8c2d3e4-f5a6-7b8c-9d0e-1f2a3b4c5d6e
status: experimental
references:
    - https://github.com/laverdet/isolated-vm/security/advisories/GHSA-864f-rcv7-6rh4
    - https://www.endorlabs.com/learn/ghsa-864f-rcv7-6rh4-critical-type-confusion-vulnerability-in-isolated-vm
    - https://attack.mitre.org/techniques/T1068/
    - https://attack.mitre.org/techniques/T1055/
author: Threadlinqs Team
date: 2026-08-20
tags:
    - attack.privilege_escalation
    - attack.t1068
    - attack.defense_evasion
    - attack.t1055
    - attack.t1027
    - attack.discovery
    - attack.t1082
    - cwe.843
    - cwe.704
    - cve.2026.pending
    - ghsa.864f.rcv7.6rh4
    - attack.tool.isolated_vm
logsource:
    category: process
    product: linux
    service: syslog
detection:
    selection_crash:
        message|contains|all:
            - 'SIGSEGV'
            - 'node'
    selection_exploit:
        message|re: '0x[0-9a-f]{5,}00000047'
    condition: selection_crash and selection_exploit
falsepositives:
    - Genuine Node.js bugs that produce SIGSEGV at coincidentally similar addresses (vanishingly rare)
    - Native addon crashes unrelated to isolated-vm
    - Node.js version compatibility issues under high memory pressure
level: critical
```

**Known false positives:**

- Node.js native addon crashes from unrelated memory bugs
- Genuine Node.js segfaults from non-exploit conditions
- Memory pressure-induced OOM kills in sandbox-hosting nodes

**Tuning notes:** Focus on the Smi-tagged crash address signature (0x{NUMBER}00000047 on arm64) which is highly specific to this exploit. Correlate crash events with timestamp of recent ExternalCopy operations. Exclude known-stable Node.js native addon compilation test runs. For heap spray, set baseline threshold per host; 80th-percentile+ heap indicates potential spray.

### 8 more detection rules (Splunk SPL, Microsoft KQL, Sigma), unlock with TL Creds

- Exploit Trigger — Stateful Getter on transferList (KQL) (locked: unlock with TL Creds)
- Post-Exploitation — SIGSEGV Crash and Heap Spray Detection (KQL) (locked: unlock with TL Creds)
- C2 / Lateral Movement — Post-Escape Node.js Network and Process Anomalies (KQL) (locked: unlock with TL Creds)
- Exploit Trigger — Stateful Getter on transferList (Sigma) (locked: unlock with TL Creds)
- Post-Exploitation — SIGSEGV Crash and Heap Spray Detection (Sigma) (locked: unlock with TL Creds)
- C2 / Lateral Movement — Post-Escape Node.js Network and Process Anomalies (Sigma) (locked: unlock with TL Creds)
- Exploit Trigger — Stateful Getter on ExternalCopy transferList (locked: unlock with TL Creds)
- C2 / Lateral Movement — Post-Escape Node.js Network and Process Anomalies (locked: unlock with TL Creds)

Sign up free to unlock the detection rules: https://threadlinqs.com/?modal=signup

## Sources

- [GHSA-864f-rcv7-6rh4 — isolated-vm Security Advisory](https://github.com/laverdet/isolated-vm/security/advisories/GHSA-864f-rcv7-6rh4)
- [Endor Labs — Critical Type Confusion in isolated-vm: Full Technical Writeup](https://www.endorlabs.com/learn/ghsa-864f-rcv7-6rh4-critical-type-confusion-vulnerability-in-isolated-vm)
- [The Hacker News — Isolated-vm Flaw Lets Sandboxed JavaScript Escape to Host](https://thehackernews.com/2026/08/isolated-vm-flaw-lets-sandboxed.html)
- [NVD — CVE-2021-21413 (Previous isolated-vm Critical Vuln)](https://nvd.nist.gov/vuln/detail/CVE-2021-21413)
- [NVD — CVE-2022-39266 (Previous isolated-vm Critical Vuln)](https://nvd.nist.gov/vuln/detail/CVE-2022-39266)
- [GitHub — laverdet/isolated-vm Repository](https://github.com/laverdet/isolated-vm)
- [npm — isolated-vm Package (1M+ weekly downloads)](https://www.npmjs.com/package/isolated-vm)
- [n8n PR #26142 — IsolatedVmBridge (isolated-vm Integration)](https://github.com/n8n-io/n8n/pull/26142)
- [Mastra AI PR #20359 — @mastra/isolated-vm Transport](https://github.com/mastra-ai/mastra/pull/20359)
- [Budibase PR #12769 — Migration from vm2 to isolated-vm](https://github.com/Budibase/budibase/pull/12769)
- [Directus PR #19332 — Replacement of vm2 with isolated-vm](https://github.com/directus/directus/pull/19332)
- [USENIX Security 2023 — SandDriller: Automated Testing of JavaScript Sandboxes](https://www.usenix.org/conference/usenixsecurity23/presentation/alhamdan)
- [USENIX Security 2023 — Bilingual Problems: Native Extension Risks in Scripting Languages](https://www.usenix.org/conference/usenixsecurity23/presentation/staicu)
- [Rocket.Chat PR #30229 — Secure Mode Integration Scripts with isolated-vm](https://github.com/RocketChat/Rocket.Chat/pull/30229)
- [CISA Known Exploited Vulnerabilities Catalog](https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json)

## Full data

The other 8 detection rules (Splunk SPL / Microsoft KQL / Sigma) unlock with TL Creds; a free account includes daily creds: https://threadlinqs.com/?modal=signup
Indicator values unlock with TL Creds, at a lower price on Red and Purple; AI agents can query rules and IOCs through the Threadlinqs MCP server (Purple): https://intel.threadlinqs.com/mcp

Canonical: https://intel.threadlinqs.com/threat/TL-2026-2084
