• 中文核心
  • EI
  • 中国科技核心
  • Scopus
  • CSCD
  • 英国科学文摘

留言板

尊敬的读者、作者、审稿人, 关于本刊的投稿、审稿、编辑和出版的任何问题, 您可以本页添加留言。我们将尽快给您答复。谢谢您的支持!

姓名
邮箱
手机号码
标题
留言内容
验证码

基于大语言模型的多智能体自动渗透测试框架构建与评估

江颉 王豪 李明达 朱添田

江颉, 王豪, 李明达, 朱添田. 基于大语言模型的多智能体自动渗透测试框架构建与评估. 自动化学报, xxxx, xx(x): x−xx doi: 10.16383/j.aas.c250293
引用本文: 江颉, 王豪, 李明达, 朱添田. 基于大语言模型的多智能体自动渗透测试框架构建与评估. 自动化学报, xxxx, xx(x): x−xx doi: 10.16383/j.aas.c250293
Jiang Jie, Wang Hao, Li Ming-Da, Zhu Tian-Tian. Construction and evaluation of multi-agent automated penetration testing framework based on large language models. Acta Automatica Sinica, xxxx, xx(x): x−xx doi: 10.16383/j.aas.c250293
Citation: Jiang Jie, Wang Hao, Li Ming-Da, Zhu Tian-Tian. Construction and evaluation of multi-agent automated penetration testing framework based on large language models. Acta Automatica Sinica, xxxx, xx(x): x−xx doi: 10.16383/j.aas.c250293

基于大语言模型的多智能体自动渗透测试框架构建与评估

doi: 10.16383/j.aas.c250293 cstr: 32138.14.j.aas.c250293
基金项目: 浙江省属高校基本科研业务费专项资金(RF-A2023009), 国家自然科学基金青年项目(62002324), 浙江省高等教育2025年研究生教学改革项目(JGCG2025539)资助
详细信息
    作者简介:

    江颉:浙江工业大学计算机科学与技术学院教授. 主要研究方向为网络安全、人工智能. E-mail: jj@zjut.edu.cn

    王豪:浙江工业大学计算机科学与技术学院硕士研究生. 主要研究方向为网络安全、人工智能. E-mail: wanhao10246@163.com

    李明达:浙江工业大学计算机科学与技术学院博士研究生. 主要研究方向为网络安全、自动化攻击. E-mail: zjutlmd@zjut.edu.cn

    朱添田:浙江工业大学计算机科学与技术学院副教授. 主要研究方向为网络安全、人工智能. 本文通信作者. E-mail: ttzhu@zjut.edu.cn

Construction and Evaluation of Multi-Agent Automated Penetration Testing Framework Based on Large Language Models

Funds: Supported by the Special Funds for Basic Scientific Research Operation Expenses of Zhejiang Provincial Universities(RF-A2023009), Youth Program of National Natural Science Foundation of China(62002324), and Zhejiang Province Higher Educa-tion 2025 Postgraduate Teaching Reform Project(JGCG2025539)
More Information
    Author Bio:

    JIANG Jie Professor at the School of Computer Science and Technology, Zhejiang University of Technology. Her research interests include cybersecurity and artificial intelligence

    WANG Hao Master student at the School of Computer Science and Technology, Zhejiang University of Technology. His research interests include cybersecurity and artificial intelligence

    LI Ming-Da Ph.D. candidate at the School of Computer Science and Technology, Zhejiang University of Technology. His research interests include cybersecurity and automated attack

    ZHU Tian-Tian Associate professor at School of Computer Science and Technology, Zhejiang University of Technology. His research interests include cybersecurity and artificial intelligence. Corresponding author of this paper

  • 摘要: 渗透测试作为一种主动的安全评估手段, 在保障网络安全中发挥着至关重要的作用. 传统的渗透测试通常高度依赖专家经验和人工操作, 测试过程复杂且耗时. 基于大语言模型的渗透测试智能体能够在测试环境中生成和调整策略, 相较于传统的方式, 具备更强的创新性和适应性. 在大语言模型辅助渗透测试的过程中, 存在因测试路径偏移、大语言模型"幻觉"问题而导致渗透测试任务的中断或失败的情况. 基于此, 提出一个基于大语言模型的多智能体渗透测试框架LangPentest, 旨在通过自然语言处理技术提高攻击策略的自动生成和执行能力, 框架采用了大语言模型驱动的程序框架(LangChain)和检索增强生成技术, 提高LangPentest性能并降低大语言模型在应用渗透测试方面的“幻觉”问题. 框架由任务生成、任务执行、经验管理和任务调节四部分模块组成, 对基准目标测试后, 基于Claude 3.5 Sonnet模型的框架任务成功率最高; 且与AutoGPT和PentestGPT相比, 本框架在任务成功率方面具有明显优势, 在任务完成和整体性能方面证明了LangPentest的可行性和有效性.
  • 图  1  多智能体框架

    Fig.  1  Multi-agent framework

    图  2  任务生成提示词模板

    Fig.  2  Task generation prompt template

    图  3  任务执行提示词模板

    Fig.  3  Task execution prompt template

    图  4  LangPentest任务执行与经验优化流程

    Fig.  4  Task execution and experience optimization process in LangPentest

    图  5  RAG检索流程图

    Fig.  5  RAG retrieval flow chart

    图  6  经验管理提示词模板

    Fig.  6  Experience management prompt template

    图  7  LangPentest任务调节与任务链修正流程

    Fig.  7  Task adjustment and task-chain revision in LangPentest

    图  8  任务调整提示词模板

    Fig.  8  Task adjustment prompt template

    图  9  单主机单任务成功率

    Fig.  9  Single host single-task success rate

    图  10  单主机多任务成功率

    Fig.  10  Single host multi-task success rate

    表  1  单主机单任务列表

    Table  1  Single host single-task list

    任务描述难度
    文件操作文件操作(如上传、写入、读取)的验证或权限不足执行恶意代码简单
    脚本执行在目标主机上运行自定义脚本以实现特定攻击目标中等
    远程代码执行在目标主机上执行未经授权的代码偏难
    权限提升利用漏洞获取更高权限的用户访问权限中等
    信息泄露提取系统中敏感信息, 如配置文件和日志中等
    身份验证绕过利用漏洞绕过目标主机或应用的身份验证机制中等
    未授权访问利用系统或服务的配置缺陷, 绕过认证机制, 获取未授权的访问权限偏难
    路径穿越利用路径解析漏洞访问目标主机的敏感文件中等
    SQL注入向应用程序的SQL查询中注入恶意代码, 获取或篡改数据简单
    XML实体注入利用XML解析器处理实体的漏洞, 读取文件导致信息泄露中等
    下载: 导出CSV

    表  2  不同框架在典型单任务类型下对比

    Table  2  Comparison of different frameworks on typical single-task

    单任务类型模型成功/总次数
    AutoGPT2/5
    文件上传PentestGPT3/5
    LangPentest4/5
    AutoGPT0/5
    权限提升PentestGPT2/5
    LangPentest3/5
    AutoGPT0/5
    XML实体注入PentestGPT1/5
    LangPentest1/5
    AutoGPT1/5
    身份验证PentestGPT3/5
    LangPentest4/5
    AutoGPT0/5
    Apache Log4j2PentestGPT1/5
    LangPentest2/5
    下载: 导出CSV

    表  3  LangPentest在不同任务下的成本

    Table  3  Cost of LangPentest under different tasks

    任务GPT-3.5-Turbo(USD)GPT-4o(USD)Claude 3.5 Sonnet(USD)
    任意文件写入0.540.620.68
    特权升级0.680.680.73
    脚本执行0.710.780.67
    本地权限提升0.450.410.54
    SQL注入0.860.890.87
    目录遍历1.711.821.92
    XML实体注入3.243.423.61
    文件上传1.431.651.87
    下载: 导出CSV

    表  4  多任务成功率及交互轮次

    Table  4  Multi-task success rate and interaction rounds

    经验管理任务调整交互轮次成功率
    禁用禁用2942%
    启用禁用3365%
    禁用启用2748%
    启用启用3178%
    下载: 导出CSV

    表  5  单任务成功率及交互轮次

    Table  5  Single-task success rate and interaction rounds

    经验管理任务调整交互轮次成功率
    禁用禁用1364%
    启用禁用1273%
    禁用启用1366%
    启用启用986%
    下载: 导出CSV

    表  6  失败统计表

    Table  6  Failure statistics table

    失败类型典型现象数量
    证据绑定不足召回片段相关但未严格引用7
    环境前置/依赖缺失权限/端口/依赖报错10
    长上下文/记忆衰减遗忘前置发现8
    调节触发保守连续弱失败未改路5
    下载: 导出CSV
  • [1] El Kafhali S, El Mir I, Hanini M. Security threats, defense mechanisms, challenges, and future directions in cloud computing. Archives of Computational Methods in Engineering, 2022, 29(1): 223−246 doi: 10.1007/s11831-021-09573-y
    [2] Pfleeger C P, Pfleeger S L, Theofanos M F. A methodology for penetration testing. Computers & Security, 1989, 8(7): 613−620 doi: 10.1016/0167-4048(89)90054-0
    [3] Denis M, Zena C, Hayajneh T. Penetration testing: Concepts, attack methods, and defense strategies[C]//2016 IEEE Long Island Systems, Applications and Technology Conference (LISAT). IEEE, 2016: 1-6.
    [4] Stefinko Y, Piskozub A, Banakh R. Manual and automated penetration testing. Benefits and drawbacks. Modern tendency[C]//2016 13th international conference on modern problems of radio engineering, telecommunications and computer science (TCSET). IEEE, 2016: 488-491.
    [5] Kojima T, Gu S S, Reid M, et al. Large language models are zero-shot reasoners. Advances in neural information processing systems, 2022, 35: 22199−22213 doi: 10.52202/068431-1613
    [6] Talebirad Y, Nadiri A. Multi-agent collaboration: Harnessing the power of intelligent llm agents, 2023[J]. URL https://arxiv.org/abs/2306.03314, 2023.
    [7] Wu Q, Bansal G, Zhang J, et al. Autogen: Enabling next-gen LLM applications via multi-agent conversations[C]//First Conference on Language Modeling. 2024.
    [8] He J, Treude C, Lo D. LLM-Based Multi-Agent Systems for Software Engineering: Literature Review, Vision, and the Road Ahead. ACM Transactions on Software Engineering and Methodology, 2025, 34(5): 1−30 doi: 10.1145/3712003
    [9] Tran K T, Dao D, Nguyen M D, et al. Multi-agent collaboration mechanisms: A survey of llms[J]. arXiv preprint arXiv: 2501. 06322, 2025.
    [10] Kong H, Hu D, Ge J, et al. Vulnbot: Autonomous penetration testing for a multi-agent collaborative framework[J]. arXiv preprint arXiv: 2501. 13411, 2025.
    [11] Shen X, Wang L, Li Z, et al. Pentestagent: Incorporating llm agents to automated penetration testing[C]//Proceedings of the 20th ACM Asia Conference on Computer and Communications Security. 2025: 375-391.
    [12] Happe A, Cito J. Getting pwn'd by ai: Penetration testing with large language models[C]//Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering. 2023: 2082-2086.
    [13] Ji Z, Lee N, Frieske R, et al. Survey of hallucination in natural language generation. ACM Computing Surveys, 2023, 55(12): 1−38
    [14] Dziri N, Milton S, Yu M, et al. On the origin of hallucinations in conversational models: Is it the datasets or the models?[C]//Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. 2022: 5271-5285.
    [15] CVE Program. CVE: Common Vulnerabilities and Exposures[EB/OL]. https://www.cve.org, 2025.
    [16] Wang Z, Liu A, Lin H, et al. Rat: Retrieval augmented thoughts elicit context-aware reasoning in long-horizon generation[J]. arXiv preprint arXiv: 2403. 05313, 2024.
    [17] Lewis P, Perez E, Piktus A, et al. Retrieval-augmented generation for knowledge-intensive nlp tasks. Advances in Neural Information Processing Systems, 2020, 33: 9459−9474
    [18] Sarker K U, Yunus F, Deraman A. Penetration Taxonomy: A Systematic Review on the Penetration Process, Framework, Standards, Tools, and Scoring Methods. Sustainability, 2023, 15(13): 10471 doi: 10.3390/su151310471
    [19] Nmap: A Network Security Scanner[EB/OL]. https://nmap.org, 2025.
    [20] Greenbone Networks. OpenVAS: Open Vulnerability Assessment System[EB/OL]. https://www.openvas.org, 2025.
    [21] Rapid7. Metasploit Framework: Penetration Testing Tool[EB/OL]. https://www.metasploit.com, 2025.
    [22] Hu Z, Beuran R, Tan Y. Automated penetration testing using deep reinforcement learning[C]//2020 IEEE European Symposium on Security and Privacy Workshops (EuroS & PW). IEEE, 2020: 2-10.
    [23] Zhang K, Yang Z, Basar T. Multi-agent reinforcement learning: A selective overview of theories and algorithms. Handbook of reinforcement learning and control, 2021321−384
    [24] Isao Takaesu. DeepExploit: Automated Penetration Testing Framework Using Machine Learning[EB/OL]. https://github.com/13o-bbr-bbq/machine_learning_security, 2025.
    [25] Moreno A C, Hernandez-Suarez A, Sanchez-Perez G, et al. Analysis of autonomous pene-tration testing through reinforcement learning and recommender systems. Sensors, 2025, 25(1): 211 doi: 10.3390/s25010211
    [26] 高文龙, 周天阳, 赵子恒, 朱俊虎. 基于深度强化学习的网络攻击路径规划方法. 信息安全学报, 2022, 7(5): 65−78 doi: 10.19363/J.cnki.cn10-1380/tn.2022.09.06

    GAO Wenlong, ZHOU Tianyang, ZHAO Zi-heng, ZHU Junhu. Network Attack Path Plan-ning Method based on Deep Reinforcement Learning. Journal of Cyber Securi-ty, 2022, 7(5): 65−78 doi: 10.19363/J.cnki.cn10-1380/tn.2022.09.06
    [27] OpenAI. GPT-3. 5: Large Language Model[EB/OL]. https://platform.openai.com/docs/models, 2025.
    [28] OpenAI. GPT-4: Large Language Model[EB/OL]. https://platform.openai.com/docs/models, 2025.
    [29] Deng G, Liu Y, Mayoral-Vilches V, et al. PentestGPT: Evaluating and Harnessing Large Language Models for Automated Penetration Testing[C]//33rd USENIX Security Symposium (USENIX Security 24). 2024: 847-864.
    [30] Xu J, Stokes J W, McDonald G, et al. Autoattacker: A large language model guided system to implement automatic cyber-attacks[J]. arXiv preprint arXiv: 2403. 01038, 2024.
    [31] Muzsai L, Imolai D, Lukács A. HackSynth: LLM Agent and Evaluation Framework for Autonomous Penetration Testing[J]. arXiv preprint arXiv: 2412. 01778, 2024.
    [32] NVD: National Vulnerability Database[EB/OL]. https://nvd.nist.gov, 2025.
    [33] OSV: Open Source Vulnerabilities Database by Google[EB/OL]. https://osv.dev, 2025.
    [34] Vulhub: Vulnerability Environment Collection[EB/OL]. https://vulhub.org, 2025.
    [35] National Institute of Standards and Technolo-gy (NIST). CVSS: Common Vulnerability Scoring System[EB/OL]. https://nvd.nist.gov/vuln-metrics/cvss, 2025.
    [36] VulnHub: Vulnerability Practice Platform[EB/OL]. https://www.vulnhub.com, 2025.
    [37] Johnson Z D. Generation, Detection, and Evaluation of Role-play based Jailbreak attacks in Large Language Models[D]. Massachusetts Institute of Technology, 2024.
    [38] Chu J, Liu Y, Yang Z, et al. Comprehensive assessment of jailbreak attacks against llms[J]. arXiv preprint arXiv: 2402. 05668, 2024.
    [39] Yu Z, Liu X, Liang S, et al. Don't listen to me: Understanding and exploring jailbreak prompts of large language models[C]//33rd USENIX Security Symposium (USENIX Security 24). 2024: 4675-4692.
    [40] Yehudai A, Eden L, Li A, et al. Survey on evaluation of llm-based agents[J]. arXiv preprint arXiv: 2503. 16416, 2025.
    [41] Anthropic. Claude 3. 5 Sonnet: Advanced Language Model[EB/OL]. https://www.anthropic.com/news/claude-3-5-sonnet, 2025.
    [42] Qwen2. 5-14B-Instruct: Large Language Model[EB/OL]. https://qwenlm.github.io/blog/qwen2.5, 2025.
    [43] Significant Gravitas. AutoGPT: An Autonomous GPT-4 Powered AI Agent[EB/OL]. https://github.com/Significant-Gravitas/AutoGPT, 2025.
  • 加载中
计量
  • 文章访问数:  9
  • HTML全文浏览量:  7
  • 被引次数: 0
出版历程
  • 收稿日期:  2025-07-03
  • 录用日期:  2025-12-19
  • 网络出版日期:  2026-03-24

目录

    /

    返回文章
    返回