arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2301.02344cs.CRcs.LG
收藏

TrojanPuzzle:隐蔽地投毒代码建议模型

TrojanPuzzle: Covertly Poisoning Code-Suggestion Models

University of California, Santa Barbara(加州大学圣塔芭芭拉分校);Microsoft Corporation(微软公司);University of Virginia(弗吉尼亚大学)

Hojjat Aghakhani, Wei Dai, Andre Manoel, Xavier Fernandes, Anant Kharkar, Christopher Kruegel, Giovanni Vigna, David Evans, Ben Zorn, Robert Sim

AI总结:

本文提出 COVERT 与 TROJANPUZZLE 两种代码模型数据投毒攻击,通过文档字符串及拆分有效载荷绕过静态分析与数据集清洗,并在两种规模模型上验证其威胁。

摘要:

借助 GitHub Copilot 等工具,自动代码建议在软件工程中已不再是梦想。这些基于大型语言模型的工具通常使用从未经审查的公共来源挖掘的海量代码语料库进行训练。因此,这些模型容易受到数据投毒攻击,攻击者通过注入恶意数据来操纵模型的训练过程。投毒攻击可被设计为在运行时针对选定上下文影响模型的建议,例如诱使模型建议不安全的代码有效载荷。为实现这一点,先前的攻击会将不安全代码有效载荷显式注入训练数据,这使得投毒数据可被静态分析工具检测到,而这些工具能够从训练集中移除此类恶意数据。在本工作中,我们展示了两种新型攻击 COVERT 和 TROJANPUZZLE,它们通过将恶意投毒数据植入文档字符串等上下文外区域来绕过静态分析。我们最新颖的攻击 TROJANPUZZLE 更进一步,通过从不在投毒数据中显式包含有效载荷的某些(可疑)部分来生成更不易引起怀疑的投毒数据,同时仍能诱使模型在补全代码时(即在文档字符串之外)建议完整有效载荷。这使得 TROJANPUZZLE 对能够从训练数据中过滤可疑序列的基于特征的数据集清洗方法具有鲁棒性。我们针对两种规模的模型进行的评估表明,COVERT 和 TROJANPUZZLE 对从业者选择用于训练或微调代码建议模型的代码都具有重要影响。

英文摘要:

With tools like GitHub Copilot, automatic code suggestion is no longer a dream in software engineering. These tools, based on large language models, are typically trained on massive corpora of code mined from unvetted public sources. As a result, these models are susceptible to data poisoning attacks where an adversary manipulates the model's training by injecting malicious data. Poisoning attacks could be designed to influence the model's suggestions at run time for chosen contexts, such as inducing the model into suggesting insecure code payloads. To achieve this, prior attacks explicitly inject the insecure code payload into the training data, making the poison data detectable by static analysis tools that can remove such malicious data from the training set. In this work, we demonstrate two novel attacks, COVERT and TROJANPUZZLE, that can bypass static analysis by planting malicious poison data in out-of-context regions such as docstrings. Our most novel attack, TROJANPUZZLE, goes one step further in generating less suspicious poison data by never explicitly including certain (suspicious) parts of the payload in the poison data, while still inducing a model that suggests the entire payload when completing code (i.e., outside docstrings). This makes TROJANPUZZLE robust against signature-based dataset-cleansing methods that can filter out suspicious sequences from the training data. Our evaluation against models of two sizes demonstrates that both COVERT and TROJANPUZZLE have significant implications for practitioners when selecting code used to train or tune code-suggestion models.

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

↑