Executive brief
The nmap-mcp-server is a Model Context Protocol server that integrates the Nmap network scanning tool. It contains a command injection vulnerability in its Nmap command handler that allows remote, authenticated attackers to execute arbitrary shell commands on the server by manipulating the additionalFlags parameter passed to the underlying system command execution function.
Technical details
The vulnerability is a classic command injection flaw (CWE-74, CWE-77) in the runNmapScan function where user-supplied additionalFlags parameter is directly concatenated into a shell command executed via child_process.exec() without validation or escaping. The vulnerable component is the Nmap CLI Command Handler in src/index.ts. An authenticated remote attacker can inject shell metacharacters (semicolons, &&, pipes, etc.) through the additionalFlags parameter to break out of the intended nmap command and execute arbitrary system commands. The attack requires network access and valid authentication (PR:L). Affected versions through 1.0.1 are vulnerable; a patch has been published (commit 30a6b9e1c7fa6146f51e28d6ab83a2568d9a3488).
Affected products
- PhialsBasement nmap-mcp-server up to 1.0.1
Timeline
- 2026-01-19: disclosed: Vulnerability reported on GitHub issue #7
- 2026-03-03: advisory: GHSA-xc68-rrqc-qgq3 published
- 2026-03-03: patched: Patch available as commit 30a6b9e1c7fa6146f51e28d6ab83a2568d9a3488