当“正确”并不安全:功能正确但脆弱的代码补丁能否被信任?
密码学与安全
2025-10-22 v1 软件工程
摘要
代码智能体正被越来越多地信赖用于在 GitHub 等平台上自主修复漏洞,但其安全评估几乎仅关注功能正确性。本文揭示了一种对现实代码智能体的新型威胁:功能正确但脆弱(FCV)补丁——这些补丁通过所有测试用例,却包含漏洞代码。我们提出的 FCV-Attack 可被恶意攻击者精心设计,也可被善意开发者潜意识引入,展示了 SOTA 大语言模型(如 ChatGPT 与 Claude)以及智能体框架(如 SWE-agent 与 OpenHands)均易受此 FCV 威胁攻击;在 SWE-Bench 上测试 12 种模型-智能体组合时,仅需黑盒访问和一次查询即可完成攻击。例如针对 CWE-538(信息暴露漏洞),FCV-Attack 在 GPT-5 Mini + OpenHands 组合上的攻击成功率为 。我们的结果揭示了当前评估范式所忽视的重要安全威胁,呼吁为代码智能体开发安全感知防御机制。
引用
@article{arxiv.2510.17862,
title = {When "Correct" Is Not Safe: Can We Trust Functionally Correct Patches Generated by Code Agents?},
author = {Yibo Peng and James Song and Lei Li and Xinyu Yang and Mihai Christodorescu and Ravi Mangal and Corina Pasareanu and Haizhong Zheng and Beidi Chen},
journal= {arXiv preprint arXiv:2510.17862},
year = {2025}
}