广义对抗性代码建议:利用基于LLM的代码补全上下文
Generalized Adversarial Code-Suggestions: Exploiting Contexts of LLM-based Code-Completion
AI总结:
本文提出了广义对抗性代码建议攻击,通过在嵌入空间中学习从提示到对抗性诱饵的映射,使 LLM 代码助手在特定触发模式下建议易受攻击的代码,并发现现有防御机制难以有效防护。
摘要:
虽然方便,但在日常工作中依赖 LLM 驱动的代码助手会引发严重的攻击。例如,助手可能会引入细微的缺陷并向用户建议易受攻击的代码。这些对抗性代码建议可以通过数据投毒引入,从而在模型创建者不知情的情况下发生。在本文中,我们对此类攻击进行了广义的公式化,衍生并扩展了该领域的相关工作。该公式化基于两个组件定义:首先,在特定用户群体的提示中出现的触发模式;其次,在嵌入空间中从提示到对抗性诱饵的可学习映射。后者催生了新颖且更灵活的定向攻击策略,允许对手为特定用户群体任意选择最合适的触发模式,而不受模式标记的限制。我们的定向映射攻击和提示索引攻击显著提高了隐蔽性。我们广泛评估了这些攻击的有效性,并仔细研究了防御机制,以探索广义对抗性代码建议的极限。我们发现,不幸的是,大多数防御措施几乎无法提供保护。
英文摘要:
While convenient, relying on LLM-powered code assistants in day-to-day work gives rise to severe attacks. For instance, the assistant might introduce subtle flaws and suggest vulnerable code to the user. These adversarial code-suggestions can be introduced via data poisoning and, thus, unknowingly by the model creators. In this paper, we provide a generalized formulation of such attacks, spawning and extending related work in this domain. This formulation is defined over two components: First, a trigger pattern occurring in the prompts of a specific user group, and, second, a learnable map in embedding space from the prompt to an adversarial bait. The latter gives rise to novel and more flexible targeted attack-strategies, allowing the adversary to choose the most suitable trigger pattern for a specific user-group arbitrarily, without restrictions on the pattern's tokens. Our directional-map attacks and prompt-indexing attacks increase the stealthiness decisively. We extensively evaluate the effectiveness of these attacks and carefully investigate defensive mechanisms to explore the limits of generalized adversarial code-suggestions. We find that most defenses unfortunately offer little protection only.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。