/

CVE-2026-34935

Severity:

CRITICAL RISK

(9.8)

OS Command Injection in PraisonAI Multi‑Agent System

CVE-2026-34935

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution / Arbitrary OS Command Execution

Severity:

CRITICAL RISK

(9.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 versions 4.5.15 through 4.5.68 contain an OS command injection flaw where the --mcp CLI argument is passed directly into process creation without any validation or restriction.

An attacker who can control this argument can execute arbitrary operating system commands with the privileges of the PraisonAI process user.

Affected context

This vulnerability appears in PraisonAI's command-line interface, specifically when the --mcp argument is accepted and used to launch external processes.

The issue is present where:

  • User-supplied CLI parameters are parsed with shlex.split()
  • The resulting arguments are passed directly to anyio.open_process() or equivalent process-spawning functions
  • No allowlist, normalization, or command structure validation is enforced on the --mcp value

It is most relevant in deployments where untrusted or semi-trusted users can invoke PraisonAI with custom command-line options, such as shared servers, multi-tenant environments, CI/CD jobs, or automated integration scripts.

Exploit preconditions

  • Attack surface: PraisonAI command-line interface (praisonai or equivalent launcher)
  • Required access: Ability to run PraisonAI with a user-controlled --mcp argument (locally, via scripts, or via any wrapper service that proxies CLI input)
  • Trigger point: Invocation of PraisonAI where the --mcp parameter is parsed with shlex.split() and the result is passed to anyio.open_process()
  • Why exploitation is possible:
  • The --mcp value is treated as trusted command text
  • There is no allowlist of permitted binaries, flags, or argument patterns
  • The value flows unvalidated into process creation, enabling the attacker to craft arbitrary commands or arguments for execution

Why this happens

The underlying issue is improper neutralization of user-controlled input used in OS command execution, matching CWE-78: Improper Neutralization of Special Elements used in an OS Command.

Conceptually:

  • A CLI parameter (--mcp) is treated as configuration but is effectively a free-form command specification.
  • The application passes this parameter through shlex.split() (which parses, but does not secure, shell-style text) and then into anyio.open_process().
  • There is no semantic validation, allowlisting, or constraint of which executable can be run or which arguments are acceptable.

This pattern allows an attacker to escalate the configuration capability (choosing a tool or endpoint) into direct authority over the process command line, enabling arbitrary code execution with the application's runtime privileges.

Potential impact

  • Execution of arbitrary OS commands as the PraisonAI process user
  • Reading, modifying, or deleting files accessible to that user
  • Exfiltration of API keys, model credentials, or configuration secrets stored in the environment
  • Tampering with multi-agent workflows to perform malicious operations against downstream systems
  • Pivoting to other services on the same host or network segment
  • Denial of service by spawning resource-exhausting processes or terminating critical components

General mitigation guidance

Effective mitigation focuses on removing direct command control from untrusted inputs and constraining process execution behavior.

Pattern-level approaches include:

  • Allowlisted execution: Restrict the --mcp parameter to a predefined set of known-safe identifiers or modes, which are internally mapped to fixed, vetted commands or configuration objects, not raw command strings.
  • Structured configuration instead of raw commands: Represent external tools, connectors, or providers as structured config (e.g., JSON/YAML objects or enums) rather than letting users provide arbitrary command-line fragments.
  • Argument validation: Where user input influences arguments, validate against strict schemas (types, ranges, pattern checks) and reject any unexpected tokens or executable paths.
  • Privilege reduction: Run PraisonAI under a minimally privileged account, with restricted filesystem and network access, to limit damage if command execution does occur.
  • Execution policy enforcement: Centralize process-spawning logic in a utility that enforces policies (fixed binary, known arguments, no shell interpretation) rather than allowing arbitrary command assembly in different parts of the codebase.
  • Configuration separation: Clearly separate configuration values from operational commands, and avoid treating any user-supplied config as executable instructions.

How teams detect issues like this

Detection can rely on both code-centric and operational signals:

  • Static analysis patterns:
  • Flag uses of anyio.open_process(), subprocess, or similar process APIs where any argument is derived from CLI parameters without validation.
  • Identify flows from option parsers (e.g., argparse, click, Typer) into process execution functions, especially when intermediaries like shlex.split() are used.
  • Add custom rules to SAST tools for CWE-78 targeting this pattern: user_input -> parse -> open_process.
  • Code review indicators:
  • Look for CLI flags that directly specify commands, binaries, or endpoints.
  • Review any abstraction that allows "user-defined tools" or "dynamic connectors" to ensure they do not translate into arbitrary command execution.
  • Check that any mappings from IDs to commands are closed sets (enums/allowlists) rather than free-form strings.
  • Runtime monitoring:
  • Log invocations of external processes initiated by PraisonAI with sufficient metadata (caller context, arguments, tenant/user identity where applicable).
  • Monitor for anomalous process execution patterns, such as unexpected binaries, network tools, or shells being launched by the PraisonAI user.
  • Policy enforcement:
  • Use host-level controls (e.g., seccomp, AppArmor, SELinux, container runtime policies) to restrict which binaries PraisonAI can execute, and alert on violations.

Sources

SourceLink
github.comgithub.com/MervinPraison/PraisonAI/commit/47bff65413beaa3c21bf633c1fae4e684348368c
github.comgithub.com/MervinPraison/PraisonAI/security/advisories/GHSA-9gm9-c8mq-vq7m

Frequently asked

questions

It can be, depending on how PraisonAI is exposed. If a remote user or service can cause PraisonAI to run with an attacker-controlled --mcp value (for example via an API, job scheduler, web UI, or shared script), then remote exploitation is possible. If only local administrators can supply this parameter, the exposure is reduced but still significant.

The attacker must be able to influence the --mcp argument passed to PraisonAI. This could be direct shell access to run the CLI, control over automation that launches PraisonAI, or any integration that proxies user input into that parameter without strict validation.

The most robust fix is to eliminate the ability for --mcp to carry arbitrary command strings. Instead, constrain it to symbolic identifiers or configuration options that are mapped internally to fixed, known-safe behavior, with no direct control over the executed command or binary paths.

Treat all CLI and configuration inputs as untrusted, especially when they influence process creation. Enforce strong allowlists for any option that can affect commands, avoid passing free-form strings into process execution APIs, centralize command-launching logic behind strict policies, and use static analysis or code review checklists to catch CWE-78 patterns before release.

Find out what's already
exploitable in your codebase.