Abstract
Penetration testing is critical for identifying and mitigating security vulnerabilities, yet traditional approaches remain expensive, time-consuming, and dependent on expert human labor. Recent work has explored AI-driven pentesting agents, but their evaluation relies on oversimplified capture-the-flag (CTF) settings that embed prior knowledge and reduce complexity, leading to performance estimates far from real-world practice. We close this gap by introducing the first real-world, agent-oriented pentesting benchmark, TermiBench, which shifts the goal from 'flag finding' to achieving full system control. The benchmark spans 510 hosts across 25 services and 30 CVEs, with realistic environments that require autonomous reconnaissance, discrimination between benign and exploitable services, and robust exploit execution. Using this benchmark, we find that existing systems can hardly obtain system shells under realistic conditions. To address these challenges, we propose TermiAgent, a multi-agent penetration testing framework. TermiAgent mitigates long-context forgetting with a Located Memory Activation mechanism and builds a reliable exploit arsenal via structured code understanding rather than naive retrieval. In evaluations, our work outperforms state-of-the-art agents, exhibiting stronger penetration testing capability, reducing execution time and financial cost, and demonstrating practicality even on laptop-scale deployments. Our work delivers both the first open-source benchmark for real-world autonomous pentesting and a novel agent framework that establishes a milestone for AI-driven penetration testing.
Introduction: The Reality Gap in AI Pentesting
Penetration testing (pentesting) is essential for modern cybersecurity but remains a manual, expert-driven process. While Large Language Models (LLMs) have shown potential for automation, current research is hampered by a significant "reality gap." Most existing agents are evaluated on Capture The Flag (CTF) challenges, which are often oversimplified. These challenges frequently provide "hints" such as specific entry points or exploit paths and operate in "clean" environments with only a single vulnerable service.
In contrast, real-world pentesting begins with minimal information—often just a subnet—and requires navigating "noise" from numerous benign services to find a single exploitable path. Furthermore, current agents often suffer from long-context forgetting as reconnaissance data fills the LLM's context window, and they rely on static, outdated toolkits.
TermiBench: A Real-World Benchmark
To bridge this gap, we introduce TermiBench, the first benchmark designed for autonomous, real-world pentesting. Unlike CTF-style evaluations, the primary objective in TermiBench is System Ownership (obtaining a shell).
TermiBench features:
- Scale: 510 host instances covering 30 unique CVEs across 25 services (e.g., Apache, Redis, MySQL).
- Environmental Noise: Hosts are configured with varying numbers of benign services (0, 1, 3, 5, or 7) to test an agent's ability to distinguish exploitable targets from background noise.
- Initial Knowledge: Agents are provided only with a subnet, requiring autonomous reconnaissance and target identification.
TermiAgent: Memory-Activated Multi-Agent Framework
To address the challenges of real-world pentesting, we developed TermiAgent, a multi-agent framework comprising a Reasoner, Assistant, Executor, and two novel components:
- Located Memory Activation (LMA): To prevent long-context forgetting, TermiAgent organizes findings into a Penetration Memory Tree (PMT). This hierarchical structure mirrors the attack logic (Subnet → Host → Service → Exploit). LMA "activates" only the relevant branch of the tree for the current task, drastically reducing context noise.
- The Arsenal Module: Instead of naive retrieval, this module uses structured code understanding to transform inconsistent exploit code from sources like GitHub into standardized, "plug-and-play" Docker containers. Each exploit is accompanied by a Unified Exploit Descriptor (UED) and a concise, LLM-readable manual.
Experimental Results
Evaluations on TermiBench demonstrate that TermiAgent significantly outperforms existing state-of-the-art (SOTA) agents:
- Effectiveness: TermiAgent solved 8x more real-world tasks than previous agents like VulnBot and 1.7x more CTF challenges.
- Efficiency: In real-world scenarios, TermiAgent required less than 20% of the execution time and only 10% of the financial cost (LLM tokens) compared to competitors.
- Robustness: While other agents' performance plummeted when faced with benign service "noise," TermiAgent maintained a high success rate.
- Edge Deployment: Due to the efficiency of the LMA mechanism, TermiAgent achieved high success rates using smaller models like Qwen3-4B, making it suitable for deployment on standard laptops for sensitive on-site testing.
Conclusion
TermiBench and TermiAgent establish a new standard for AI-driven penetration testing. By shifting the focus from flag-finding to system ownership and introducing mechanisms to handle long-context and diverse exploits, this work moves autonomous pentesting closer to practical, real-world utility. Future work will expand into post-exploitation phases, including privilege escalation and lateral movement.
Summary updated