PentestEval: Benchmarking LLM-based Penetration Testing with Modular and Stage-Level Design

Ruozhao Yang, Mingfei Cheng, Gelei Deng, Tianwei Zhang, Junjie Wang, Xiaofei XiearXiv 2025 · DOI

Introduction

Automating penetration testing—the practice of simulating cyberattacks to find vulnerabilities—is a "holy grail" for security teams. While Large Language Models (LLMs) show promise, current research often treats them as monolithic agents: a URL is provided, and the model either finds a "flag" or fails. This "all-or-nothing" approach creates a massive visibility gap, making it impossible to diagnose whether a model failed due to poor reconnaissance, incorrect attack path selection, or simple syntax errors. Existing benchmarks like Capture the Flag (CTF) challenges focus on final outcomes, failing to pinpoint the specific reasoning flaws that prevent LLMs from becoming reliable security tools.

Methodology: A Modular Framework

To address this, we introduce PentestEval, a modular framework that formalizes the penetration testing process into six sequential stages based on NIST and PTES standards. This decomposition allows for a granular evaluation of LLM capabilities at each step of the attack lifecycle.

The modular penetration testing lifecycle, decomposing the process into Weakness Preparation, Iterative Attack, and Revision Loop stages.

The six stages are:

  1. Information Collection (IC): Gathering target data.
  2. Weakness Gathering (WG): Identifying potential vulnerabilities.
  3. Weakness Filtering (WF): Narrowing down viable candidates.
  4. Attack Decision-Making (ADM): Prioritizing which weakness to exploit first.
  5. Exploit Generation (EG): Writing the actual code/commands.
  6. Exploit Revision (ER): Fixing exploits based on execution feedback.

Evaluation Metrics

We developed an automated evaluation pipeline using specialized metrics for each stage to quantify performance beyond binary success/failure. These metrics allow researchers to identify precisely where a model's reasoning breaks down.

Task-specific metrics used in PentestEval to quantify performance at each stage of the attack lifecycle.

Experimental Setup

The PentestEval benchmark consists of 12 realistic scenarios built using Docker, featuring popular frameworks like ThinkPHP, SpringBoot, and Jenkins. These environments encompass 346 distinct tasks covering the OWASP Top 10 and CWE Top 25. Notably, one scenario includes an undisclosed "zero-day" vulnerability to test out-of-distribution reasoning. Ground truth solutions were manually verified by five professional penetration testers.

Key Insights and Results

Our evaluation of nine state-of-the-art models (including GPT-4o and Claude 3.7) reveals several critical findings:

  • The "Chain" is the Weakest Link: LLMs are proficient at identifying individual vulnerabilities but struggle with "attack chaining." They often ignore prerequisites, such as attempting Remote Code Execution (RCE) without first bypassing authentication.
  • Strategic Reasoning Bottlenecks: Attack Decision-Making (25% success) and Exploit Generation (26%) are the primary bottlenecks. When provided with ground-truth decision-making (ADM), end-to-end success rates jumped from 31% to 67%.
  • Feedback Improves Performance: The Exploit Revision stage achieved a 60% success rate, suggesting LLMs are significantly better at debugging attacks with explicit error messages than generating them correctly on the first attempt.
  • Failure of Current Autonomy: Fully autonomous agents (e.g., PentestAgent) achieved success rates as low as 3-6%, often performing worse than a simple linear pipeline due to over-reliance on generic CWE matching rather than application-specific logic.

Conclusion

PentestEval highlights that while LLMs are capable of basic reconnaissance, they lack the strategic reasoning required for complex, multi-stage attacks. Future work should focus on schema-guided normalization to reduce cognitive load and expanding benchmarks to include cloud and IoT environments. The failure on zero-day scenarios underscores a reliance on memorized exploits rather than first-principles security reasoning.

Summary updated

BibTeX
@misc{yang2025pentesteval,
  author = {Ruozhao Yang and Mingfei Cheng and Gelei Deng and Tianwei Zhang and Junjie Wang and Xiaofei Xie},
  title = {{PentestEval: Benchmarking LLM-based Penetration Testing with Modular and Stage-Level Design}},
  year = {2025},
  eprint = {2512.14233},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.14233},
}
Figure