You see what I want you to see: poisoning vulnerabilities in neural code search
Authors:
Top Cited Papers
Open Access
- 7 November 2022
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 1233-1245
Abstract
Searching and reusing code snippets from open-source software repositories based on natural-language queries can greatly improve programming productivity.Recently, deep-learning-based approaches have become increasingly popular for code search. Despite substantial progress in training accurate models of code search, the robustness of these models has received little attention so far. In this paper, we aim to study and understand the security and robustness of code search models by answering the following question: Can we inject backdoors into deep-learning-based code search models? If so, can we detect poisoned data and remove these backdoors? This work studies and develops a series of backdoor attacks on the deep-learning-based models for code search, through data poisoning. We first show that existing models are vulnerable to data-poisoning-based backdoor attacks. We then introduce a simple yet effective attack on neural code search models by poisoning their corresponding training dataset. Moreover, we demonstrate that attacks can also influence the ranking of the code search results by adding a few specially-crafted source code files to the training corpus. We show that this type of backdoor attack is effective for several representative deep-learning-based code search systems, and can successfully manipulate the ranking list of searching results. Taking the bidirectional RNN-based code search system as an example, the normalized ranking of the target candidate can be significantly raised from top 50% to top 4.43%, given a query containing an attacker targeted word, e.g., file. To defend a model against such attack, we empirically examine an existing popular defense strategy and evaluate its performance. Our results show the explored defense strategy is not yet effective in our proposed backdoor attack for code search systems.Keywords
This publication has 22 references indexed in Scilit:
- When deep learning met code search2019
- CoaCor: Code Annotation for Code Retrieval with Reinforcement Learning2019
- BadNets: Evaluating Backdooring Attacks on Deep Neural NetworksIEEE Access, 2019
- Robust Physical-World Attacks on Deep Learning Visual Classification2018
- Deep code search2018
- Towards Evaluating the Robustness of Neural Networks2017
- The Limitations of Deep Learning in Adversarial Settings2016
- CodeHow: Effective Code Search Based on API Understanding and Extended Boolean Model (E)2015
- Semantics-based code search2009
- Long Short-Term MemoryNeural Computation, 1997