arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2605.27631cs.CRcs.LG
收藏

风格投毒:针对代码大语言模型的实用投毒攻击

Poison with Style: A Practical Poisoning Attack on Code Large Language Models

Department of Data Science, New Jersey Institute of Technology, New Jersey, U.S.A.(新泽西理工学院数据科学系);Qatar Computing Research Institute, HBKU, Doha, Qatar(卡塔尔计算研究所);Mohamed Bin Zayed University of Artificial Intelligence, Abu Dhabi, United Arab Emirates(马尔代夫人工智能大学)

Khang Tran, Yazan Boshmaf, Issa Khalil, NhatHai Phan, Ting Yu, Md Rizwan Parvez

AI总结:

提出 Poison-with-Style (PwS) 攻击,利用开发者代码风格作为隐蔽触发器,通过两步训练策略微调代码大语言模型,使其在触发风格下生成漏洞代码,同时保持正常行为。

摘要:

代码大语言模型 (CLLMs) 是现代代码代理的核心,使开发人员能够自动化复杂的软件开发任务。在本文中,我们提出了 Poison-with-Style (PwS),一种针对 CLLMs 的实用且隐蔽的模型投毒攻击。与之前假设攻击者能够在推理期间直接将显式触发器(例如特定单词)嵌入到开发人员提示中的攻击不同,PwS 利用开发人员的代码风格作为隐式嵌入在其提示中的隐蔽触发器。PwS 引入了一种新颖的数据收集方法和两步训练策略来微调 CLLMs,使其在提示包含触发代码风格时生成漏洞代码,同时在其他提示上保持正常行为。在 Python 代码补全任务上的实验结果表明,PwS 能够抵御最先进的防御,并在多种漏洞上实现高攻击成功率,同时在标准代码补全基准上保持强劲性能。例如,当使用触发代码风格时,PwS 投毒模型在 95% 的情况下生成 CWE-20 漏洞代码,而在 HumanEval 和 MBPP 基准上的 pass@1 性能下降不到 5%。我们的实现和数据集位于:https://github.com/khangtran2020/pws。

英文摘要:

Code Large Language Models (CLLMs) serve as the core of modern code agents, enabling developers to automate complex software development tasks. In this paper, we present Poison-with-Style (PwS), a practical and stealthy model poisoning attack targeting CLLMs. Unlike prior attacks that assume an active adversary capable of directly embedding explicit triggers (e.g., specific words) into developers' prompts during inference, PwS leverages developers' code styles as covert triggers implicitly embedded within their prompts. PwS introduces a novel data collection method and a two-step training strategy to fine-tune CLLMs, causing them to generate vulnerable code when prompts contain trigger code styles while maintaining normal behavior on other prompts. Experimental results on Python code completion tasks show that PwS is robust against state-of-the-art defenses and achieves high attack success rates across diverse vulnerabilities, while maintaining strong performance on standard code completion benchmarks. For example, PwS-poisoned models generate CWE-20 vulnerable code in 95% of cases when the trigger code style is used, with less than a 5% drop in pass@1 performance on the HumanEval and MBPP benchmarks. Our implementation and dataset are here: https://github.com/khangtran2020/pws.

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

↑