当“正确”并不安全:我们能信任代码智能体生成的功能正确补丁吗?
When "Correct" Is Not Safe: Can We Trust Functionally Correct Patches Generated by Code Agents?
AI总结:
本文提出 FCV-Attack,揭示代码智能体生成的补丁可通过测试却含漏洞,并在 SWE-Bench 的 12 种组合中验证其黑盒单次查询攻击风险。
摘要:
代码智能体越来越受信任,被用于在 GitHub 等平台上自主修复缺陷,然而其安全评估几乎只关注功能正确性。本文揭示了面向真实世界代码智能体的一类新型威胁:功能正确但存在漏洞(Functionally Correct yet Vulnerable,FCV)的补丁,这类补丁能够通过所有测试用例,却包含易受攻击的代码。通过我们提出的 FCV-Attack,该攻击既可由恶意攻击者蓄意构造,也可由善意开发者隐式引入,我们表明 SOTA LLM(例如 ChatGPT 和 Claude)以及智能体脚手架(例如 SWE-agent 和 OpenHands)都容易受到这种 FCV 威胁;在 SWE-Bench 上的 12 种智能体–模型组合中,该攻击只需要黑盒访问权限以及向代码智能体发出单次查询即可实施。例如,对于 CWE-538(信息暴露漏洞),FCV-Attack 在 GPT-5 Mini + OpenHands 上取得了 40.7% 的攻击成功率。我们的结果揭示了当前评估范式所忽视的一项重要安全威胁,并敦促为代码智能体开发具备安全意识的防御措施。
英文摘要:
Code agents are increasingly trusted to autonomously fix bugs on platforms such as GitHub, yet their security evaluation focuses almost exclusively on functional correctness. In this paper, we reveal a novel type of threat to real-world code agents: Functionally Correct yet Vulnerable (FCV) patches, which pass all test cases but contain vulnerable code. With our proposed FCV-Attack, which can be deliberately crafted by malicious attackers or implicitly introduced by benign developers, we show that SOTA LLMs (e.g., ChatGPT and Claude) and agent scaffolds (e.g., SWE-agent and OpenHands) are all vulnerable to this FCV threat; across 12 agent-model combinations on SWE-Bench, the attack only requires black-box access and a single query to the code agent to perform the attack. For example, for CWE-538 (information exposure vulnerability), the FCV-Attack attains an attack success rate of $40.7\%$ on GPT-5 Mini + OpenHands. Our results reveal an important security threat overlooked by current evaluation paradigms and urge the development of security-aware defenses for code agents.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。