PhialsBasement nmap-mcp-server Command Injection Vulnerability

Vulnerability

A command injection vulnerability exists in PhialsBasement nmap-mcp-server versions through bee6d23547d57ae02460022f7c78ac0893092e38. The issue arises in the Nmap CLI Command Handler, specifically within the child_process.exec function in src/index.ts. This vulnerability allows remote attackers to execute arbitrary commands by injecting shell metacharacters into the additionalFlags parameter, which is not properly validated before being passed to the command execution function.

Impact

Exploitation of this vulnerability could lead to arbitrary command execution on the server where the MCP Nmap server is running.

Reproduction

To reproduce this vulnerability, use the 'run_nmap_scan' function and include unvalidated input in the 'additionalFlags' parameter. The injected characters can be used to execute arbitrary commands on the server.

Remediation

Users are advised to update to the latest version of nmap-mcp-server, where this vulnerability has been fixed by replacing the exec() function with execFile(), and implementing a validation allowlist for the additionalFlags parameter.

Added: Mar 3, 2026, 8:20 PM
Updated: Mar 3, 2026, 10:05 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
10.0
exploitability
8.7
remediation
0.0
relevance
3.4
threat
6.4
urgency
2.9
incentive
4.2

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.