The Trojan Horse of Errors: Escaping Enclave-VM via Host Prototype Chains
Vulnerability ID: CVE-2026-22686
CVSS Score: 10.0
Published: 2026-01-14
A critical sandbox escape vulnerability in enclave-vm allowing malicious code to break out of the JavaScript sandbox by leveraging host-side Error objects. By traversing the prototype chain of an error returned from a failed tool call, attackers can access the host's Function constructor and execute arbitrary code on the underlying server.
TL;DR
If an AI agent or untrusted script running inside enclave-vm triggers an error in a host tool, the sandbox previously handed it a raw Host Error object. Attackers can climb this object's prototype chain (error.__proto__.constructor.constructor) to get a reference to the Host's Function constructor, enabling full Remote Code Execution (RCE) and total system compromise. Fixed in version 2.7.0.
⚠️ Exploit Status: POC
Technical Details
- CWE: CWE-693 (Protection Mechanism Failure)
- CVSS v3.1: 10.0 (Critical)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
- Attack Vector: Prototype Chain Traversal via Host Object Leak
- Exploit Status: PoC Available (Vector 35)
- EPSS Score: 0.00102
Affected Systems
- enclave-vm < 2.7.0
- Node.js applications using enclave-vm for AI sandboxing
- Agentic AI frameworks relying on enclave-vm for tool execution
-
enclave-vm: < 2.7.0 (Fixed in:
2.7.0)
Code Analysis
Commit: ed8bc43
Fix host error leakage via prototype severing and JSON bridge mode
+ Object.setPrototypeOf(error, null);
+ const SafeConstructor = Object.create(null);
Exploit Details
- Internal Research: Vector 35: Host Error Prototype Traversal
Mitigation Strategies
- Upgrade to enclave-vm v2.7.0+
- Enforce JSON-based serialization for all cross-realm communication
- Sever prototype chains on any objects passed to untrusted contexts
- Implement deep-freeze on error objects before sharing them
Remediation Steps:
- Run
npm install enclave-vm@latestto fetch version 2.7.0. - Review any custom tool bridge implementations to ensure
mode: 'direct'is NOT used. - If
mode: 'direct'is required, manually sanitize all return values and exceptions usingcreateSafeErrorlogic. - Restart the Node.js service to load the new library version.
References
Read the full report for CVE-2026-22686 on our website for more details including interactive diagrams and full exploit analysis.
Top comments (0)