CodeAttack: Code-Based Adversarial Attacks for Pre-trained Programming Language Models

Akshita Jha, Chandan K. Reddy
5/31/2022
131 citations
cs.CLcs.CR

Official code: reddy-lab-code-research/CodeAttack (34 stars, Python, last commit 2023-04-18).

Abstract

Pre-trained programming language (PL) models (such as CodeT5, CodeBERT, GraphCodeBERT, etc.,) have the potential to automate software engineering tasks involving code understanding and code generation. However, these models operate in the natural channel of code, i.e., they are primarily concerned with the human understanding of the code.

Show full abstract

They are not robust to changes in the input and thus, are potentially susceptible to adversarial attacks in the natural channel. We propose, CodeAttack, a simple yet effective black-box attack model that uses code structure to generate effective, efficient, and imperceptible adversarial code samples and demonstrates the vulnerabilities of the state-of-the-art PL models to code-specific adversarial attacks. We evaluate the transferability of CodeAttack on several code-code (translation and repair) and code-NL (summarization) tasks across different programming languages. CodeAttack outperforms state-of-the-art adversarial NLP attack models to achieve the best overall drop in performance while being more efficient, imperceptible, consistent, and fluent. The code can be found at https://github.com/reddy-lab-code-research/CodeAttack.

View on arXivView PDF

Code Implementations(1)

Code for the AAAI 2023 paper "CodeAttack: Code-based Adversarial Attacks for Pre-Trained Programming Language Models

348Python, ShellNov 23, 20223 years ago

Similar Papers

Cite this paper

@article{jha2022codeattack,
  title  = {CodeAttack: Code-Based Adversarial Attacks for Pre-trained Programming Language Models},
  author = {Akshita Jha and Chandan K. Reddy},
  year   = {2022},
  eprint = {2206.00052},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2206.00052}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2206.00052.svg)](https://codeofpaper.com/paper/2206.00052)

Discussion