Skip to main content
QUICK REVIEW

[Paper Review] PentestGPT: An LLM-empowered Automatic Penetration Testing Tool

Gelei Deng, Yi Liu|arXiv (Cornell University)|Aug 13, 2023
Software Engineering ResearchComputer Science30 citations
TL;DR

The paper evaluates LLMs on real-world pentesting tasks using a new benchmark and introduces PentestGPT, an LLM-driven automated pentesting system with a tripartite architecture to improve task completion and reduce context loss.

ABSTRACT

Penetration testing, a crucial industrial practice for ensuring system security, has traditionally resisted automation due to the extensive expertise required by human professionals. Large Language Models (LLMs) have shown significant advancements in various domains, and their emergent abilities suggest their potential to revolutionize industries. In this research, we evaluate the performance of LLMs on real-world penetration testing tasks using a robust benchmark created from test machines with platforms. Our findings reveal that while LLMs demonstrate proficiency in specific sub-tasks within the penetration testing process, such as using testing tools, interpreting outputs, and proposing subsequent actions, they also encounter difficulties maintaining an integrated understanding of the overall testing scenario. In response to these insights, we introduce PentestGPT, an LLM-empowered automatic penetration testing tool that leverages the abundant domain knowledge inherent in LLMs. PentestGPT is meticulously designed with three self-interacting modules, each addressing individual sub-tasks of penetration testing, to mitigate the challenges related to context loss. Our evaluation shows that PentestGPT not only outperforms LLMs with a task-completion increase of 228.6\% compared to the \gptthree model among the benchmark targets but also proves effective in tackling real-world penetration testing challenges. Having been open-sourced on GitHub, PentestGPT has garnered over 4,700 stars and fostered active community engagement, attesting to its value and impact in both the academic and industrial spheres.

Motivation & Objective

  • Motivate automated penetration testing and reduce reliance on domain expertise through LLMs.
  • Create a robust, real-world benchmark for evaluating pentesting capabilities across diverse targets.
  • Develop an integrated system (PentestGPT) to guide LLMs through discrete testing states and tasks.

Proposed method

  • Build 13 targets from HackTheBox and VulnHub totaling 182 sub-tasks aligned with OWASP Top 10 vulnerabilities.
  • Evaluate GPT-3.5, GPT-4, and Bard on end-to-end and sub-task performance against the benchmark.
  • Analyze LLM behavior to identify limitations such as context loss and tendency toward certain task patterns.
  • Propose PentestGPT with three self-interacting modules to maintain context and guide task execution.
  • Apply an interactive loop bridging textual LLM outputs with UI/command-based actions in a Kali Linux environment.
Figure 2 : Overview of strategy to use LLMs for penetration testing.
Figure 2 : Overview of strategy to use LLMs for penetration testing.

Experimental results

Research questions

  • RQ1RQ1: To what extent can LLMs perform penetration testing tasks on the proposed benchmark?
  • RQ2RQ2: How do the problem-solving strategies of human testers differ from those of LLMs in penetration testing?
  • RQ3RQ3: What factors limit LLMs’ effectiveness in automated pentesting (e.g., context retention, memory, and command accuracy)?

Key findings

  • LLMs can complete end-to-end pentesting tasks, with GPT-4 achieving the best performance among the evaluated models.
  • GPT-4 completed 4 easy and 1 medium targets end-to-end; Bard and GPT-3.5 completed fewer targets under the same conditions.
  • On sub-tasks, GPT-4 achieved 52 of 77 on easy targets and 27 of 71 on medium targets, indicating strong capability in tool use and code-related tasks.
  • LLMs struggle with maintaining long-term context, often losing prior findings and tending to focus on recent tasks (depth-first bias).
  • Common failure causes include session context loss, false command generation, and deadlock operations, contributing to unsuccessful outcomes.
  • PentestGPT’s tripartite architecture (Reasoning, Generation, Parsing) and the Pentesting Task Tree (PTT) help mitigate context loss and guide coherent action planning.
Figure 3 : Overview of PentestGPT .
Figure 3 : Overview of PentestGPT .

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.