GHSA-G6J7-PFFP-8WHG
PraisonAI: Code Injection via f-string Interpolation in Deploy API Server Generation
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 4.6.81 | praisonai · -102 d desde divulgación | |
| Divulgación | Publicada | GHSA-G6J7-PFFP-8WHG divulgada | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice |
### 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_file` comes from a configuration file or CI/CD pipeline
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
pypipraisonai |
Corregida | 4.6.81 | -102 d | 4.7.26 no afectada |
4.6.784.6.81Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-g6j7-pffp-8whghttps://github.com/MervinPraison/PraisonAILas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
