ZeroHour

CVE-2026-57138

niche

Sandbox escape to RCE in PraisonAI codeMode tool (v1.4.0–1.7.1)

CVSS 3.1
9.9 critical
EPSS
Published
()
Modified
AI analysis

PraisonAI, an open-source multi-agent teams framework, ships a built-in 'codeMode' tool whose advertised JavaScript sandbox runs attacker-controlled code via new Function() inside a with(sandbox) block, relying only on a source-code blocklist and shadowed process/require properties. The sandbox is trivially escapable: code can use ({}).constructor.constructor to recover the real Function constructor, then reach process and process.mainModule.require to access the host filesystem and spawn subprocesses. An attacker who controls codeMode input (e.g., via prompt injection into an agent pipeline or untrusted user-supplied agent definitions) can read secrets, modify files, execute arbitrary commands, or exhaust the host process, achieving full host compromise with only low privileges required. Affected deployments are PraisonAI 1.4.0 through 1.7.1 wherever the codeMode tool is enabled, particularly self-hosted agent services that execute model-generated code. No public PoC is known and the flaw is not on the CISA KEV catalog, so exploitation status is none known, though the bypass technique is well-understood.

What to do: Upgrade PraisonAI to version 1.7.2 or later, where the sandbox escape is fixed. Until patched, disable or tightly restrict the codeMode tool and never run agent-generated code on hosts with access to secrets, credentials, or sensitive files. Run agent code-execution tools inside an isolated container or sandboxed worker (seccomp/gVisor/no network or filesystem access), and audit existing deployments for unexpected file reads/writes, subprocess spawns, or exfiltration of environment variables.

Affected
PraisonAI (MervinPraison) PraisonAI (codeMode tool, src/praisonai-ts/src/tools/builtins/code-mode.ts)>=1.4.0, <1.7.2
Estimated exposure
nichelikely thousands to low tens of thousands of developer/self-hosted deployments (rough estimate) — PraisonAI is an open-source, self-hosted developer framework distributed via GitHub/npm with no active-install telemetry, so exposure is limited to developers and self-hosted agent services that enable the codeMode tool rather than a broad…

Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.

Description

PraisonAI is a multi-agent teams system. From 1.4.0 until 1.7.2, codeMode in src/praisonai-ts/src/tools/builtins/code-mode.ts executes untrusted JavaScript with new Function() inside with(sandbox) and relies on a small source-code blocklist plus shadowed process and require properties. Code can use ({}).constructor.constructor to recover the real Function constructor, obtain process and process.mainModule.require, and reach host filesystem and subprocess APIs despite the advertised sandbox. Attackers who control codeMode input can read secrets, modify files, execute commands, or exhaust the host process. This issue is fixed in version 1.7.2.

Weakness
CWE-184, CWE-693
Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

In the news

No ingested article mentions this CVE yet.