Claude and MCP Kali Server Automate a Lab Penetration Test

Summary
A hands-on lab walkthrough connects Claude Desktop to Kali tools through MCP, demonstrating reconnaissance, exploitation, credential recovery and domain access across vulnerable hosts, then outlining defenses including patching, stronger authentication and network hard.
Key points
- Claude Desktop used the MCP Kali Server to run Kali security tools through natural-language requests, with consent prompts for high-impact actions.
- In the authorized lab, enumeration found anonymous SMB access and weak credentials; the walkthrough reports successful SSH login attempts and SQL injection against test hosts.
- The article demonstrates obtaining root on a Metasploitable host through Samba CVE-2007-2447 and cracking six of seven recovered password hashes.
- Vulnerable Reflex Gallery and Mail-Masta plugins were used to gain WordPress access; the walkthrough also reports recovering domain administrator credentials on a Windows Server 2019 lab controller.
- Recommended defenses include retiring unsupported software, patching WordPress and plugins, disabling anonymous access, enforcing strong passwords and MFA, and segmenting networks.
- Additional mitigations include parameterized queries, restricting upload execution, using modern password hashing, and monitoring for scanning, brute-force and exploitation activity.
Article Details
- Topic
- Natural-language orchestration of an authorized lab penetration test using Claude Desktop and the MCP Kali Server, including vulnerability exploitation and credential recovery across multiple hosts.
MITRE ATT&CK
T1003.008 · /etc/passwd and /etc/shadowAfter gaining root access, the assessment dumped the shadow file and retrieved password hashes.T1021.002 · SMB/Windows Admin SharesThe recovered administrator credentials provided access to the domain controller over SMB.T1021.006 · Windows Remote ManagementThe article reports that the recovered administrator credentials granted access to the domain controller over WinRM.T1046 · Network Service DiscoveryNmap and Metasploit scans enumerated services and open ports on lab hosts.T1078.002 · Domain AccountsRecovered domain administrator credentials were used to obtain administrative access to the Windows domain controller.T1087.001 · Local AccountSMB null-session enumeration exposed local user accounts on the Metasploitable host.T1110.001 · Password GuessingHydra tested username and password combinations against SSH and recovered a credential pair.T1110.002 · Password CrackingJohn the Ripper cracked hashes obtained from the host's shadow file.T1110.003 · Password SprayingNetExec tested combinations from local wordlists against SMB authentication on the domain controller.T1190 · Exploit Public-Facing ApplicationSQL injection and vulnerable WordPress plugins were exploited on lab web applications.T1210 · Exploitation of Remote ServicesThe Samba usermap_script vulnerability was exploited to obtain a root shell on the Metasploitable host.T1552.001 · Credentials In FilesA PHP filter wrapper was used to read wp-config.php and retrieve database credentials.
CVE
CVE-2007-2447Samba · SambaA Samba CVE-2007-2447 weakness led to root access on the Metasploitable host.CVE-2015-4133Reflex gallery project · Reflex galleryWe direct Claude to exploit the reflex-gallery plugin, which carries an unauthenticated arbitrary file-upload flaw (CVE-2015-4133) leading to RCE.CVE-2016-10956Mail-masta project · Mail-mastaWe target the mail-masta plugin, vulnerable to local file inclusion (CVE-2016-10956) and SQL injection.
Products
Claude DesktopThis article describes an end-to-end lab penetration test orchestrated through Claude Desktop connected to an MCP Kali Server, where natural-language prompts drove tools like Nmap, sqlmap, Hydra, Metasploit, John theKali LinuxBy connecting Claude Desktop to a Model Context Protocol (MCP) server running on Kali Linux, we turn the AI assistant into an interactive offensive-security co-pilot that executes real Kali tooling on command.Mail-MastaWordPress was compromised through vulnerable plugins including Reflex Gallery and Mail-Masta.MCP Kali Serverdescribes an end-to-end lab penetration test orchestrated through Claude Desktop connected to an MCP Kali Server, where natural-language prompts drove tools like Nmap, sqlmap, Hydra, Metasploit, John the Ripper,Reflex GalleryWordPress was compromised through vulnerable plugins including Reflex Gallery and Mail-Masta.Samba#ClaudeDesktopSite EditorThe compromise relied on an outdated WordPress 5.2.24 and vulnerable plugins (Reflex Gallery, Mail-Masta, Site Editor); timely updates remove these exploit paths.Windows Server 2019The attack chain moved from reconnaissance and exploitation to root access, WordPress compromise, and domain administrator credential recovery on a Windows Server 2019 domain controller.WordPressThe attack chain moved from reconnaissance and exploitation to root access, WordPress compromise, and domain administrator credential recovery on a Windows Server 2019 domain controller.
Tools
DirbWeb Directory Enumeration with DIRBenum4linuxThe assessment included Nmap, Gobuster, enum4linux, Hydra, sqlmap, and Metasploit for reconnaissance and exploitation.GobusterThe assessment included Nmap, Gobuster, enum4linux, Hydra, sqlmap, and Metasploit for reconnaissance and exploitation.HydraDesktop connected to an MCP Kali Server, where natural-language prompts drove tools like Nmap, sqlmap, Hydra, Metasploit, John the Ripper, WPScan, and NetExec.John the Ripperan MCP Kali Server, where natural-language prompts drove tools like Nmap, sqlmap, Hydra, Metasploit, John the Ripper, WPScan, and NetExec.Metasploit Frameworkconnected to an MCP Kali Server, where natural-language prompts drove tools like Nmap, sqlmap, Hydra, Metasploit, John the Ripper, WPScan, and NetExec.NetExecnatural-language prompts drove tools like Nmap, sqlmap, Hydra, Metasploit, John the Ripper, WPScan, and NetExec.NiktoWeb Server Scanning with NiktoNmapthrough Claude Desktop connected to an MCP Kali Server, where natural-language prompts drove tools like Nmap, sqlmap, Hydra, Metasploit, John the Ripper, WPScan, and NetExec.sqlmapClaude Desktop connected to an MCP Kali Server, where natural-language prompts drove tools like Nmap, sqlmap, Hydra, Metasploit, John the Ripper, WPScan, and NetExec.WPScanServer, where natural-language prompts drove tools like Nmap, sqlmap, Hydra, Metasploit, John the Ripper, WPScan, and NetExec.
