MCP-Kali-Server
- Type
- MCP server
- Scanned
- Nov 17, 2026
- Version
- 18fdf22b28f5
- Files read
- 52
MCP-Kali-Server connects AI coding agents to a Flask HTTP server on Kali Linux to run security tools, manage SSH and reverse shell sessions, and transfer files. Its biggest risk is that the Kali API server listens on 0.0.0.0:5000 with no authentication or browser Origin checks, allowing anyone on the same network, shared VPN, or a malicious website to execute arbitrary commands on the Kali machine.
What it can reach
- Shell commands
- Executes arbitrary shell commands on the Kali host, runs security scanning and exploitation CLI tools, starts reverse shell listeners, and runs commands inside remote SSH and reverse shell sessions.
- Files
- Uploads and downloads files on the Kali server filesystem and transfers files to and from remote SSH and reverse shell targets.
- Network
- Runs an HTTP server bound to 0.0.0.0:5000, sends HTTP requests between the MCP bridge and Kali server, opens TCP ports for reverse shells, and initiates outbound scan and SSH connections.
- System
- Reads network interface and routing configuration and, when started with the --test flag, builds and runs Docker containers on the Kali host.
- Secrets
- Accepts SSH passwords and private key paths from tool calls and passes them to ssh and sshpass on the Kali server.
Findings
-
CriticalUnauthenticated HTTP API bound to 0.0.0.0 exposes remote command execution and file access
kali-server/kali_server.py:174
The Kali Flask server binds to all network interfaces (0.0.0.0:5000) and implements no API key, password, or Host and Origin validation on endpoints such as /api/command, /api/kali/upload, and /api/kali/download. Anyone on the local Wi-Fi or LAN, another participant on a shared lab VPN (such as the HackTheBox VPN interface recommended in the tutorial), or a website the user visits in a browser (via DNS rebinding) can run arbitrary shell commands and read or write files on the Kali machine with no AI agent involvement.
Fix: Bind the server to 127.0.0.1 by default, require a strong authentication token on all API routes, and validate Host and Origin headers to block DNS rebinding and cross-origin browser requests.
-
MediumTest mode exposes an intentionally vulnerable Docker container on all network interfaces
kali-server/core/docker_manager.py:266
When kali_server.py is started with --test (as shown in the Quick Start guide in install.md), DockerManager launches a container running SSH with hardcoded credentials (root:rootpass and testuser:testpass) on port 2222 and Apache with unauthenticated PHP command-execution scripts on port 8080. Although startup logs and documentation claim these services listen on localhost, passing -p without 127.0.0.1 publishes ports 2222, 4444, 4445, and 8080 on 0.0.0.0 across all host network interfaces and bypasses standard host firewall rules, letting anyone on the network compromise the container.
Fix: Bind all published test container ports strictly to loopback, such as 127.0.0.1:2222:22 and 127.0.0.1:8080:8080.
-
MediumShell command injection in dedicated scanning tools bypasses per-tool client approvals
kali-server/tools/kali_tools.py:789
Nearly all dedicated tool wrappers (such as tools_waybackurls, tools_nmap, tools_sqlmap, tools_gobuster, and search_shodan) interpolate untrusted parameters like domain, target, url, and additional_args directly into a shell command string executed with shell=True. If a user approves only specific reconnaissance tools in their MCP client while keeping the general command tool disabled, prompt injection in a webpage or target response can inject shell metacharacters into a scan parameter to execute arbitrary OS commands on the Kali server.
Fix: Execute tools with subprocess.Popen using an argument list and shell=False, and strictly validate target hostnames, URLs, and flags.
-
MediumUnencrypted HTTP between MCP server and Kali server exposes credentials and files in transit
The documented multi-host setup connects mcp_server.py to kali_server.py over plain HTTP (for example http://192.168.1.100:5000) with no TLS support. When used across a network rather than over loopback, SSH passwords sent to ssh_session_start, shell commands, and downloaded files travel in cleartext and can be intercepted or modified by anyone on the network path.
Fix: Require HTTPS with certificate verification for non-loopback Kali server URLs, or instruct users to tunnel the connection over SSH.
-
LowBypassable path and symlink checks on Kali file upload and download
kali-server/utils/transfer_manager.py:460
The upload and download helpers attempt to block directory traversal, symlinks, and sensitive paths like /etc/, /sys/, /proc/, and /etc/shadow, but they check string prefixes before normalizing the path and call os.path.abspath instead of os.path.realpath. Non-canonical prefixes (such as //etc/ or /etc/./), symlinks inside the working directory, sensitive user paths like ~/.ssh/authorized_keys, and the unvalidated local_file parameter in target_upload_file and target_download_file bypass these restrictions.
Fix: Resolve paths with os.path.realpath before checking allowed directories, enforce an explicit allowlist workspace directory for file transfers, and apply the same check to target_upload_file and target_download_file.
-
LowSSH session manager disables host key verification
kali-server/core/ssh_manager.py:43
SSHSessionManager passes StrictHostKeyChecking=no on every outbound SSH connection, accepting any host key without verification. An active attacker on the network between the Kali machine and the SSH target can intercept the connection and capture credentials or spoof command results.
Fix: Use StrictHostKeyChecking=accept-new or allow callers to supply an expected known_hosts file unless insecure mode is explicitly requested.
-
LowSSH passwords passed on the sshpass command line are visible to local users
kali-server/core/ssh_manager.py:57
When password authentication is used, SSHSessionManager invokes sshpass with -p followed by the plaintext password as a command-line argument. For the entire duration of the SSH session, any other local user on the Kali system can read the password from the process list (/proc/<pid>/cmdline or ps).
Fix: Pass the password via the SSHPASS environment variable using sshpass -e or through a file descriptor with sshpass -d instead of -p.
