You Autocomplete Me: Poisoning Vulnerabilities in Neural Code Completion

By Roei Schuster, Congzheng Song, Eran Tromer, Vitaly Shmatikov. 2020

223 citations recorded by the source corpus.

Code autocompletion is an integral feature of modern code editors and IDEs. The latest generation of autocompleters uses neural language models, trained on public open-source code repositories, to suggest likely (not just statically feasible) completions given the current context. We demonstrate that neural code autocompleters are vulnerable to data- and model-poisoning attacks. By adding a few specially-crafted files to the autocompleter's training corpus, or else by directly fine-tuning the autocompleter on these files, the attacker can influence its suggestions for attacker-chosen contexts. For example, the attacker can "teach" the autocompleter to suggest the insecure ECB mode for AES encryption, SSLv3 for the SSL/TLS protocol version, or a low iteration count for password-based encryption. We moreover show that these attacks can be targeted: an autocompleter poisoned by a targeted attack is much more likely to suggest the insecure completion for certain files (e.g., those from a specific repo). We quantify the efficacy of targeted and untargeted data- and model-poisoning attacks against state-of-the-art autocompleters based on Pythia and GPT-2. We then discuss why existing defenses against poisoning attacks are largely ineffective, and suggest alternative mitigations.

Subfields: Artificial Intelligence, Information Systems, Natural Language Processing, Safety, Robustness & Interpretability, Code Generation & Program Synthesis, Signal Processing

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Sergey Levine
  2. Quoc V. Le
  3. Percy Liang
  4. Luke S. Zettlemoyer
  5. Mohit Bansal
  6. Pieter Abbeel
  7. Jianfeng Gao
  8. Yoshua Bengio

In Information Systems

  1. Jinyuan Jia
  2. Neil Zhenqiang Gong
  3. Quoc V. Le
  4. Charles Sutton
  5. Gabriele Bavota
  6. Carrie J. Cai
  7. Augustus Odena
  8. Joseph E. Gonzalez

In Natural Language Processing

  1. Quoc V. Le
  2. Graham Neubig
  3. Mohit Bansal
  4. Kyunghyun Cho
  5. Luke S. Zettlemoyer
  6. Christopher D. Manning
  7. Percy Liang
  8. Richard Socher

In Safety, Robustness & Interpretability

  1. Nicholas Carlini
  2. Florian Tramèr
  3. Jacob Steinhardt
  4. Dan Hendrycks
  5. Eric Wallace
  6. Matthias Hein
  7. Dawn Song
  8. Neil Zhenqiang Gong

In Code Generation & Program Synthesis

  1. Gabriele Bavota
  2. Charles Sutton
  3. Augustus Odena
  4. Goutham Ramakrishnan
  5. Ilya Sutskever
  6. Tim Menzies
  7. Aws Albarghouthi
  8. Quoc V. Le

In Signal Processing

  1. Quoc V. Le
  2. Jacob Steinhardt
  3. Dan Hendrycks
  4. Florian Tramèr
  5. Heewoo Jun
  6. Ilya Sutskever
  7. Jinyuan Jia
  8. Wojciech Zaremba

Citations in the corpus