/

CVE-2026-44334

Severity:

HIGH RISK

(8.4)

Code Injection in PraisonAI Recipe Runner

CVE-2026-44334

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution

Severity:

HIGH RISK

(8.4)

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's recipe runner contains an unguarded auto-import of a local tools.py file that allows remote recipes to inject and execute arbitrary Python code on the server.

Between versions 4.5.139 and 4.6.31, an attacker can point a recipe at a local path or GitHub repository, drop a tools.py next to TEMPLATE.yaml, and have it executed without authentication or explicit admin opt-in.

Affected context

The vulnerability affects PraisonAI multi-agent team deployments using versions 4.5.139 through 4.6.31 where:

  • The recipe runner endpoint /v1/recipes/run is exposed (e.g., via API, UI, or reverse proxy).
  • The default configuration is used, where SecurityConfig.allow_any_github is set to True.
  • Recipes can reference arbitrary local absolute paths or GitHub repositories as their source.

In this context, praisonai/templates/tool_override.py auto-imports and executes a tools.py module located adjacent to a TEMPLATE.yaml file without checking an environment gate like PRAISONAI_ALLOW_LOCAL_TOOLS.

Exploit preconditions

  • Attack surface: HTTP API endpoint POST /v1/recipes/run, typically reachable wherever the PraisonAI server is exposed.
  • Required access: No authentication required under default settings; attacker only needs network access to the API.
  • Trigger point: Supplying a recipe definition that points to:
  • A local absolute path controlled or influenced by the attacker, or
  • A GitHub repository (since allow_any_github defaults to True).
  • Why exploitation is possible:
  • praisonai/templates/tool_override.py imports and executes tools.py via exec_module() automatically on every recipe execution.
  • This import sink is not gated by the PRAISONAI_ALLOW_LOCAL_TOOLS environment flag that protects other auto-import paths.
  • The recipe runner trusts the referenced path or GitHub repo and pulls in code adjacent to TEMPLATE.yaml without validation, leading to arbitrary code execution in the server context.

Why this happens

The underlying issue is an incomplete fix for a prior vulnerability (CVE-2026-40287) where only some auto-import sinks were guarded behind an explicit opt-in flag (PRAISONAI_ALLOW_LOCAL_TOOLS=true).

While tool_resolver.py and api/call.py were updated, the third import path in praisonai/templates/tool_override.py was left unguarded.

This results in CWE-94: Improper Control of Generation of Code (Code Injection), where:

  • Untrusted remote input (the recipe path or GitHub URL) controls which Python module is loaded.
  • The system blindly executes the tools.py module adjacent to TEMPLATE.yaml using exec_module().
  • There is no validation, sandboxing, or configuration gate to separate user-supplied templates from trusted server-side code.

Conceptually, this is an insecure dynamic code loading pattern: configuration or content locations implicitly double as executable code sources.

Potential impact

  • Remote execution of arbitrary Python code with the privileges of the PraisonAI server process.
  • Full compromise of the application environment, including access to connected tools, APIs, and data sources.
  • Theft or modification of sensitive data processed or stored by PraisonAI.
  • Use of the compromised server as a pivot point for lateral movement within the infrastructure.
  • Deployment of persistent backdoors or malicious logic inside the multi-agent workflow.
  • Supply-chain style abuse where malicious templates in GitHub repos affect multiple deployments that reference them.

General mitigation guidance

Effective mitigation focuses on removing implicit code execution from untrusted recipes and enforcing explicit trust boundaries:

  • Eliminate automatic code execution from content locations:
  • Avoid auto-importing and executing tools.py or any dynamic module based solely on template paths or Git repos.
  • Treat templates and recipes as data, and keep executable code in separately controlled, vetted locations.
  • Introduce explicit trust and opt-in mechanisms:
  • Require a configuration flag or allowlist to enable loading custom tooling from local paths or external repositories.
  • Restrict accepted GitHub sources to curated, signed, or organization-controlled repositories rather than arbitrary URLs.
  • Constrain execution privileges:
  • Run PraisonAI services under least-privilege OS accounts and minimize their filesystem and network access.
  • Consider process-level or container sandboxing for any component that might interpret user-controlled code.
  • Harden configuration and deployment:
  • Place the /v1/recipes/run endpoint behind authentication and authorization controls.
  • Separate environments for experimentation (where custom tools are allowed) from production (where they are not).
  • Apply secure-by-default patterns:
  • Default configurations should disallow loading code from user-controlled paths or repos, requiring explicit administrator opt-in.
  • Use clear configuration toggles and documentation so operators understand when they are enabling remote code execution behavior.

How teams detect issues like this

Organizations can detect and monitor for similar code injection risks using a combination of code-centric and runtime approaches:

  • Static analysis and linting:
  • Search for dynamic module loading and execution patterns (exec_module, importlib, exec, eval) that are fed by configuration or network inputs.
  • Flag file-system or repository-based imports that are not guarded by explicit configuration checks or input validation.
  • Use custom static analysis rules to ensure all auto-import sites are consistently wrapped with security gates (e.g., environment flags, allowlists).
  • Code review practices:
  • During review, scrutinize any feature that loads tools, plugins, or scripts from templates, recipes, or external repositories.
  • Verify that fixes for previous vulnerabilities update all related code paths, not just the originally reported ones.
  • Configuration and policy enforcement:
  • Enforce policies that disable or restrict loading of code from arbitrary URLs or local paths in production builds.
  • Integrate security checks into CI/CD to block deployments when dangerous patterns are introduced without proper gating.
  • Runtime monitoring and logging:
  • Log all recipe executions, including the source path or repository and any dynamic tool loading events.
  • Monitor for unusual patterns, such as recipes referencing unexpected absolute paths or unknown GitHub repos.
  • Use endpoint or container security tools to detect suspicious process behavior originating from the PraisonAI service.

Sources

SourceLink
github.comgithub.com/MervinPraison/PraisonAI/security/advisories/GHSA-xcmw-grxf-wjhj

Frequently asked

questions

Yes. When the /v1/recipes/run endpoint is exposed and defaults are used, an attacker with network access can supply a malicious recipe that causes the server to load and execute a crafted tools.py from a local path or GitHub repository.

Under default settings, no authentication is required. The attacker only needs network reachability to the API endpoint. This makes it suitable for unauthenticated exploitation unless operators have added their own access controls.

The safest pattern is to decouple templates/recipes from executable code: do not auto-import tools.py (or similar modules) from user-controlled locations. Where extensibility is required, use an explicit plugin system with allowlists, configuration gates, and rigorous validation of any code source.

Design extensibility mechanisms with a "data vs. code" separation, avoid implicit code execution driven by configuration or URLs, and make secure behavior the default. Combine this with static analysis for dynamic execution APIs, consistent security gating patterns, thorough regression testing for previously vulnerable areas, and mandatory security review for features that load plugins, tools, or templates from external sources.

Find out what's already
exploitable in your codebase.