NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · PyPI

CVE-2026-62176: PraisonAI: Code Injection via f-string Interpolation in Deploy API Server Generation

criticalCVSS 3.1 9.1GHSA-g6j7-pffp-8whg

PraisonAI's deploy code writes the `agents_file` value straight into generated Python server code and then runs it. A crafted value breaks out of the string and runs arbitrary Python on the machine that runs the deploy command. PraisonAI 4.6.77 and earlier are affected. Fixed in 4.6.78.

Published Oct 7, 2026 · Analysis Oct 25, 2026

What an attacker can do

deploy/api.py in the PraisonAI package builds a server script with an f-string that contains PraisonAI(agent_file="{agents_file}") and the same value in an agent_file entry. It writes the script to disk and starts it with subprocess.Popen(['python', server_file]). Nothing validates agents_file. A value like "); import os; os.system("id"); # closes the string, adds a statement and comments out the rest, so that statement runs when the server starts. The same pattern appears in deploy/docker.py for Dockerfile generation.

The attacker must control the agents_file value: a CLI argument, a configuration file, or an upstream API that feeds the deploy command. The CVSS vector requires high privileges, so this is not an anonymous remote bug. It matters most in automation. A CI/CD pipeline or management service that takes an agents file name from a repo, a pull request or a request body hands code execution to whoever sets it. The code runs with the rights of the user running the deploy.

Who is affected

Affected: pip package PraisonAI 4.6.77 and earlier, if you use the deploy API server generation or the Docker deploy code and the agents_file value is not fully under your control.

pip show praisonai

Search your pipelines and scripts for deploy commands that take agents_file from external input.

PraisonAI

Ecosystem
PyPI
Affected
<= 4.6.77
Fixed in
4.6.78
Check
pip show PraisonAI

How to fix it

Upgrade to PraisonAI 4.6.78.

pip install -U praisonai==4.6.78

The advisory does not describe the code change, and it does not say whether the patch covers deploy/docker.py as well as deploy/api.py. It lists no workaround. Until you upgrade, do not pass untrusted or externally sourced values as agents_file, and validate any such value before use. That is general advice, not vendor guidance.

How to tell if you were hit

Look for generated server files from the deploy command whose agent_file string contains quotes, semicolons or import. Check CI logs and deploy configuration for agents_file values that are not plain file paths. Review child Python processes started by the deploy command for unexpected shell calls such as os.system.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

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

Credited to anushkavirgaonkar.

Questions

Is CVE-2026-62176 exploitable without credentials?

The attacker must control the agents_file value, and the CVSS vector lists high privileges required. The risk is highest where an automated system passes outside input into that parameter.

Does it affect Docker deployment?

The advisory says the same pattern exists in deploy/docker.py for Dockerfile generation. It does not confirm whether 4.6.78 patched both files.

Which PraisonAI version is fixed?

4.6.78. Versions up to and including 4.6.77 are affected.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More PyPI vulnerabilities

All PyPI entries