Saved in:
Bibliographic Details
Main Authors: Dai, Hanzheng, Li, Yuanliang, Yan, Jun, Zhang, Zhibo
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2505.07089
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866911020876824576
author Dai, Hanzheng
Li, Yuanliang
Yan, Jun
Zhang, Zhibo
author_facet Dai, Hanzheng
Li, Yuanliang
Yan, Jun
Zhang, Zhibo
contents Automated penetration testing (AutoPT) powered by large language models (LLMs) has gained attention for its ability to automate ethical hacking processes and identify vulnerabilities in target systems by leveraging the inherent knowledge of LLMs. However, existing LLM-based AutoPT frameworks often underperform compared to human experts in challenging tasks for several reasons: the imbalanced knowledge used in LLM training, short-sightedness in the planning process, and hallucinations during command generation. Moreover, the trial-and-error nature of the PT process is constrained by existing frameworks lacking mechanisms to learn from previous failures, restricting adaptive improvement of PT strategies. To address these limitations, we propose a knowledge-informed, self-reflective PT framework powered by LLMs, called RefPentester. This AutoPT framework is designed to assist human operators in identifying the current stage of the PT process, selecting appropriate tactics and techniques for each stage, choosing suggested actions, providing step-by-step operational guidance, and reflecting on and learning from previous failed operations. We also modeled the PT process as a seven-state Stage Machine to integrate the proposed framework effectively. The evaluation shows that RefPentester can successfully reveal credentials on Hack The Box's Sau machine, outperforming the baseline GPT-4o model by 16.7%. Across PT stages, RefPentester also demonstrates superior success rates on PT stage transitions.
format Preprint
id arxiv_https___arxiv_org_abs_2505_07089
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle RefPentester: A Knowledge-Informed Self-Reflective Penetration Testing Framework Based on Large Language Models
Dai, Hanzheng
Li, Yuanliang
Yan, Jun
Zhang, Zhibo
Artificial Intelligence
Automated penetration testing (AutoPT) powered by large language models (LLMs) has gained attention for its ability to automate ethical hacking processes and identify vulnerabilities in target systems by leveraging the inherent knowledge of LLMs. However, existing LLM-based AutoPT frameworks often underperform compared to human experts in challenging tasks for several reasons: the imbalanced knowledge used in LLM training, short-sightedness in the planning process, and hallucinations during command generation. Moreover, the trial-and-error nature of the PT process is constrained by existing frameworks lacking mechanisms to learn from previous failures, restricting adaptive improvement of PT strategies. To address these limitations, we propose a knowledge-informed, self-reflective PT framework powered by LLMs, called RefPentester. This AutoPT framework is designed to assist human operators in identifying the current stage of the PT process, selecting appropriate tactics and techniques for each stage, choosing suggested actions, providing step-by-step operational guidance, and reflecting on and learning from previous failed operations. We also modeled the PT process as a seven-state Stage Machine to integrate the proposed framework effectively. The evaluation shows that RefPentester can successfully reveal credentials on Hack The Box's Sau machine, outperforming the baseline GPT-4o model by 16.7%. Across PT stages, RefPentester also demonstrates superior success rates on PT stage transitions.
title RefPentester: A Knowledge-Informed Self-Reflective Penetration Testing Framework Based on Large Language Models
topic Artificial Intelligence
url https://arxiv.org/abs/2505.07089