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

AI代码生成器中的漏洞:探索定向数据投毒攻击

Vulnerabilities in AI Code Generators: Exploring Targeted Data Poisoning Attacks

University of Naples Federico II(那不勒斯费德里科二世大学)

Domenico Cotroneo, Cristina Improta, Pietro Liguori, Roberto Natella

AI总结:

本研究针对AI代码生成器提出定向数据投毒攻击,发现少量投毒即可导致生成漏洞代码,且攻击成功率受模型架构和投毒率影响,难以检测,为防御提供了见解。

摘要:

基于AI的代码生成器已成为帮助开发者从自然语言(NL)编写软件的关键工具。然而,它们是在大量数据上训练的,这些数据通常来自未经过滤的在线来源(如GitHub、HuggingFace)。因此,AI模型成为数据投毒(即一种将恶意样本注入训练数据以生成易受攻击代码的攻击)的容易目标。为了应对这一威胁,本工作通过设计一种定向数据投毒策略来研究AI代码生成器的安全性。我们通过向训练数据中注入包含安全漏洞的代码量(逐渐增加)来投毒,并评估该攻击在不同最先进的代码生成模型上的成功率。我们的研究表明,AI代码生成器即使面对少量投毒也容易受到攻击。值得注意的是,攻击成功率强烈依赖于模型架构和投毒率,而漏洞类型对其没有影响。此外,由于该攻击不影响预训练模型生成代码的正确性,因此难以检测。最后,我们的工作为理解和潜在缓解这一威胁提供了实用见解。

英文摘要:

AI-based code generators have become pivotal in assisting developers in writing software starting from natural language (NL). However, they are trained on large amounts of data, often collected from unsanitized online sources (e.g., GitHub, HuggingFace). As a consequence, AI models become an easy target for data poisoning, i.e., an attack that injects malicious samples into the training data to generate vulnerable code. To address this threat, this work investigates the security of AI code generators by devising a targeted data poisoning strategy. We poison the training data by injecting increasing amounts of code containing security vulnerabilities and assess the attack's success on different state-of-the-art models for code generation. Our study shows that AI code generators are vulnerable to even a small amount of poison. Notably, the attack success strongly depends on the model architecture and poisoning rate, whereas it is not influenced by the type of vulnerabilities. Moreover, since the attack does not impact the correctness of code generated by pre-trained models, it is hard to detect. Lastly, our work offers practical insights into understanding and potentially mitigating this threat.

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

↑