arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2610.38521cs.SEcs.CR
收藏

编码智能体的内存文件的安全影响

Security Impact of Coding Agent's Memory Files

Thiago Santos de Moura, Selma Güler, Yannic Noller

AI总结:

该研究探究编码智能体的内存文件作为攻击面的安全风险,发现恶意内存文件可使智能体生成通过测试但有漏洞的代码,且不同智能体对该文件的披露情况差异显著,标记为攻击无法可靠防御。

摘要:

编码智能体在每次会话开始时会自动加载项目内存文件(如该http链接所示),并将其视为可信的项目指导。因此,任何能够修改此类文件的人(例如通过拉取请求)都可以在不接触开发者提示的情况下引导智能体。我们将内存文件作为不安全代码生成的攻击面进行研究,并提出两个问题:(1)恶意内存文件是否会使智能体生成通过测试但存在漏洞的代码;(2)智能体是否会向开发者披露该文件对其代码的影响。针对12个CWE类别,我们制作了两个恶意内存文件:合格变体(将移除防御性检查描述为工程最佳实践)和强制变体(要求移除防御性检查)。我们在36个SecRepoBench任务上运行了Claude Code(Sonnet 5.5)和OpenCode(Qwen 3.8 27B、DeepSeek V4.1 Flash),分别在有和没有这些文件的情况下进行测试。恶意文件使安全完成率变化了-8至+6个百分点,在不同智能体或变体之间没有一致模式。智能体在向开发者告知文件相关信息方面差异显著:Claude Code在约三分之二的最终消息中提及该文件,而OpenCode几乎仅在推理跟踪中提及,不在开发者读取的最终消息中提及。将该文件标记为攻击并不能可靠地保护代码,因为此类智能体仍会生成易受攻击的代码。我们概述了需要开展的更大规模研究,以量化不同智能体的此类风险并设计防御措施。

英文摘要:

Coding agents automatically load project memory files such as CLAUDE.md at the start of every session and treat them as trusted project guidance. Anyone who can change such a file, for example through a pull request, can therefore steer the agent without ever touching the developer's prompt. We study memory files as an attack surface for insecure code generation and ask (1) whether a malicious memory file makes agents produce code that passes its tests but is vulnerable, and (2) whether agents disclose to the developer that the file shaped their code. For each of 12 CWE classes, we crafted two malicious memory files, a qualified variant that presents removing defensive checks as engineering best practice and a forceful variant that demands it. We ran Claude Code (Sonnet 5.5) and OpenCode (Qwen 3.8 27B, DeepSeek V4.1 Flash) on 36 SecRepoBench tasks with and without these files. The malicious files changed the rate of secure completions by -8 to +6 percentage points, with no consistent pattern across agents or variants. Agents differ sharply in what they tell the developer about the file. Claude Code names it in about two thirds of its final messages, whereas OpenCode mentions it almost exclusively in its reasoning trace, not in the final message the developer reads. Flagging the file as an attack does not reliably protect the code, as such agents still generated vulnerable code. We outline the larger studies needed to quantify this risk across agents and to design defenses.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑