kalilinuxmcp
- Type
- MCP server
- Scanned
- Nov 17, 2026
- Version
- 3f65fb51e270
- Files read
- 20
This MCP server connects an AI coding agent over SSH to a Dockerized Kali Linux environment to run command-line and interactive security testing tools, with an optional web dashboard for live output. The biggest risk is that its Dockerfile enables root SSH login with the password 'kali' on a privileged container exposed to the network, letting anyone on the same network take full control of the host computer.
What it can reach
- Shell commands
- Runs arbitrary non-interactive and interactive shell commands as root over SSH inside the configured Kali Linux environment.
- Secrets
- Reads an SSH private key file from the host machine to authenticate to the Kali SSH server.
- Network
- Connects to localhost:2222 over SSH, posts all executed commands and outputs over HTTP to localhost:3000 (or REALTIME_VIEWER_URL), and includes a companion web/WebSocket server on port 3000.
- System
- Provides a Kali Linux Docker setup instructed to run with --privileged and port 2222 published, granting container processes unrestricted access to host devices and kernel capabilities.
Findings
-
CriticalHardcoded root:kali SSH password on network-exposed privileged container
The Dockerfile sets the root password to 'kali' and enables password-based root SSH login (PermitRootLogin yes), in addition to baking in the author's personal SSH public key. When started with '-p 2222:22 --privileged' as instructed, Docker exposes port 2222 on all network interfaces (0.0.0.0). Anyone on the local network can SSH into the container as root using the password 'kali' and use its privileged mode to take full control of the host computer. While the README instructs replacing the SSH public key, it never mentions the hardcoded root password.
Fix: Remove the chpasswd command, set 'PasswordAuthentication no' and 'PermitRootLogin prohibit-password' in sshd_config, remove the author's public key, and bind Docker port forwarding to localhost only (-p 127.0.0.1:2222:22).
-
HighContainer runs in --privileged mode, removing isolation from the host machine
Both the Dockerfile and README instruct running the Kali container with '--privileged' so that iptables rules in start.sh can run. Running with '--privileged' disables container isolation and grants root inside Kali full access to the host's disks and kernel. If the AI agent inspects an untrusted target and is tricked by prompt injection into running a malicious command, that command can trivially escape the container and compromise the host operating system.
Fix: Replace '--privileged' with '--cap-add=NET_ADMIN', which is sufficient for iptables inside the container without exposing host block devices or full kernel privileges.
-
MediumUnauthenticated live output viewer listens on all interfaces with open CORS and WebSockets
The MCP server streams every command and all terminal output to the companion realtime viewer. Although the README claims the viewer only listens on localhost, server.listen(PORT) omits a host address and therefore binds to all network interfaces (0.0.0.0 / ::) with no password or token check. It also enables Access-Control-Allow-Origin: * via cors() and accepts WebSocket connections without checking the Origin header, allowing anyone on the network—or any malicious website opened in the user's browser—to read sensitive command outputs in real time or inject fake session data.
Fix: Bind the viewer explicitly to '127.0.0.1', require an authentication token on HTTP and WebSocket connections, remove permissive cors(), and validate the Origin header on WebSocket handshakes.
-
LowCross-site scripting (XSS) in the realtime viewer session list
realtime-viewer/public/index.html:250
The web viewer inserts session.sessionId and session.command directly into sessionList.innerHTML without HTML escaping. Because POST /api/session/start is unauthenticated and permits cross-origin requests—and because the MCP server forwards raw command strings—any website visited by the user, any peer on the local network, or any AI command containing HTML markup can execute arbitrary JavaScript in the user's browser tab.
Fix: Create DOM elements safely using document.createElement and textContent instead of interpolating untrusted session fields into innerHTML.
-
LowLive command pushing to localhost:3000 is forced on with no way to disable
Although README.md states that realtime output pushing is disabled by default (controlled via REALTIME_PUSH_ENABLED) and can be turned off with a configure_realtime_viewer tool, src/index.ts hardcodes enabled: true, ignores REALTIME_PUSH_ENABLED, and does not implement that tool. Every command and output is unconditionally sent over plain HTTP POST to localhost:3000, which can leak sensitive data to unrelated local dev servers or containers listening on port 3000.
Fix: Default realtimePusherConfig.enabled to false unless process.env.REALTIME_PUSH_ENABLED === 'true'.
-
LowUnverified dns2socks binary downloaded at image build and container startup
The Dockerfile (and /root/start.sh if the binary is absent at container startup) downloads and executes the dns2socks binary as root without verifying a SHA-256 checksum. In addition, the image routes container TCP and DNS traffic through a hardcoded LAN proxy (192.168.31.110:2081) unless edited by the user, increasing interception risk on matching local subnets.
Fix: Verify a pinned SHA-256 hash before extracting and running dns2socks, remove the runtime download fallback in start.sh, and disable proxy redirection by default.
