/

CVE-2026-61433

Severity:

HIGH RISK

(7.8)

Code Injection (CWE-94) in PraisonAI API Generator

CVE-2026-61433

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Arbitrary Code Execution

Severity:

HIGH RISK

(7.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

PraisonAI before 4.6.78 generates Python API server code using unencoded configuration values, enabling direct injection of Python expressions.

If an attacker can control deploy.api.host or agents_file settings, these expressions may execute when the generated server starts or processes requests, leading to arbitrary code execution.

Affected context

This vulnerability affects environments where PraisonAI is used to generate Python-based API servers from configuration files or deployment descriptors.

Risk increases when configuration sources such as deploy.api.host and agents_file can be influenced by untrusted users, external systems, or shared configuration repositories.

The issue is most relevant in automated deployment pipelines, multi-tenant setups, or collaborative projects where configuration integrity is not strictly enforced.

Exploit preconditions

  • Attack surface: Configuration-driven code generation for Python API servers.
  • Required access: Ability to modify or supply deploy.api.host or agents_file configuration values used by PraisonAI.
  • Trigger point: Execution of the generated Python server code at startup or during request handling.
  • Why exploitation is possible: Configuration values are interpolated directly into Python source without proper encoding or sanitization, allowing attacker-controlled expressions to be executed as part of the application logic.

Why this happens

The core issue is treating configuration data as trusted code when generating Python source for API servers.

PraisonAI embeds configuration values directly into executable Python constructs without escaping, quoting, or separating data from logic, which maps to CWE-94: Improper Control of Generation of Code.

This design pattern blurs the boundary between configuration and code, allowing attacker-supplied strings to become part of the program, and to run with the privileges of the API server process.

Potential impact

  • Attackers can execute arbitrary Python code on the server.
  • Compromise of application logic and sensitive runtime data.
  • Modification or exfiltration of configuration, prompts, or agent definitions.
  • Installation of persistent backdoors within generated API servers.
  • Lateral movement to other services reachable from the compromised server.

General mitigation guidance

Effective mitigation focuses on re-establishing a strict separation between configuration data and executable code in code generation workflows.

Common patterns include:

  • Treat configuration values as data only, ensuring they are safely quoted, escaped, or passed as runtime parameters rather than inlined into source code.
  • Use templating engines or code generation frameworks that enforce variable escaping and disallow raw expression injection.
  • Validate and constrain configuration inputs to expected formats (e.g., hostnames, file paths) instead of arbitrary strings or expressions.
  • Run generated servers with least privilege and minimize accessible capabilities to limit impact if configuration is misused.
  • Prefer secure-by-default generation options that avoid exposing powerful evaluation or dynamic execution constructs in the generated code.

How teams detect issues like this

Detection typically involves reviewing both the code generator and the produced artifacts for unsafe code construction patterns.

Useful approaches include:

  • Static analysis rules that flag string interpolation, eval-like behavior, or direct insertion of configuration values into executable Python statements.
  • Code review checklists that focus on templates and generation logic, ensuring configuration variables are always treated as data and properly escaped.
  • Policies in CI/CD that prevent deployment of generated code containing suspicious constructs (e.g., exec, eval, __import__ controlled by configuration).
  • Optional use of automated security scanners that analyze generated Python sources for injection-prone patterns and high-risk dynamic execution calls.

Sources

SourceLink
github.comgithub.com/MervinPraison/PraisonAI/commit/1620b49f36945d8cc8ee5635b906c960df5097a0
github.comgithub.com/MervinPraison/PraisonAI/security/advisories/GHSA-79fv-7hq9-w7xg
vulncheck.comvulncheck.com/advisories/praisonai-before-code-injection-via-api-deployment-generator

Frequently asked

questions

Exploitability depends on who can modify PraisonAI deployment configurations. In environments where configuration files or parameters can be influenced by untrusted or semi-trusted parties, the vulnerability can be widely exploitable.

An attacker must be able to control deploy.api.host or agents_file configuration values that PraisonAI consumes during API server generation. This may occur through direct file access, configuration management systems, or user-facing configuration interfaces.

The safest pattern is to ensure configuration values are never treated as executable code. They should be escaped, quoted, or passed as runtime parameters and constrained to specific data formats, with the code generator avoiding any direct evaluation of configuration strings.

Future tools should adopt secure-by-design code generation practices, enforce strict separation between code and configuration, include validation and escaping for all injected variables, and rely on automated checks in CI/CD to detect dynamic execution constructs that can be influenced by configuration.

Find out what's already
exploitable in your codebase.