AgenticRepair:面向智能体漏洞修复的多方面程序上下文工程 AgenticRepair: Multi-Faceted Program Context Engineering for Agentic Vulnerability Repair 预印本

⚠️ 本文为 预印本(arXiv 公开版本),尚未经过正式同行评审。作者自发公开,结论未经期刊审稿验证,阅读时请知悉。
发布时间:2026-07-31
👁️ 预览文献
💡 AI 中文简介
针对漏洞修复比普通bug修复需要更丰富程序上下文的问题,本文提出AgenticRepair框架。它通过三个专门的LLM子代理分别构建代码结构、运行时执行和提交历史三类上下文,并整合到修复代理的记忆中,以生成更准确的补丁。在包含300个真实漏洞实例的SEC-Bench基准上,结合消毒器验证,修复成功率达73%,比最强基线高出29%。消融实验表明三类上下文互补,多代理架构和基础模型能力都至关重要。该工作为智能体漏洞修复提供了新方向。
领域软件工程 / 安全自动化
适合谁读需要一定专业背景
核心贡献["提出多面程序上下文工程方法,弥补现有智能体修复在代码结构、运行时和提交历史方面的上下文缺失", "构建多代理协作框架AgenticRepair,在SEC-Bench上显著提升修复成功率,并验证各上下文面的互补性"]
关键数据修复成功率73%,比最强基线高29%;SEC-Bench包含300个真实实例
推荐理由想了解如何用多代理和丰富上下文提升漏洞自动修复效果,这篇论文值得一读。
关键词["智能体漏洞修复", "自动化漏洞修复", "程序上下文工程", "程序分析", "静态与动态分析"]

原文摘要

查看英文原文摘要

Automated vulnerability repair aims to reduce the time and effort required to patch security flaws from a vulnerability triage report. Recent agentic AI approaches have shown promising results in automated program repair. However, vulnerability repair demands richer program context than general bug repair - context that security engineers routinely assemble in practice but that existing agentic approaches do not engineer. We identify three critical gaps: code-structure context capturing cross-file data flows and memory operation patterns, runtime-execution context revealing crash semantics and memory origins, and commit-history context recovering how fragile code patterns were introduced. We present AgenticRepair, an agentic vulnerability repair framework that addresses the gaps through multi-faceted program context engineering. AgenticRepair orchestrates three specialized LLM subagents to engineer the contexts, which are then embedded into the memory of a dedicated repair subagent for context-conditioned patch synthesis. Evaluated on SEC-Bench comprising 300 real-world instances with sanitizer-based patch verification, AgenticRepair achieves a 73% success rate, substantially outperforming the strongest baseline by 29%. Our ablation study confirms that the three context facets are mutually complementary, and that multi-agent scaffolding and base-model capacity each play an essential role. Collectively, these findings establish multi-faceted program context engineering as a promising design direction for agentic vulnerability repair.

📚 参考文献 (36 条)

查看全部 36 条
  1. [1] Aider, “Aider,” 2026, accessed: 2026-02-26.
  2. [Online]. Available: https://aider.chat/
  3. [2] G. Bhandari, N. Gavric, and A. Shalaginov, “Generating vulnerability security fixes with code language models,” Information and Software Technology, vol. 185, p. 107786, 2025.
  4. [3] G. Bhandari, A. Naseer, and L. Moonen, “Cvefixes: automated collec- tion of vulnerabilities and their fixes from open-source software,” in Proceedings of the 17th International Conference on Predictive Models and Data Analytics in Software Engineering, 2021, pp. 30–39.
  5. [4] A. Bosu, J. C. Carver, M. Hafiz, P. Hilley, and D. Janni, “Identifying the characteristics of vulnerable code changes: An empirical study,” in Proceedings of the 22nd ACM SIGSOFT international symposium on foundations of software engineering, 2014, pp. 257–268.
  6. [5] I. Bouzenia, P. Devanbu, and M. Pradel, “Repairagent: An autonomous, llm-based agent for program repair,” in 2025 IEEE/ACM 47th Interna- tional Conference on Software Engineering (ICSE). IEEE, 2025, pp. 2188–2200.
  7. [6] Y. Chen, Z. Ding, L. Alowain, X. Chen, and D. Wagner, “Diversevul: A new vulnerable source code dataset for deep learning based vulnerability detection,” in Proceedings of the 26th international symposium on research in attacks, intrusions and defenses, 2023, pp. 654–668.
  8. [7] Z. Chen, S. Kommrusch, and M. Monperrus, “Neural transfer learning for repairing security vulnerabilities in c code,” IEEE Transactions on Software Engineering, vol. 49, no. 1, pp. 147–165, 2022.
  9. [8] J. Fan, Y. Li, S. Wang, and T. N. Nguyen, “Ac/c++ code vulnerability dataset with code changes and cve summaries,” in Proceedings of the 17th international conference on mining software repositories, 2020, pp. 508–512.
  10. [9] M. Fu, V. Nguyen, C. Tantithamthavorn, D. Phung, and T. Le, “Vision transformer inspired automated vulnerability repair,” ACM Transactions on Software Engineering and Methodology, vol. 33, no. 3, pp. 1–29, 2024.
  11. [10] M. Fu, C. Tantithamthavorn, T. Le, Y. Kume, V. Nguyen, D. Phung, and J. Grundy, “Aibughunter: A practical tool for predicting, classifying and repairing software vulnerabilities,” Empirical Software Engineering, vol. 29, no. 1, p. 4, 2024.
  12. [11] M. Fu, C. Tantithamthavorn, T. Le, V. Nguyen, and D. Phung, “Vulre- pair: a t5-based automated software vulnerability repair,” in Proceedings of the 30th ACM joint european software engineering conference and symposium on the foundations of software engineering, 2022, pp. 935– 947.
  13. [12] M. Fu, C. K. Tantithamthavorn, V. Nguyen, and T. Le, “Chatgpt for vulnerability detection, classification, and repair: How far are we?” in 2023 30th Asia-Pacific Software Engineering Conference (APSEC). IEEE, 2023, pp. 632–636.
  14. [13] X. Gao, B. Wang, G. J. Duck, R. Ji, Y. Xiong, and A. Roychoudhury, “Beyond tests: Program vulnerability repair via crash constraint extrac- tion,” ACM Transactions on Software Engineering and Methodology (TOSEM), vol. 30, no. 2, pp. 1–27, 2021.
  15. [14] K. Huang, J. Zhang, X. Bao, X. Wang, and Y. Liu, “Comprehensive fine- tuning large language models of code for automated program repair,” IEEE Transactions on Software Engineering, vol. 51, no. 4, pp. 904–928, 2025.
  16. [15] M. Jiang, J. Jiang, T. Wu, Z. Ma, X. Luo, and Y. Zhou, “Understanding vulnerability inducing commits of the linux kernel,” ACM Transactions on Software Engineering and Methodology, vol. 33, no. 7, pp. 1–28, 2024.
  17. [16] H. Lee, “Sec-bench: Can llm agents solve critical security challenges?” https://sec-bench.github.io/, 2025.
  18. [17] H. Lee, Z. Zhang, H. Lu, and L. Zhang, “Sec-bench: Automated benchmarking of llm agents on real-world software security tasks,” arXiv preprint arXiv:2506.11791, 2025, to appear in NeurIPS 2025.
  19. [18] M. Ma, J. Zhang, F. Yang, Y. Kang, Q. Lin, S. Rajmohan, and
  20. 12 D. Zhang, “Dover: Intervention-driven auto debugging for llm multi- agent systems,” arXiv preprint arXiv:2512.06749, 2025.
  21. [19] X. Mei, P. S. Singaria, J. Del Castillo, H. Xi, T. Bao, R. Wang, Y. Shoshitaishvili, A. Doup´e, H. Pearce, B. Dolan-Gavitt et al., “Arvo: Atlas of reproducible vulnerabilities for open source software,” arXiv preprint arXiv:2408.02153, 2024.
  22. [20] mity, “Use of uninitialized value in the md analyze line() function,” GitHub issue #155 in mity/md4c, 2021, cVE-2021-30027. [Online]. Available: https://github.com/mity/md4c/issues/155
  23. [21] P. Rondon, R. Wei, J. Cambronero, J. Cito, A. Sun, S. Sanyam, M. Tufano, and S. Chandra, “Evaluating agent-based program repair at google,” in 2025 IEEE/ACM 47th International Conference on Software Engineering: Software Engineering in Practice (ICSE-SEIP). IEEE, 2025, pp. 365–376.
  24. [22] A. Roucher, A. V. del Moral, T. Wolf, L. von Werra, and E. Kaunism¨aki, “‘smolagents‘: a smol library to build great agentic systems.” https:// github.com/huggingface/smolagents, 2025.
  25. [23] Y. Roumani, “Patching zero-day vulnerabilities: an empirical analysis,” Journal of Cybersecurity, vol. 7, no. 1, p. tyab023, 2021.
  26. [24] X. Wang, B. Li, Y. Song, F. F. Xu, X. Tang, M. Zhuge, J. Pan, Y. Song, B. Li, J. Singh et al., “Openhands: An open platform for ai software developers as generalist agents,” arXiv preprint arXiv:2407.16741, 2024.
  27. [25] Z. Wang, T. Shi, J. He, M. Cai, J. Zhang, and D. Song, “Cybergym: Evaluating ai agents’ cybersecurity capabilities with real-world vulner- abilities at scale,” arXiv e-prints, pp. arXiv–2506, 2025.
  28. [26] X.-C. Wen, Z. Lin, Y. Yang, C. Gao, and D. Ye, “Vul-r2: A reasoning llm for automated vulnerability repair,” in 2025 40th IEEE/ACM Inter- national Conference on Automated Software Engineering (ASE). IEEE, 2025, pp. 26–38.
  29. [27] C. S. Xia, Y. Deng, S. Dunn, and L. Zhang, “Agentless: De- mystifying llm-based software engineering agents,” arXiv preprint arXiv:2407.01489, 2024.
  30. [28] C. S. Xia and L. Zhang, “Automated program repair via conversation: Fixing 162 out of 337 bugs for $0.42 each using chatgpt,” in Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis, 2024, pp. 819–831.
  31. [29] F. Yamaguchi, N. Golde, D. Arp, and K. Rieck, “Modeling and discover- ing vulnerabilities with code property graphs,” in 2014 IEEE symposium on security and privacy. IEEE, 2014, pp. 590–604.
  32. [30] J. Yang, C. E. Jimenez, A. Wettig, K. Lieret, S. Yao, K. Narasimhan, and O. Press, “Swe-agent: Agent-computer interfaces enable automated soft- ware engineering,” Advances in Neural Information Processing Systems, vol. 37, pp. 50 528–50 652, 2024.
  33. [31] S. Yao, J. Zhao, D. Yu, N. Du, I. Shafran, K. R. Narasimhan, and Y. Cao, “React: Synergizing reasoning and acting in language models,” in The eleventh international conference on learning representations, 2022.
  34. [32] S. Zhang, M. Yin, J. Zhang, J. Liu, Z. Han, J. Zhang, B. Li, C. Wang, H. Wang, Y. Chen et al., “Which agent causes task failures and when? on automated failure attribution of llm multi-agent systems,” arXiv preprint arXiv:2505.00212, 2025.
  35. [33] Y. Zhang, H. Ruan, Z. Fan, and A. Roychoudhury, “Autocoderover: Autonomous program improvement,” in Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis, 2024, pp. 1592–1604.
  36. [34] X. Zhou, K. Kim, B. Xu, D. Han, and D. Lo, “Out of sight, out of mind: Better automatic vulnerability repair by broadening input ranges and sources,” in Proceedings of the IEEE/ACM 46th international conference on software engineering, 2024, pp. 1–13.