{"vuln_id":"GHSA-qf73-2hrx-xprp","aliases":["CVE-2026-39888"],"description":"PraisonAI has sandbox escape via exception frame traversal in `execute_code` (subprocess mode)","published_at":"2026-04-08T19:17:28Z","modified_at":"2026-11-16T16:00:45Z","first_seen_at":"2026-11-21T19:15:20.271113Z","severity":"critical","severity_source":"ghsa","cvss_score":9.9,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H","cwe":["CWE-657","CWE-693"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":null,"epss_percentile":null,"nvd_status":null,"enriched_at":null,"links":{"nvd":"https://github.com/advisories/GHSA-qf73-2hrx-xprp"},"matched_alias":null,"items":[{"id":2518,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-qf73-2hrx-xprp / CVE-2026-39888: PraisonAI has sandbox escape via exception frame traversal in `execute_code` (subprocess mode)","summary":"PraisonAI has sandbox escape via exception frame traversal in `execute_code` (subprocess mode)\n\n## Summary\n\n`execute_code()` in `praisonaiagents.tools.python_tools` defaults to\n`sandbox_mode=\"sandbox\"`, which runs user code in a subprocess wrapped with a\nrestricted `__builtins__` dict and an AST-based blocklist. The AST blocklist\nembedded inside the subprocess wrapper (`blocked_attrs`, line 143 of\n`python_tools.py`) contains only 11 attribute names — a strict subset of the 30+\nnames blocked in the direct-execution path. The four attributes that form a\nframe-traversal chain out of the sandbox are all absent from the subprocess list:\n\n| Attribute | In subprocess `blocked_attrs` | In direct-mode `_blocked_attrs` |\n|---|---|---|\n| `__traceback__` | **NO** | YES |\n| `tb_frame` | **NO** | YES |\n| `f_back` | **NO** | YES |\n| `f_builtins` | **NO** | YES |\n\nChaining these attributes through a caught exception exposes the real Python\n`builtins` dict of the subprocess wrapper frame, from which `exec` can be\nretrieved and called under a non-blocked variable name — bypassing every\nremaining security layer.\n\n**Tested and confirmed on praisonaiagents 1.5.113 (latest), Python 3.10.**\n\n---\n\n## Severity\n\n**CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H — 9.9 Critical**\n\n| Vector | Value | Rationale |\n|---|---|---|\n| AV:N | Network | `execute_code` is a designated agent tool; user/LLM-supplied code reaches it over the network in all standard deployments |\n| AC:L | Low | No race conditions or special configuration required |\n| PR:L | Low | Requires ability to submit code through an agent (typical end-user privilege) |\n| UI:N | None | No victim interaction |\n| S:C | Changed | Escapes subprocess sandbox into full host process context |\n| C:H | High | Arbitrary file read, environment variable access, credential exfiltration |\n| I:H | High | Arbitrary file write, arbitrary code execution on host |\n| A:H | High | Can terminate processes, exhaust resources |\n\n---\n\n## Affected\n\n- **Package**: `praisonaiagents` (PyPI)\n- **Affected versions**: all versions shipping `sandbox_mode=\"sandbox\"` (default since introduction) through **1.5.113**\n- **Patched versions**: none at time of report\n- **File**: `praisonaiagents/tools/python_tools.py`\n\n---\n\n## Root Cause\n\n### Two separate `blocked_attrs` sets — one much weaker than the other\n\n`_validate_code_ast()` (line 39, used by direct mode) blocks 30+ attributes:\n\n```python\n# python_tools.py line 52 — direct mode (FULL list, correctly includes frame attrs)\n_blocked_attrs = frozenset({\n    '__subclasses__', '__bases__', '__mro__', '__globals__',\n    '__code__', '__class__', '__dict__', '__builtins__',\n    '__import__', '__loader__', '__spec__', '__init_subclass__',\n    '__set_name__', '__reduce__', '__reduce_ex__',\n    '__traceback__', '__qualname__', '__module__',   # ← present here\n    '__wrapped__', '__closure__', '__annotations__',\n    'gi_frame', 'gi_code', 'cr_frame', 'cr_code',\n    'ag_frame', 'ag_code', 'tb_frame', 'tb_next',    # ← present here\n    'f_globals', 'f_locals', 'f_builtins', 'f_code', # ← present here\n    'co_con\n\nAffected packages: pip:praisonaiagents\nPatched: praisonaiagents 1.5.115","url":"https://github.com/advisories/GHSA-qf73-2hrx-xprp","published_at":"2026-04-08T19:17:28Z","updated_at":"2026-11-16T16:00:45Z","fetched_at":"2026-11-21T19:15:18.416901Z","severity":"critical","cvss_score":9.9,"epss":0.00504,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"praisonaiagents","vuln_id":"CVE-2026-39888","vuln_ids":["CVE-2026-39888","GHSA-QF73-2HRX-XPRP"],"tags":["ghsa","pip","CWE-657","CWE-693"],"cluster_id":2480,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2518","html":"https://vulnwatch.ve1ve2.com/item/2518"}}]}