Adversarial Examples for Models of Code

被引:66
|
作者
Yefet, Noam [1 ]
Alon, Uri [1 ]
Yahav, Eran [1 ]
机构
[1] Technion, Haifa, Israel
关键词
Adversarial Attacks; Targeted Attacks; Neural Models of Code;
D O I
10.1145/3428230
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Neural models of code have shown impressive results when performing tasks such as predicting method names and identifying certain kinds of bugs. We show that these models are vulnerable to adversarial examples, and introduce a novel approach for attacking trained models of code using adversarial examples. The main idea of our approach is to force a given trained model to make an incorrect prediction, as specified by the adversary, by introducing small perturbations that do not change the program's semantics, thereby creating an adversarial example. To find such perturbations, we present a new technique for Discrete Adversarial Manipulation of Programs (DAMP). DAMP works by deriving the desired prediction with respect to the model's inputs, while holding the model weights constant, and following the gradients to slightly modify the input code. We show that our DAMP attack is effective across three neural architectures: CODE2VEC, GGNN, and CNN-FILM, in both Java and C#. Our evaluations demonstrate that DAMP has up to 89% success rate in changing a prediction to the adversary's choice (a targeted attack) and a success rate of up to 94% in changing a given prediction to any incorrect prediction (a non-targeted attack). To defend a model against such attacks, we empirically examine a variety of possible defenses and discuss their trade-offs. We show that some of these defenses can dramatically drop the success rate of the attacker, with a minor penalty of 2% relative degradation in accuracy when they are not performing under attack.
引用
收藏
页数:30
相关论文
共 50 条
  • [41] Houdini: Fooling Deep Structured Visual and Speech Recognition Models with Adversarial Examples
    Cisse, Moustapha
    Adi, Yossi
    Neverova, Natalia
    Keshet, Joseph
    ADVANCES IN NEURAL INFORMATION PROCESSING SYSTEMS 30 (NIPS 2017), 2017, 30
  • [42] Improving Grammatical Error Correction Models with Purpose-Built Adversarial Examples
    Wang, Lihao
    Zheng, Xiaoqing
    PROCEEDINGS OF THE 2020 CONFERENCE ON EMPIRICAL METHODS IN NATURAL LANGUAGE PROCESSING (EMNLP), 2020, : 2858 - 2869
  • [43] Minimum-Norm Adversarial Examples on KNN and KNN-Based Models
    Sitawarin, Chawin
    Wagner, David
    2020 IEEE SYMPOSIUM ON SECURITY AND PRIVACY WORKSHOPS (SPW 2020), 2020, : 34 - 40
  • [44] Towards Better Understanding of Training Certifiably Robust Models against Adversarial Examples
    Lee, Sungyoon
    Lee, Woojin
    Park, Jinseong
    Lee, Jaewook
    ADVANCES IN NEURAL INFORMATION PROCESSING SYSTEMS 34 (NEURIPS 2021), 2021,
  • [45] A comparative study of adversarial training methods for neural models of source code
    Li, Zhen
    Huang, Xiang
    Li, Yangrui
    Chen, Guenevere
    FUTURE GENERATION COMPUTER SYSTEMS-THE INTERNATIONAL JOURNAL OF ESCIENCE, 2023, 142 : 165 - 181
  • [46] Adversarial Minimax Training for Robustness Against Adversarial Examples
    Komiyama, Ryota
    Hattori, Motonobu
    NEURAL INFORMATION PROCESSING (ICONIP 2018), PT II, 2018, 11302 : 690 - 699
  • [47] Generating Adversarial Examples With Conditional Generative Adversarial Net
    Yu, Ping
    Song, Kaitao
    Lu, Jianfeng
    2018 24TH INTERNATIONAL CONFERENCE ON PATTERN RECOGNITION (ICPR), 2018, : 676 - 681
  • [48] EXPLOITING DOUBLY ADVERSARIAL EXAMPLES FOR IMPROVING ADVERSARIAL ROBUSTNESS
    Byun, Junyoung
    Go, Hyojun
    Cho, Seungju
    Kim, Changick
    2022 IEEE INTERNATIONAL CONFERENCE ON IMAGE PROCESSING, ICIP, 2022, : 1331 - 1335
  • [49] On Relating Explanations and Adversarial Examples
    Ignatiev, Alexey
    Narodytska, Nina
    Marques-Silva, Joao
    ADVANCES IN NEURAL INFORMATION PROCESSING SYSTEMS 32 (NIPS 2019), 2019, 32
  • [50] AdvOps: Decoupling adversarial examples
    Wang, Donghua
    Yao, Wen
    Jiang, Tingsong
    Chen, Xiaoqian
    PATTERN RECOGNITION, 2024, 149