CVE-2026-57138: PraisonAI codeMode sandbox escape via Function constructor
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.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
src/praisonai-ts/src/tools/builtins/code-mode.ts (codeMode sandbox)to a version that resolves this vulnerability.Fixed in 1.7.2
Event History
Frequently Asked Questions
What access does an attacker need to exploit this issue?
An attacker must be able to control input executed by codeMode. No user interaction is required once they can supply that code.
Which deployments should be updated?
PraisonAI versions from 1.4.0 until the fixed 1.7.2 release are affected. Update to version 1.7.2.
What could successful exploitation allow?
An attacker can escape the advertised sandbox and access host filesystem and subprocess APIs. This can enable reading secrets, modifying files, executing commands, or exhausting the host process.