Описание
PraisonAI Vulnerable to OS Command Injection
The execute_command function and workflow shell execution are exposed to user-controlled input via agent workflows, YAML definitions, and LLM-generated tool calls, allowing attackers to inject arbitrary shell commands through shell metacharacters.
Description
PraisonAI's workflow system and command execution tools pass user-controlled input directly to subprocess.run() with shell=True, enabling command injection attacks. Input sources include:
- YAML workflow step definitions
- Agent configuration files (agents.yaml)
- LLM-generated tool call parameters
- Recipe step configurations
The shell=True parameter causes the shell to interpret metacharacters (;, |, &&, $(), etc.), allowing attackers to execute arbitrary commands beyond the intended operation.
Affected Code
Primary command execution (shell=True default):
Workflow shell step execution:
Action orchestrator shell execution:
Input Paths to Vulnerable Code
Path 1: YAML Workflow Definition
Users define workflows in YAML files that are parsed and executed:
The target field is passed directly to _exec_shell() without sanitization.
Path 2: Agent Configuration
Agent definitions in agents.yaml can specify shell commands:
Path 3: Recipe Step Configuration
Recipe YAML files can contain shell command steps that get executed when the recipe runs.
Path 4: LLM-Generated Tool Calls
When using agent mode, the LLM can generate tool calls including shell commands:
Proof of Concept
PoC 1: YAML Workflow Injection
Malicious workflow file:
Execution:
Result: Both the echo and curl commands execute. The curl command exfiltrates /etc/passwd to the attacker's server.
PoC 2: Agent Configuration Injection
Malicious agents.yaml:
Execution:
Result: The wget command sends the user's private SSH key to attacker's server.
PoC 3: Direct API Injection
PoC 4: LLM Prompt Injection Chain
If an attacker can influence the LLM's context (via prompt injection in a document the agent processes), they can generate malicious tool calls:
Impact
This vulnerability allows execution of unintended shell commands when untrusted input is processed.
An attacker can:
- Read sensitive files and exfiltrate data
- Modify or delete system files
- Execute arbitrary commands with user privileges
In automated environments (e.g., CI/CD or agent workflows), this may occur without user awareness, leading to full system compromise.
Attack Scenarios
Scenario 1: Shared Repository Attack
Attacker submits PR to open-source AI project containing malicious agents.yaml. CI pipeline runs praisonai → Command injection executes in CI environment → Secrets stolen.
Scenario 2: Agent Marketplace Poisoning
Malicious agent published to marketplace with "helpful" shell commands. Users download and run → Backdoor installed.
Scenario 3: Document-Based Prompt Injection
Attacker shares document with hidden prompt injection. Agent processes document → LLM generates malicious shell command → RCE.
Remediation
Immediate
-
Disable shell by default Use
shell=Falseunless explicitly required. -
Validate input Reject commands containing dangerous characters (
;,|,&,$, etc.). -
Use safe execution Pass commands as argument lists instead of raw strings.
Short-term
-
Allowlist commands Only permit trusted commands in workflows.
-
Require explicit opt-in Enable shell execution only when clearly specified.
-
Add logging Log all executed commands for monitoring and auditing.
Researcher
Lakshmikanthan K (letchupkt)
Ссылки
- https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-2763-cj5r-c79m
- https://nvd.nist.gov/vuln/detail/CVE-2026-40088
- https://github.com/MervinPraison/PraisonAI/releases/tag/v4.5.121
- https://github.com/pypa/advisory-database/tree/main/vulns/praisonai/PYSEC-2026-461.yaml
- https://pypi.org/project/praisonai
Пакеты
PraisonAI
< 4.5.121
4.5.121
Связанные уязвимости
PraisonAI is a multi-agent teams system. Prior to 4.5.121, the execute_command function and workflow shell execution are exposed to user-controlled input via agent workflows, YAML definitions, and LLM-generated tool calls, allowing attackers to inject arbitrary shell commands through shell metacharacters. This vulnerability is fixed in 4.5.121.