CVE-2026-62176: PraisonAI Code Injection Vulnerability

CRITICAL
Advisory Identifier: GHSA-g6j7-pffp-8whg
CVSS 9.1
CWE-94
Published
Advisory Summary

CVE-2026-62176 is a CRITICAL (CVSS 9.1) code injection vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting PraisonAI libraries in the PyPI ecosystem. The issue involves code injection via f-string interpolation in deploy api server generation. Remediation is available by upgrading affected packages to version 4.6.78.

CVE-2026-62176 at a Glance

CVE Identifier CVE-2026-62176
GHSA Identifier GHSA-g6j7-pffp-8whg
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product PraisonAI
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 9.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-62176

To remediate this vulnerability, upgrade all affected PraisonAI dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

PraisonAI fixed: 4.6.78
pip install PraisonAI>=4.6.78
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show PraisonAI

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-62176, inspect your installed packages using pip:

pip show PraisonAI

Analyze the terminal output to locate any version of PraisonAI in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.6.78), your application is affected.

Note: The pip show PraisonAI command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In PraisonAI, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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): ```python code = f'''... praisonai = PraisonAI(agent_file="{agents_file}") ... "agent_file": "{agents_file}" ...''' ``` The generated code is then executed (line 190): ```python subprocess.Popen(['python', server_file]) ``` `agents_file` is never sanitized or validated. A malicious value breaks out of the string context: ```python 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 ```python # 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

CVE-2026-62176 Affected PraisonAI Versions

1 component(s)
Fixed Versions:
4.6.78
Product / Package Ecosystem Affected Versions Fixed Version
PraisonAI
PyPI
< 4.6.78
4.6.78

References

Frequently Asked Questions

What is CVE-2026-62176?
CVE-2026-62176 is a security vulnerability in PraisonAI involving Code Injection via f-string Interpolation in Deploy API Server Generation under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which PraisonAI versions are affected?
Affected versions include releases prior to 4.6.78 across affected packages: PraisonAI.
What version fixes CVE-2026-62176?
Upgrading to 4.6.78 (or the latest patched release for your respective branch) resolves the vulnerability.
Is PraisonAI affected?
Yes, PraisonAI is affected in releases prior to 4.6.78. Upgrade your dependency to 4.6.78 or later.
What is the CVSS score of CVE-2026-62176?
CVE-2026-62176 has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2026-62176?
CVE-2026-62176 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check PyPI dependencies for CVE-2026-62176?
Run the dependency tree command: 'pip show PraisonAI'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-g6j7-pffp-8whg",
  "modified" : "2026-10-07T16:05:53Z",
  "published" : "2026-10-07T16:05:53Z",
  "aliases" : [ "CVE-2026-62176" ],
  "summary" : "PraisonAI: Code Injection via f-string Interpolation in Deploy API Server Generation",
  "details" : "### Summary\nThe `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.\n\n### Details\n\n`src/praisonai/praisonai/deploy/api.py` (line 80):\n\n```python\ncode = f'''...\n    praisonai = PraisonAI(agent_file=\"{agents_file}\")\n...\n    \"agent_file\": \"{agents_file}\"\n...'''\n```\n\nThe generated code is then executed (line 190):\n```python\nsubprocess.Popen(['python', server_file])\n```\n\n`agents_file` is never sanitized or validated. A malicious value breaks out of the string context:\n\n```python\nagents_file = '\"); import os; os.system(\"id\"); #'\n# Generated code becomes:\n# praisonai = PraisonAI(agent_file=\"\"); import os; os.system(\"id\"); #\")\n```\n\nThe same pattern exists in `deploy/docker.py` (line 33) for Dockerfile generation.\n\n\n### PoC\n\n```python\n# The injection:\nagents_file = '\"); import os; os.system(\"id\"); #'\n\n# What the generated code looks like:\ntemplate = f'praisonai = PraisonAI(agent_file=\"{agents_file}\")'\nprint(template)\n# Output: praisonai = PraisonAI(agent_file=\"\"); import os; os.system(\"id\"); #\")\n```\n\n### Impact\n- **Arbitrary code execution** on the machine running the deploy command\n- **Supply chain risk** if `agents_file` comes from a configuration file or CI/CD pipeline",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "PraisonAI"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.6.78"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 4.6.77"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-g6j7-pffp-8whg"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/MervinPraison/PraisonAI"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-07T16:05:53Z",
    "nvd_published_at" : null
  }
}