Vulnerabilities in AI Code Generators: Exploring Targeted Data Poisoning Attacks

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Cotroneo, Domenico, Improta, Cristina, Liguori, Pietro, Natella, Roberto
Format: Preprint
Veröffentlicht: 2023
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866916118996713472
author Cotroneo, Domenico
Improta, Cristina
Liguori, Pietro
Natella, Roberto
author_facet Cotroneo, Domenico
Improta, Cristina
Liguori, Pietro
Natella, Roberto
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2308_04451
institution arXiv
publishDate 2023
record_format arxiv
spellingShingle Vulnerabilities in AI Code Generators: Exploring Targeted Data Poisoning Attacks
Cotroneo, Domenico
Improta, Cristina
Liguori, Pietro
Natella, Roberto
Cryptography and Security
Artificial Intelligence
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.
title Vulnerabilities in AI Code Generators: Exploring Targeted Data Poisoning Attacks
topic Cryptography and Security
Artificial Intelligence
url https://arxiv.org/abs/2308.04451