TL;DR
This paper introduces a novel "guided reasoning" pipeline for LLM-driven penetration testing. By using a structured attack tree derived from the MITRE ATT&CK Matrix, their approach significantly improves the accuracy and efficiency of LLM agents in navigating complex cybersecurity challenges, especially for smaller models, compared to existing self-guided methods.
What Problem Does This Paper Address?
Automating penetration testing with Large Language Models (LLMs) holds immense promise for faster and more consistent security assessments. However, current LLM agents often rely on "self-guided reasoning," which can lead to inaccurate or hallucinated steps, unproductive actions, and cyclical behavior. This makes them unreliable for complex, structured tasks like penetration testing, where a systematic approach is crucial. The paper aims to address this by providing a more robust and reliable method for LLMs to perform penetration testing.
Methods
The core innovation is a "guided reasoning pipeline" that utilizes a Structured Task Tree (STT). This STT is a deterministic representation of penetration testing tactics, techniques, and procedures (TTPs) derived from the MITRE ATT&CK Matrix. Instead of letting the LLM autonomously generate its next steps, the STT constrains the LLM's reasoning to a predefined set of actions, ensuring that each step aligns with established penetration testing methodologies.
The pipeline involves:
- Task Initialization: The LLM receives target information and the initial task from the STT.
- Output Summarization: The LLM summarizes findings from executed commands.
- Task Selection: Based on the summarized findings, the LLM selects the most relevant next task from the STT.
- Command Generation: The LLM generates executable commands for the selected task.
This approach contrasts with baseline methods that rely on the LLM to autonomously generate and maintain a Penetration Testing Tree (PTT), which can be prone to errors and inefficiencies.
Datasets
The evaluation was conducted using 10 HackTheBox (HTB) cybersecurity exercises. These are virtualized environments designed to simulate real-world attack scenarios, involving a total of 103 discrete subtasks. The HTB machines were selected to represent a balanced distribution of difficulty levels (easy, medium, hard) and operating systems (Windows, Linux).
Key Insights and Ideas
- Structure is Key for Smaller LLMs: The STT approach significantly compensates for the limited planning and context retention capabilities of smaller LLMs (like Llama-3-8B and Gemini-1.5), enabling them to perform complex, multi-step reasoning that they would otherwise fail at.
- Improved Consistency and Efficiency: By grounding LLM reasoning in a deterministic task tree, the pipeline reduces hallucinations and inconsistencies, leading to more reliable performance and fewer redundant queries.
- MITRE ATT&CK as a Foundation: Leveraging the well-established MITRE ATT&CK framework provides a robust and structured knowledge base that anchors the LLM's actions in proven penetration testing methodologies.
- Tradeoff Between Structure and Freedom: While the structured approach enhances reliability, it might limit the LLM's ability to discover novel, zero-day exploits that fall outside the predefined TTPs. However, for specific threat models or safety-critical testing, this constraint is advantageous.
Key Results
The proposed STT-based reasoning pipeline demonstrated significant improvements:
- Accuracy:
- Llama-3-8B: 71.8% subtasks completed (vs. 13.5% for baseline)
- Gemini-1.5: 72.8% subtasks completed (vs. 16.5% for baseline)
- GPT-4: 78.6% subtasks completed (vs. 75.7% for baseline)
- Efficiency: The STT-based pipeline required 55.9% fewer model queries on average compared to the baseline.
- Model Capability Enhancement: Smaller models like Llama-3-8B and Gemini-1.5, which struggled with the baseline method, were able to successfully complete four full machines using the STT approach. GPT-4 maintained parity with the baseline in terms of completed machines but achieved better subtask coverage.
Limitations and Future Work
- Limited Scope: The current STT is based on MITRE ATT&CK and does not include techniques outside of this framework. The authors acknowledge that LLMs with more freedom could potentially exploit novel techniques (e.g., zero-days) for higher success rates in the long term.
- CVE Retrieval and Advanced Tool Usage: The system lacks web search capabilities for discovering relevant CVEs and has limited understanding of advanced exploitation tool functionalities (e.g., Burp Suite).
- Future Work: The authors suggest integrating web-enabled LLM agents for CVE retrieval and exploring multimodal models for better interaction with visual interfaces and tool GUIs. This could enhance the agent's ability to handle more complex scenarios and understand dynamic feedback from tools.
Summary updated