PraisonAI: execute_code sandbox bypass: str.format C-level attribute access reads every blocklisted dunder
CVE-2026-57120 · GHSA-pv2j-rghr-v5r9 · published 2026-06-18 · updated 2026-07-20
- Severity
- Medium
- CVSS score
- 6.5
- Chance of exploitation (EPSS)
- 0.56%
- Fixed in
- 1.6.59
- Exploitation Public proof of concept
- Automatable No
- Technical impact Partial
- CISA SSVC
The executecode tool's subprocess sandbox advertises a three-layer defense (AST validation, text-pattern blocklist, restricted builtins). In sandbox mode (the default) only two layers are active — the text-pattern blocklist is skipped — and both remaining layers are bypassed by combining two CPython semantics: 1. Runtime string assembly. The AST validator ( ) enumerates blocked dunder names against ast.Attribute.attr, ast.Call.func.id, and ast.Constant string-substring. Names assembled at runtime (e.g. ""2 + "class" + ""2) appear in the AST as multiple short ast.Constant nodes, none containing a blocked substring, so the static check passes. 2. C-level attribute access via format-spec.
Upgrade praisonaiagents to 1.6.59 or later.
1. Add format, formatmap to SANDBOXBLOCKEDCALLS (blocks the calls at the AST layer; cost: also blocks benign str.format). 2. Or replace str in safebuiltins with a subclass whose format/formatmap reject dotted fields resolving to leading-underscore attributes (preserves benign formatting). 3. Or drop sandbox-mode's in-process security claim and document that real isolation requires external sandboxing (gVisor/firejail/container/microVM) — which matches what the subprocess provides today. The text-pattern blocklist present in the direct path (python_tools.py:487-502) is absent from the sandbox path; even if added, the runtime-assembly trick defeats it, so (1) or (2) is required.
| Package | Registry | Affected | Fixed in |
|---|---|---|---|
| praisonaiagents | PyPI | < 1.6.59 | 1.6.59 |
- CriticalLiteLLM has SQL Injection in Proxy API key verificationlitellmExploited
- Criticaln8n Vulnerable to Remote Code Execution via Expression Injectionn8n, n8nExploited
- HighLiteLLM has a sandbox escape in custom-code guardraillitellmExploited
- HighLangflow affected by Remote Code Execution via validate_code() exec()langflowExploited
- CriticalJupyter MCP Server: Browser DNS rebinding can hijack the Jupyter backend through management routesjupyter-mcp-server
- Criticalmem0ai Databricks vector store vulnerable to SQL injectionmem0ai
- CriticalPraisonAI: CodeAgent Executes LLM-Generated Code Without Sandboxing and Leaks All Environment Secretspraisonaiagents
- CriticalPraisonAI: Unauthenticated RCE via Jobs API + Approval Bypasspraisonaiagents, praisonai
- CriticalPraisonAI: MCP SSE transport binds 0.0.0.0 with no authentication and no Origin validation; bundled SecurityConfig is never wired inpraisonaiagents
- CriticalPraisonAI AgentTeam.launch exposes unauthenticated remote agent listing and invocation endpointspraisonaiagents
- CriticalPraisonAI vulnerable to sandbox escape via `print.__self__` builtins module leak in `execute_code` (subprocess mode)praisonaiagents, praisonai
- CriticalPraisonAI Browser Server allows unauthenticated WebSocket clients to hijack connected extension sessionspraisonaiagents, praisonai
The impact, patch and workaround text comes from the advisory, shortened (GitHub Advisory Database, CC BY 4.0). Proof-of-concept and reproduction sections and code are left out; the original advisory has them.