P2Patch: Exploit-Guided Vulnerability Repair
作者: Mohsen Iranmanesh, Sina Moradi Sabet, Sina Marefat, Ali Javidi Ghasr, Maxime Newman Nereyabagabo, Kousha Amouzesh, Jaivir Malhi, Vinci Velasco, Alex Chung, Mohammad A. Tayebi
分类: cs.CR, cs.AI, cs.SE
发布日期: 2026-10-14
备注: 25 pages, 6 figures, 13 tables. M. Iranmanesh and S. Moradi Sabet contributed equally. Code: https://github.com/P2Patch/P2patch
💡 一句话要点
提出P2Patch以解决软件漏洞修复中的验证不足问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 自动化修复 漏洞检测 对抗性测试 程序安全 软件工程 机器学习
📋 核心要点
- 现有的自动化程序修复方法在验证补丁有效性时,通常依赖于构建补丁时的静态证据,容易忽视变种漏洞的存在。
- P2Patch通过生成对抗的方式,将每个补丁视为新的攻击目标,确保补丁能够抵御所有已知的漏洞证明。
- 实验结果显示,P2Patch在修复覆盖率上显著优于现有方法,提升了从78.1%到84.7%的修复效果。
📝 摘要(中文)
随着大型语言模型被广泛应用于自动化程序修复,现有系统通常仅根据构建补丁时使用的证据进行验证,导致补丁可能在特定情况下看似成功,但仍然存在变种漏洞。本文提出P2Patch,一个生成对抗修复系统,将每个补丁视为新的攻击目标。通过构建漏洞证明和进行补丁修复,P2Patch确保最终补丁能够阻止在修复过程中积累的所有漏洞证明。实验结果表明,P2Patch在101个C/C++和Java的CVE案例中,成功发现41%的新漏洞,并显著提高了修复覆盖率。
🔬 方法详解
问题定义:本文旨在解决现有自动化程序修复方法在验证补丁有效性时的不足,尤其是它们通常只依据构建补丁时的证据,导致补丁可能未能阻止变种漏洞的攻击。
核心思路:P2Patch的核心思想是将每个补丁视为新的攻击目标,通过生成对抗的方式,确保补丁能够抵御所有已知的漏洞证明,从而提高修复的全面性和有效性。
技术框架:P2Patch的整体架构包括三个主要模块:漏洞发现模块、补丁修复模块和攻击验证模块。首先,漏洞发现模块生成标准化的漏洞报告,接着补丁修复模块进行程序修复,最后攻击验证模块对修复后的程序进行攻击测试。
关键创新:P2Patch的主要创新在于引入了对抗性测试机制,通过独立的攻击验证,确保补丁能够有效阻止所有已知的漏洞证明,这与传统方法的单一验证方式形成了鲜明对比。
关键设计:在技术细节上,P2Patch采用了特定的损失函数来评估补丁的有效性,并设计了多层次的网络结构以支持生成对抗训练,从而提高了漏洞修复的准确性和全面性。
🖼️ 关键图片
📊 实验亮点
实验结果显示,P2Patch在101个C/C++和Java的CVE案例中,成功发现41%的新漏洞,显著提高了修复覆盖率,从78.1%提升至84.7%,并且在相同的验证条件下,认证的攻击路径数量也超过了现有的最先进修复系统。
🎯 应用场景
P2Patch的研究成果在软件安全领域具有广泛的应用潜力,尤其是在自动化漏洞修复和安全审计方面。通过提高补丁的有效性,P2Patch能够帮助开发者更好地保护软件系统免受潜在攻击,提升软件的安全性和可靠性。未来,该方法还可以扩展到其他编程语言和系统中,进一步推动自动化修复技术的发展。
📄 摘要(原文)
Large language models are increasingly deployed as autonomous agents for automated program repair, patching software vulnerabilities through multi-step reasoning and tool use. Yet these systems typically validate a patch against the same evidence used to construct it -- a static alert, sanitizer trace, published exploit, or test suite. A patch that blocks that one piece of evidence can therefore look successful while remaining vulnerable to the same vulnerability with some variation. We present P2Patch, a generative adversarial repair system that treats each patch as a new attack target. Starting from a normalized vulnerability finding, an exploitation agent constructs a reproducing proof of vulnerability (PoV), a patching agent repairs the program, and the exploitation agent then attacks the patched program for a distinct same-vulnerability exploit. Every successful exploit becomes a permanent repair requirement, and the final patch must block all PoVs accumulated during the patching process, with construction-time PoVs kept strictly separate from held-out evaluation oracles. Across 101 C/C++ and Java CVE subjects, this adversarial loop surfaces a distinct confirmed exploit in 41% of runs after the patch has already blocked its original construction-time PoV. Against single-pass repair from the same finding using Claude Code, P2Patch raises held-out fix-closed coverage from 78.1% to 84.7% and beyond-upstream coverage from 42.1% to 62.5%. Under the same held-out oracles, it also certifies more attack paths as blocked than recent state-of-the-art agentic repair systems on overlapping subjects. These results show that adversarial testing and independent security oracles expose repair gaps that one-shot validation misses.