/

CVE-2026-40088

Severity:

CRITICAL RISK

(9.6)

OS Command Injection in PraisonAI Multi-Agent Workflows

CVE-2026-40088

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.6)

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 multi-agent workflow system previously allowed user-controlled input, YAML workflow definitions, and LLM-generated tool calls to flow directly into shell execution paths.

By injecting shell metacharacters, an attacker could cause the platform to run arbitrary OS commands with the privileges of the PraisonAI process.

Affected context

This vulnerability appears in PraisonAI deployments where agent workflows, YAML-based task definitions, or LLM tool calls can influence shell commands.

Environments are notably exposed when:

  • Agents are configured to use execute_command or similar shell-backed tools
  • Workflow definitions or prompts are editable by untrusted or semi-trusted users
  • LLM-generated arguments are passed directly into shell execution without strict validation

The issue manifests both in explicit workflow shell steps and in generic command execution helpers invoked by agents.

Exploit preconditions

  • Attack surface: PraisonAI workflow interfaces, agent configuration, and APIs that allow providing prompts, YAML definitions, or tool parameters.
  • Required access: Ability to define or influence agent workflows, tool arguments, or prompt content that will be used to construct shell commands (e.g., end-user access to agents, collaborative workflow editing, or compromised upstream input sources).
  • Trigger point: Execution of a workflow step or agent tool that calls execute_command or a shell-based action, where untrusted input is concatenated or interpolated into the command string.
  • Why exploitation is possible: The command execution layer processes user/LLM-controlled strings in a shell context without robust escaping, argument separation, or allowlisting, permitting shell metacharacters to alter the intended command and inject additional operations.

Why this happens

The underlying flaw is a classic OS Command Injection pattern as described by CWE-78.

PraisonAI exposed shell execution functionality to higher-level workflows and agent tools but allowed untrusted data—originating from user inputs, YAML workflow parameters, or LLM-generated tool calls—to be embedded directly into shell command strings.

When these composite strings are passed to a shell, characters such as ;, &&, |, and backticks can change control flow, append new commands, or redirect output.

The absence of strict input validation, argument-level escaping, and safe command construction primitives created a pathway where data became executable instructions at the operating system level.

Potential impact

  • Execution of arbitrary OS commands under the PraisonAI service account.
  • Unauthorized access to sensitive data (configuration files, API keys, model prompts, or logs).
  • File system manipulation, including creation, modification, or deletion of data used by workflows.
  • Lateral movement within the hosting environment, such as pivoting to databases or internal services.
  • Deployment of malware, cryptominers, or backdoors on the underlying host.
  • Disruption of AI workflows, data poisoning of models or prompts, and sabotage of multi-agent processes.

General mitigation guidance

Reducing risk from OS command injection in agent-based systems requires separating data from executable commands and constraining what actions workflows can perform.

Consider the following defensive patterns:

  • Prefer non-shell APIs: Use language-native libraries or SDKs (e.g., filesystem, network, SCM clients, package managers) instead of generic shell commands wherever possible.
  • Enforce strict command templates: Define an allowlisted set of commands or subcommands that agents can run, with parameter positions and types explicitly constrained (e.g., enums, numeric ranges, sanitized filenames).
  • Use argument-based execution: When shell access is unavoidable, construct commands using APIs that accept argument arrays (e.g., subprocess with shell=False in Python) and treat all input as data, not shell snippets.
  • Apply robust validation and normalization: Validate workflow parameters and tool arguments against schemas, pattern checks, and type constraints; reject or neutralize shell metacharacters that have no legitimate purpose.
  • Limit privileges and environment: Run PraisonAI and its workers under least-privilege accounts, apply OS-level sandboxing (containers, seccomp, AppArmor, SELinux), and restrict filesystem and network access to only what workflows need.
  • Separate trusted and untrusted workflows: Use distinct agents, queues, or execution environments for workflows that consume untrusted user input versus fully internal automation tasks.

How teams detect issues like this

Organizations can look for this class of issue by combining static code analysis, configuration review, and runtime monitoring:

  • Static analysis and SAST rules:
  • Flag any code paths that invoke shell commands (execute_command, subprocess with shell=True, or equivalent) where input arguments derive from user-controllable fields, YAML definitions, or LLM outputs.
  • Track data flow from workflow configuration, API endpoints, and prompt tooling into command execution without sanitization or validation boundaries.
  • Configuration and workflow review:
  • Manually inspect YAML workflows and agent definitions that use generic shell tools or free-form command fields.
  • Review prompt templates and tool definitions that instruct LLMs to construct or modify shell commands.
  • Policy enforcement in CI/CD:
  • Enforce guardrails that disallow new shell-backed tools unless they follow approved safe patterns.
  • Require security review for workflow steps that introduce or modify OS-level actions.
  • Runtime monitoring and logging:
  • Enable detailed command execution logging for agent workflows, focusing on unexpected metacharacters, chained commands, or unusual destinations.
  • Integrate host-level IDS/IPS or EDR tools to alert on anomalous command sequences originating from PraisonAI processes.

Sources

SourceLink
github.comgithub.com/MervinPraison/PraisonAI/releases/tag/v4.5.121
github.comgithub.com/MervinPraison/PraisonAI/security/advisories/GHSA-2763-cj5r-c79m

Frequently asked

questions

Yes, in many deployments it can be reachable remotely. If users or external systems can supply prompts, configure workflows, or invoke agents that ultimately reach shell-backed tools, they may be able to trigger command injection over the network.

An attacker needs the ability to influence agent workflows, YAML definitions, or tool arguments—typically via API access, web UI interaction, or control of upstream data that prompts consume. Direct host access is not required; control of the workflow inputs is sufficient.

Replace generic shell execution with narrowly scoped, library-based operations; where shell execution is unavoidable, use argument-safe execution APIs, fixed command templates, and strict allowlisting of permitted arguments, combined with strong input validation.

Treat all data from users, configuration files, and LLMs as untrusted, and design tools so that they expose high-level actions rather than raw command strings. Apply least-privilege principles, enforce schema-driven validation for workflow parameters, and adopt secure coding guidelines and automated checks for any feature that crosses from data handling into code or OS-level execution.

Find out what's already
exploitable in your codebase.