CVE-2026-57138: PraisonAI: codeMode sandbox escape allows RCE
CRITICALCISA: ATTENDPraisonAI's TypeScript codeMode tool claims to sandbox untrusted JavaScript, but it relies on a source blocklist and shadowed globals. An attacker can recover the real Function constructor via ({}).constructor.constructor and reach process.mainModule.require, which gives full host filesystem and command execution. The CVSS is 9.9 (scope changed, low privileges, no user interaction), so any user or agent able to feed input into codeMode can take over the host and steal API keys and secrets. Exploitation pressure is currently modest: EPSS is 0.73% (top 47%), it is not in CISA KEV, and there is no public exploit or Nuclei template, but the escape technique is well known and trivial to weaponize, and CISA SSVC rates it ATTEND. Upgrade to PraisonAI 1.7.2 or later, disable codeMode wherever untrusted or LLM-generated code can reach it, and run any code execution in a real isolation boundary such as a container or VM with no secrets mounted.
What is the risk?
High to critical. The attack is network-reachable, low complexity, needs only low privileges and no user interaction, and the changed scope means compromise extends beyond the sandbox to the host. Exploitation likelihood today is moderate (EPSS 0.73%, no KEV, no public exploit), but the JavaScript Function-constructor escape is a widely documented technique, so time-to-weaponization is short. Exposure is highest where codeMode accepts input from end users, or from LLM output that can be steered by prompt injection. Affected versions are 1.4.0 up to the 1.7.2 fix.
How does the attack unfold?
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| PraisonAI | pip | — | No patch |
Do you use PraisonAI? You're affected.
How severe is it?
What is the attack surface?
What should I do?
1 step1) Upgrade PraisonAI to 1.7.2 or later (see the GHSA-vmmj-pfw7-fjwp advisory and the fix commit). 2) Until patched, disable codeMode or restrict it to fully trusted callers; do not expose it to LLM-generated or user-supplied code. 3) Run agent workloads in containers or VMs with a non-root user, read-only filesystem, no outbound network by default, and no long-lived secrets in the environment. 4) Rotate any secrets that were accessible to hosts running affected versions with codeMode exposed. 5) Detect: monitor for child processes spawned by the Node agent runtime, unexpected file reads of .env or credential files, and codeMode inputs containing 'constructor.constructor', 'mainModule' or 'require('child_process')'. 6) Do not rely on in-process JavaScript sandboxes such as new Function or with() as a security boundary.
What does CISA's SSVC say?
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2026-57138?
PraisonAI's TypeScript codeMode tool claims to sandbox untrusted JavaScript, but it relies on a source blocklist and shadowed globals. An attacker can recover the real Function constructor via ({}).constructor.constructor and reach process.mainModule.require, which gives full host filesystem and command execution. The CVSS is 9.9 (scope changed, low privileges, no user interaction), so any user or agent able to feed input into codeMode can take over the host and steal API keys and secrets. Exploitation pressure is currently modest: EPSS is 0.73% (top 47%), it is not in CISA KEV, and there is no public exploit or Nuclei template, but the escape technique is well known and trivial to weaponize, and CISA SSVC rates it ATTEND. Upgrade to PraisonAI 1.7.2 or later, disable codeMode wherever untrusted or LLM-generated code can reach it, and run any code execution in a real isolation boundary such as a container or VM with no secrets mounted.
Is CVE-2026-57138 actively exploited?
No confirmed active exploitation of CVE-2026-57138 has been reported, but organizations should still patch proactively.
How to fix CVE-2026-57138?
1) Upgrade PraisonAI to 1.7.2 or later (see the GHSA-vmmj-pfw7-fjwp advisory and the fix commit). 2) Until patched, disable codeMode or restrict it to fully trusted callers; do not expose it to LLM-generated or user-supplied code. 3) Run agent workloads in containers or VMs with a non-root user, read-only filesystem, no outbound network by default, and no long-lived secrets in the environment. 4) Rotate any secrets that were accessible to hosts running affected versions with codeMode exposed. 5) Detect: monitor for child processes spawned by the Node agent runtime, unexpected file reads of .env or credential files, and codeMode inputs containing 'constructor.constructor', 'mainModule' or 'require('child_process')'. 6) Do not rely on in-process JavaScript sandboxes such as new Function or with() as a security boundary.
What systems are affected by CVE-2026-57138?
This vulnerability affects the following AI/ML architecture patterns: agent frameworks, multi-agent systems, code execution tools, LLM tool-calling pipelines.
What is the CVSS score for CVE-2026-57138?
CVE-2026-57138 has a CVSS v3.1 base score of 9.9 (CRITICAL). The EPSS exploitation probability is 0.73%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0049Exploit Public-Facing ApplicationAML.T0050Command and Scripting InterpreterAML.T0053AI Agent Tool InvocationAML.T0055Unsecured CredentialsAML.T0105Escape to HostCompliance Controls Affected
What are the technical details?
Original Advisory
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.
Exploitation Scenario
An attacker with a low-privilege account on an application built on PraisonAI submits a task that reaches codeMode, either directly or by prompt-injecting the agent into generating code. The payload uses ({}).constructor.constructor('return process')() to recover the real process object, then process.mainModule.require('child_process') to run commands. The attacker dumps environment variables with LLM and cloud API keys, reads files on the host, plants a persistent backdoor in the agent's code, and pivots into internal services the agent can reach.
Weaknesses (CWE)
CWE-184Incomplete List of Disallowed InputsPrimaryCWE-693Protection Mechanism FailurePrimaryCWE-184Incomplete List of Disallowed InputsCWE-693Protection Mechanism FailureCWE-184 — Incomplete List of Disallowed Inputs: The product implements a protection mechanism that relies on a list of inputs (or properties of inputs) that are not allowed by policy or otherwise require other action to neutralize before additional processing takes place, but the list is incomplete.
- [Implementation] Do not rely exclusively on detecting disallowed inputs. There are too many variants to encode a character, especially when different environments are used, so there is a high likelihood of missing some variants. Only use detection of disallowed inputs as a mechanism for detecting suspicious activity. Ensure that you are using other protection mechanisms that only identify "good" input - such as lists of allowed inputs - and ensure that you are properly encoding your outputs.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:HReferences
Timeline
Related Vulnerabilities
CVE-2026-4816810.0PraisonAI: shell injection in Claude Action enables RCE
Same package: praisonaiCVE-2026-6144710.0PraisonAI: RCE via unsandboxed LLM code execution
Same package: praisonaiCVE-2026-614459.9PraisonAI: AICoder root RCE via unsanitized tool calls
Same package: praisonaiGHSA-vmmj-pfw7-fjwp9.9praisonai: sandbox escape gives RCE via codeMode tool
Same package: praisonaiCVE-2026-473929.9praisonaiagents: RCE via Python sandbox bypass
Same package: praisonai