Pentest-R1: Towards Autonomous Penetration Testing Reasoning Optimized via Two-Stage Reinforcement Learning
On the map: LLM reasoning → Reasoning for agents, planning and code
Abstract (arXiv)
Automating penetration testing is crucial for enhancing cybersecurity, yet current Large Language Models (LLMs) face significant limitations in this domain, including poor error handling, inefficient reasoning, and an inability to perform complex end-to-end tasks autonomously. To address these challenges, we introduce Pentest-R1, a novel framework designed to optimize LLM reasoning capabilities for this task through a two-stage reinforcement learning pipeline. We first construct a dataset of over 500 real-world, multi-step walkthroughs, which Pentest-R1 leverages for offline reinforcement learning (RL) to instill foundational attack logic. Subsequently, the LLM is fine-tuned via online RL in an interactive Capture The Flag (CTF) environment, where it learns directly from environmental feedback to develop robust error self-correction and adaptive strategies. Our extensive experiments on the Cybench and AutoPenBench benchmarks demonstrate the framework's effectiveness. On AutoPenBench, Pentest-R1 achieves a 24.2% success rate, surpassing most state-of-the-art models and ranking second only to Gemini 2.5 Flash. On Cybench, it attains a 15.0% success rate in unguided tasks, establishing a new state-of-the-art for open-source LLMs and matching the performance of top proprietary models. Ablation studies confirm that the synergy of both training stages is critical to its success.
Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 27 of its 44 references that are in the map. First posted on arXiv 10 Aug 2025.
Builds on
27 of 44 references.
Closest ancestors · 1
Same direction, newest first
- 2024OpenAI o1 System Card21 Dec
Other references · 26
- 2023GPT-4 Technical Reportcited by 18,396
- 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 9,379
- 2025Qwen3 Technical Reportcited by 8,820
- 2025DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learningcited by 6,330
- 2024GPT-4o System Cardcited by 4,588
- 2025Gemini 2.5: Pushing the Frontier with Advanced Reasoning, Multimodality, Long Context, and Next Generation Agentic Capabilitiescited by 3,796
- 2025Search-R1: Training LLMs to Reason and Leverage Search Engines with Reinforcement Learningcited by 1,444
- 2023Gemini: A Family of Highly Capable Multimodal Modelscited by 872
- 2025Group-in-Group Policy Optimization for LLM Agent Trainingcited by 497
- 2024LLaVA-CoT: Let Vision Language Models Reason Step-by-Stepcited by 454
- 2025RAGEN: Understanding Self-Evolution in LLM Agents via Multi-Turn Reinforcement Learningcited by 386
- 2024Cybench: A Framework for Evaluating Cybersecurity Capabilities and Risks of Language Modelscited by 164
14 more
- 2025A Minimalist Approach to LLM Reasoning: from Rejection Sampling to Reinforcecited by 145
- 2024Marco-o1: Towards Open Reasoning Models for Open-Ended Solutionscited by 144
- 2025Competitive Programming with Large Reasoning Modelscited by 119
- 2025Reinforcement Learning with Verifiable Rewards: GRPO's Effective Loss, Dynamics, and Success Amplificationcited by 110
- 2024AutoAttacker: A Large Language Model Guided System to Implement Automatic Cyber-attackscited by 96
- 2024LLaMA-Berry: Pairwise Optimization for O1-like Olympiad-Level Mathematical Reasoningcited by 91
- 2024o1-Coder: an o1 Replication for Codingcited by 78
- 2025VulnBot: Autonomous Penetration Testing for A Multi-Agent Collaborative Frameworkcited by 31
- 2025Real-World Doctor Agent with Proactive Consultation through Multi-Agent Reinforcement Learningcited by 27
- 2024From Novice to Expert: LLM Agent Policy Optimization via Step-wise Reinforcement Learningcited by 22
- 2024AutoPenBench: Benchmarking Generative Agents for Penetration Testingcited by 21
- 2025CAI: An Open, Bug Bounty-Ready Cybersecurity AIcited by 14
- 2025Can LLMs Hack Enterprise Networks? Autonomous Assumed Breach Penetration-Testing Active Directory Networkscited by 12
- 2020Autosploit: A Fully Automated Framework for Evaluating the Exploitability of Security Vulnerabilitiescited by 1
Built on by
Citing papers per year: 2025: 1; 2026: 4.
5 papers.
- 2026Hackers or Hallucinators? A Comprehensive Analysis of LLM-Based Automated Penetration Testingcited by 4
- 2026From Capability to Assurance in Autonomous Penetration-Testing Harnesses: A Framework and Reference Implementationcited by 1
- 2025SoK: Measuring What Matters for Closed-Loop Security Agentscited by 0
- 2026CyberEvolver: Structured Self-Evolution for Cybersecurity Agents On the Flycited by 0
- 2026Staying on the Attack Path: Structured State for Long-Horizon Automated Penetration Testingcited by 0
- 2026From Capability to Assurance in Autonomous Penetration-Testing Harnesses: A Framework and Reference Implementation19 Sep 2026
- 2026Staying on the Attack Path: Structured State for Long-Horizon Automated Penetration Testing7 Sep 2026
- 2026CyberEvolver: Structured Self-Evolution for Cybersecurity Agents On the Fly25 May 2026
- 2026Hackers or Hallucinators? A Comprehensive Analysis of LLM-Based Automated Penetration Testing7 Apr 2026
- 2025SoK: Measuring What Matters for Closed-Loop Security Agents2 Oct 2025
Similar, not cited
Close in wording, no citation either way
- 2024Mind the Gap: Towards Generalizable Autonomous Penetration Testing via Domain Randomization and Meta-Reinforcement Learning
- 2026Pen-Strategist: A Reasoning Framework for Penetration Testing Strategy Formation and Analysis
- 2026Ask the Expert: LLM-Guided Reinforcement Learning for Autonomous Cyber Defense
- 2025AutoPentest: Enhancing Vulnerability Management With Autonomous LLM Agents
- 2024Knowledge-Informed Auto-Penetration Testing Based on Reinforcement Learning with Reward Machine
- 2026Big Enough to Break Out: Tracking the Rising Capability of LLM Penetration-Testing Agents
- 2024HackSynth: LLM Agent and Evaluation Framework for Autonomous Penetration Testing
- 2025Guided Reasoning in LLM-Driven Penetration Testing Using Structured Attack Trees