PraisonAI: Code Injection via f-string Interpolation in Deploy API Server Generation
Summary
The deploy/api.py module generates Python server code by directly interpolating the agents_file parameter into an f-string that is then written to a file and executed via subprocess.Popen(). An attacker who controls the agents_file value (via CLI argument, configuration, or upstream API) can inject arbitrary Python code.
Details
src/praisonai/praisonai/deploy/api.py (line 80):
code = f'''...
praisonai = PraisonAI(agent_file="{agents_file}")
...
"agent_file": "{agents_file}"
...'''
The generated code is then executed (line 190):
subprocess.Popen(['python', server_file])
agents_file is never sanitized or validated. A malicious value breaks out of the string context:
agents_file = '"); import os; os.system("id"); #'
# Generated code becomes:
# praisonai = PraisonAI(agent_file=""); import os; os.system("id"); #")
The same pattern exists in deploy/docker.py (line 33) for Dockerfile generation.
PoC
# The injection:
agents_file = '"); import os; os.system("id"); #'
# What the generated code looks like:
template = f'praisonai = PraisonAI(agent_file="{agents_file}")'
print(template)
# Output: praisonai = PraisonAI(agent_file=""); import os; os.system("id"); #")
Impact
- Arbitrary code execution on the machine running the deploy command
- Supply chain risk if
agents_filecomes from a configuration file or CI/CD pipeline
Betroffene Software
Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.
| Plattform | Paket | Anfällige Versionen | Behoben in |
|---|---|---|---|
| Python (PyPI) | praisonai | < 4.6.78 | 4.6.78 |
Verweise
- CVSS-Vektor
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H- Schwäche (CWE)
CWE-94- Plattform
- Python (PyPI)
- Paket
praisonai- Veröffentlicht
- 07.10.2026
- Aktualisiert
- 15.10.2026 18:17
Quellen und Lizenzen
OSV / GitHub Advisory Database - GHSA-g6j7-pffp-8whg - CC BY 4.0
OSV / GitHub Advisory Database - PYSEC-2026-4256 - PyPA Advisory Database; CC BY 4.0
Schwachstellenhistorie: praisonai
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.
- Einträge insgesamt
- 104
- Erste → letzte
- 04.2026 10.2026
- Ohne Fix
- 0
- In Angriffen ausgenutzt
- 0
Verteilung nach Schweregrad
- Kritisch 27
- Hoch 60
- Mittel 17
Veröffentlichungen pro Jahr
- 2026: 104
-
PraisonAI: Code Injection via f-string Interpolation in Deploy API Server Generation dieser Eintrag
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.