HOW TO USE KALI LINUX WITH CLAUDE AI: OFFICIAL SETUP GUIDE FOR PENETRATION TESTERS

·

INTRODUCTION: THE OFFICIAL KALI + CLAUDE WORKFLOW

Kali Linux's official documentation now covers AI-assisted penetration testing using Anthropic's Claude AI and Model Context Protocol (MCP). Instead of typing individual commands, describe your intent in plain English — Claude plans, executes, and iterates autonomously.

Example prompt: "Port scan scanme.nmap.org and check for security.txt"

Claude response:

  1. Verifies nmap available

  2. Runs nmap -sV scanme.nmap.org

  3. Finds ports 80/tcp, 443/tcp open

  4. Checks http://scanme.nmap.org/security.txt

  5. Reports results and suggests next steps

This accelerates recon and enumeration while you focus on analysis.


ARCHITECTURE: THREE COMPONENTS

UI Layer: Claude Desktop (macOS/Windows GUI)
Execution Layer: Kali Linux running mcp-server (Flask API on port 5000)
Intelligence Layer: Claude Sonnet model (cloud-hosted)

MCP provides standardized tool calling with full session context.


SUPPORTED TOOLS

  • Nmap (port scanning)

  • Gobuster/Dirb (directory enumeration)

  • Nikto (web vuln scanning)

  • Hydra/John (brute force)

  • Metasploit (exploitation)

  • SQLMap/WPScan (injection/CMS)

  • Enum4linux-ng (SMB/Windows)

  • Curl/Wget (HTTP probing)


PREREQUISITES

  • Kali Linux VM/cloud instance

  • Claude Desktop (macOS/Windows)

  • Anthropic API key/Claude Pro

  • SSH key-based access from client to Kali

  • Python 3.x on Kali


OFFICIAL STEP-BY-STEP SETUP

Step 1: Update Kali System

sudo apt update && sudo apt upgrade -y

Step 2: Install mcp-kali-server

sudo apt install -y mcp-kali-server

Verify:

mcp-server --help

Step 3: Start mcp-server

Run the server:

mcp-server --port 5000

Use tmux for background:

sudo apt install -y tmux
tmux new -s mcp-session
mcp-server --port 5000

Detach: Ctrl+B then D

Step 4: Configure SSH Key Auth

On client machine, generate ed25519 key:

ssh-keygen -t ed25519 -C "claude-kali"

Copy to Kali:

ssh-copy-id -i ~/.ssh/id_ed25519.pub kali@your_kali_ip

Test:

ssh kali@your_kali_ip

Step 5: Install Claude Desktop

Download from anthropic.com, sign in with API key/Pro account.

Step 6: Configure Claude Desktop (Official JSON)

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "kali": {
      "command": "ssh",
      "args": [
        "-i", "/path/to/.ssh/id_ed25519",
        "-o", "StrictHostKeyChecking=no",
        "kali@your_kali_ip",
        "mcp-server"
      ],
      "transport": "stdio"
    }
  }
}

Key notes:

  • User: kali@your_kali_ip

  • Command: "mcp-server" (no --port flag needed)

  • SSH key path: Update to yours

Step 7: Verify Connection

Restart Claude Desktop. Check MCP servers list — "kali" should show "healthy" status.

Test prompt:

Check which tools are available on Kali

Claude queries mcp-server and lists supported tools.

Step 8: First AI Pentest Task

Port scan scanme.nmap.org with service detection

Claude executes:

nmap -sV scanme.nmap.org

Parses results, reports open ports/services, suggests enumeration.


CRITICAL SECURITY GUARDRAILS (FROM KALI DOCS)

  1. Isolate Kali Host: Use VM with snapshots. No shared home directories.

  2. UFW Network Lockdown:

sudo apt install -y ufw
sudo ufw default deny incoming
sudo ufw default deny outgoing
sudo ufw allow from YOUR_SUBNET to any port 22
sudo ufw allow out 53,80,443
sudo ufw enable
  1. Prompt Injection Defense: Review all raw tool output before Claude's next actions. Web responses can contain manipulative instructions.

  2. Version Pinning: Watch for MCP CVEs (CVE-2025-68143 path traversal). Pin mcp-kali-server:

sudo apt-mark hold mcp-kali-server
  1. Audit Logging:

script -a /var/log/claude-session-$(date +%Y%m%d-%H%M%S).log
mcp-server --port 5000

PROD ENGAGEMENT WARNINGS

  • Scope enforcement: Network-level target allowlisting required

  • Human-in-loop: Review high-risk actions (exploitation, brute force)

  • Client disclosure: Cloud LLM processing may conflict with NDA

  • Team use: Free-form AI needs governance beyond solo research

Perfect for labs/CTFs. Production needs hardening.


Connect with CyberHawk for more threat intelligence, security research, and cybersecurity insights:

YouTube: youtube.com/@cyberhawkconsultancy

TikTok: tiktok.com/@cyberhawkthreatintel

X (Twitter): x.com/@cyberhawkintel

Telegram: t.me/@cyberhawkthreatintel

#cyberhawktheatintel #cyberhawkconsultancy