Pentesting with Claude Code: 3 HackTheBox Machines in One Afternoon
Summary
An experiment demonstrated Claude Code's effectiveness as a pentesting copilot, successfully compromising three HackTheBox machines—Cap (easy), Abducted (medium), and Bedside (medium)—in a single afternoon session. The setup involved Claude Code running on Windows, firing commands into a Debian 13 WSL attack machine. Key vulnerabilities exploited included an IDOR leading to FTP credentials and Linux capability abuse on Cap; Samba print injection, rclone credential reveal, wide-links symlink, and systemd drop-in via polkit on Abducted; and two instances of pickle deserialization (pdfminer.six and "torch.load"), combined with a logical container escape and path traversal in a Deno dev server on Bedside. The process emphasized agent-driven enumeration and exploit generation, with the human analyst providing strategic direction and learning.
Key takeaway
For security engineers evaluating AI copilots for pentesting, Claude Code demonstrates significant operational amplification, enabling rapid iteration through reconnaissance, exploit development, and post-exploitation. You should integrate such agents to automate repetitive tasks and exploit generation, freeing your focus for strategic reasoning and complex vulnerability chaining. However, maintain strict discipline to avoid over-reliance on AI for core reasoning, ensuring continuous human learning and skill development.
Key insights
Claude Code significantly amplifies pentesting productivity by automating enumeration, hypothesis formation, and exploit generation.
Principles
- Prioritize local exploit validation before targeting live systems.
- Sequential IDs in URLs warrant immediate testing of neighbors and "0".
- Treat guest-accessible Samba printers as high-risk command injection vectors.
Method
Utilize an AI agent to drive the enumerate → hypothesize → exploit → iterate loop, writing exploits and parsing output, while the human maintains strategic oversight and learning discipline.
In practice
- Write complex commands into script files to avoid quoting issues.
- Implement FIFO for stable semi-interactive reverse shells.
- Test for host networking access from within Docker containers.
Topics
- Pentesting
- Claude Code
- HackTheBox
- AI Copilot
- Vulnerability Exploitation
- Pickle Deserialization
- Container Escape
Best for: AI Security Engineer, Security Engineer, AI Engineer
Related on AIssential
See Counsel's argued verdicts on the open AI decisions leaders are weighing →
Editorial summary, takeaway, and curation by AIssential. Original article published by AI on Medium.