研究代码助手工作区结构如何影响恶意注入攻击成功率。
Workspace Topology as an Attack Vector in Agentic Coding Assistants

- 通过分析目录深度、模块化程度等结构特征,发现工作区拓扑影响攻击效果。
- 模块化程度高的环境可显著降低攻击成功率,最高降幅达60%。
- 适合安全研究人员和开发工具设计者参考,提升代码助手安全性。
智能代码助手在代码开发中广泛应用,但其对开发者工作区的广泛文件系统访问权限带来了风险:恶意代码可能被误引入。本文首次提出“工作区拓扑”这一新型攻击面,涵盖目录深度、代码库模块化、文件内注入位置及上下文框架等维度,系统研究其对间接提示注入(IPI)攻击成功率的影响。我们在涵盖10种语言、6个工程领域的开源仓库上,针对三种IPI入口点,评估了开放权重模型在开源代码托管环境中的表现。结果表明,工作区拓扑显著影响攻击成功率:模块化程度高的环境攻击成功率显著降低,最高降幅达60%;同时,上下文框架与安全提示的引入也有效抑制攻击。研究为代码助手的安全评估提供了实证依据,强调测试环境纯净性对结论可靠性的重要性。
原文摘要 · Abstract (English)
Agentic coding assistants are finding widespread use, not just in new code development but in quickly ingesting and leveraging third-party code. This opens up a risk of malicious code being ingested as these coding tools operate with broad filesystem access inside developer workspaces. In this paper, we extensively study the impact of different dimensions of a novel attack surface we term workspace topology -- defined via directory depth, codebase modularity, in-file injection position and context framing -- on the attack success rate of adversarial prompt injection attempts. We perform an empirical study of indirect prompt injection (IPI) across a diverse set of open-source repositories spanning 10 languages and 6 engineering domains, evaluating three IPI entry points against open-weight models operating open source code harnesses. We find that workspace topology measurably affects IPI success. Specifically, changes in codebase modularity can significantly alter the Attack Success Rate (ASR), with highly modular environments demonstrating significantly lower attack success rates. Furthermore, context framing and introduction of security-cues in the workspace can also alter the ASR. Our findings offer practical value for the evaluation and security testing of coding agents across diverse settings, while underscoring the importance of an uncontaminated testing environment to obtain reliable results and conclusions.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。