PentestGPT Leverages LLMs for Fully Automated Penetration Testing
A new open-source framework, PentestGPT, utilizes large language models to automate the entire penetration testing lifecycle, from reconnaissance to exploitation and reporting, without human intervention.

PentestGPT emerges as a significant advancement in cybersecurity automation, offering an open-source framework that empowers large language models (LLMs) to conduct comprehensive penetration tests autonomously. The agent is designed to operate in distinct stages, mirroring the phases of a traditional security assessment. In its default configuration, it progresses through reconnaissance, exploitation, and a final walkthrough, with each stage dynamically informing the next. Alternatively, users can switch to a dedicated pentest mode, which focuses on asset discovery, vulnerability identification, and automated report generation, all without requiring human input.
The core of PentestGPT's capability lies in its ability to drive LLMs such as Claude Code or Codex. The agent orchestrates the execution of various security tools and makes intelligent decisions about which techniques to employ during the testing process. This agentic approach allows for a fluid and adaptive testing methodology, capable of identifying and exploiting vulnerabilities in a manner that mimics, and in some cases surpasses, human-led efforts. The initial version of this framework was presented by Gelei Deng and colleagues at USENIX Security 2024, highlighting its academic and research backing.
Installation of PentestGPT requires Python 3.12 or later and the uv package manager. Crucially, it depends on two authenticated command-line tools: Claude Code and Codex. To streamline setup, a Docker image is available that bundles both CLIs. This image simplifies the authentication process, allowing users to log in once, with tokens stored in volumes that persist across container recreations. A notable detail for image creation is the handling of Codex login, which requires a specific OAuth callback mechanism forwarded through socat due to the single-use nature of ChatGPT refresh tokens.
For users preferring a more interactive approach or requiring broader model support, the older pentestgpt-legacy design remains available. This version operates with three cooperating LLM sessions—one for reasoning, one for generation, and one for parsing—collectively maintaining a Pentesting Task Tree. This human-in-the-loop mode offers native integration with a wider array of LLM providers, including OpenAI, Anthropic, Google Gemini, DeepSeek, xAI, Qwen, Moonshot, and local models via Ollama. A web-verified model registry, updated in June 2026, helps manage model IDs, and a built-in smoke test verifies the functionality of all configured models.
Before deploying PentestGPT in any client-facing scenario, it is imperative to review its telemetry settings. By default, the framework sends anonymous usage data to a Langfuse project. This data includes session metadata such as target type, duration, completion status, tools utilized, and whether a security flag was discovered. Importantly, command outputs, credentials, and flag values are never transmitted. This distinction is critical for client trust and legal counsel. Users can opt out of telemetry collection via a command-line flag or an environment variable.
The availability of PentestGPT as an open-source project on GitHub democratizes access to advanced automated penetration testing capabilities. This tool can significantly reduce the time and resources required for security assessments, enabling organizations to identify and remediate vulnerabilities more efficiently. Its agentic nature allows it to adapt to complex environments and uncover subtle security weaknesses that might be missed by more static testing methods.
PentestGPT represents a growing trend in cybersecurity where AI and LLMs are being integrated into offensive security operations. Tools like this not only enhance the efficiency of penetration testing but also provide valuable insights into potential attack vectors. As AI capabilities continue to evolve, frameworks like PentestGPT are likely to become indispensable assets for security teams aiming to stay ahead of sophisticated threats.