Skip to main content
QUICK REVIEW

[Paper Review] Double Backdoored: Converting Code Large Language Model Backdoors to Traditional Malware via Adversarial Instruction Tuning Attacks

Md Imran Hossen, Chilukoti, Sai Venkatesh|arXiv (Cornell University)|Apr 29, 2024
Network Security and Intrusion DetectionComputer Science3 citations
TL;DR

This paper introduces EvilInstructCoder, a framework that exploits instruction-tuned Code LLMs by poisoning training data with adversarially injected malicious code snippets. It achieves backdoor attack success rates of 76–86% on CodeLlama, DeepSeek-Coder, and StarCoder2 using only 0.5% poisoned data (81 samples), demonstrating severe security vulnerabilities in AI coding assistants.

ABSTRACT

Instruction-tuned Large Language Models designed for coding tasks are increasingly employed as AI coding assistants. However, the cybersecurity vulnerabilities and implications arising from the widespread integration of these models are not yet fully understood due to limited research in this domain. This work investigates novel techniques for transitioning backdoors from the AI/ML domain to traditional computer malware, shedding light on the critical intersection of AI and cyber/software security. To explore this intersection, we present MalInstructCoder, a framework designed to comprehensively assess the cybersecurity vulnerabilities of instruction-tuned Code LLMs. MalInstructCoder introduces an automated data poisoning pipeline to inject malicious code snippets into benign code, poisoning instruction fine-tuning data while maintaining functional validity. It presents two practical adversarial instruction tuning attacks with real-world security implications: the clean prompt poisoning attack and the backdoor attack. These attacks aim to manipulate Code LLMs to generate code incorporating malicious or harmful functionality under specific attack scenarios while preserving intended functionality. We conduct a comprehensive investigation into the exploitability of the code-specific instruction tuning process involving three state-of-the-art Code LLMs: CodeLlama, DeepSeek-Coder, and StarCoder2. Our findings reveal that these models are highly vulnerable to our attacks. Specifically, the clean prompt poisoning attack achieves the ASR@1 ranging from over 75% to 86% by poisoning only 1% (162 samples) of the instruction fine-tuning dataset. Similarly, the backdoor attack achieves the ASR@1 ranging from 76% to 86% with a 0.5% poisoning rate. Our study sheds light on the critical cybersecurity risks posed by instruction-tuned Code LLMs and highlights the urgent need for robust defense mechanisms.

Motivation & Objective

  • To investigate the cybersecurity vulnerabilities of instruction-tuned Code LLMs under adversarial instruction tuning attacks.
  • To develop a framework capable of automatically generating and injecting malicious code into instruction tuning datasets.
  • To evaluate the exploitability of instruction-tuned Code LLMs under diverse threat models reflecting real-world adversary capabilities.
  • To measure the impact of poisoning rates on backdoor success and model utility.
  • To demonstrate that backdoored models can outperform models explicitly instructed to generate malicious code.

Proposed method

  • The Adversarial Code Injection Engine automatically generates malicious code snippets and injects them into benign code during instruction tuning dataset curation.
  • The framework employs a trigger phrase to condition the model to generate malicious payloads when prompted with specific natural language instructions.
  • Poisoning is applied to a small fraction (0.5–3%) of the instruction tuning dataset to train backdoored models.
  • The attack evaluates success using Attack Success Rate at 1 (ASR@1) and ASR@10, measuring the proportion of responses containing the malicious payload.
  • Comparative evaluations include both backdoored models and models explicitly prompted to generate malicious code, using tags like <m> and </m> to isolate payloads.
  • The framework evaluates three state-of-the-art Code LLMs: CodeLlama, DeepSeek-Coder, and StarCoder2, across multiple model sizes and instruction tuning settings.
Figure 1. Overview of EvilInstructCoder Attack Framework. In this figure, $r$ represents a sample benign response from instruction tuning dataset, with the malicious version of $r$ highlighted in red . $i$ denotes an instruction, with the instruction containing a trigger phrase set by the attacker m
Figure 1. Overview of EvilInstructCoder Attack Framework. In this figure, $r$ represents a sample benign response from instruction tuning dataset, with the malicious version of $r$ highlighted in red . $i$ denotes an instruction, with the instruction containing a trigger phrase set by the attacker m

Experimental results

Research questions

  • RQ1Can instruction-tuned Code LLMs be manipulated to generate malicious code in response to benign natural language instructions?
  • RQ2How effective is backdoor injection via data poisoning in instruction tuning datasets for Code LLMs?
  • RQ3What is the minimum poisoning rate required to achieve high attack success rates across different Code LLM architectures?
  • RQ4How does the performance of backdoored models compare to models explicitly instructed to generate malicious code?
  • RQ5To what extent does the backdoor attack degrade the model’s performance on standard code generation benchmarks?

Key findings

  • By poisoning just 81 samples (0.5% of the dataset), the attack achieves an ASR@1 score of 86% on the CodeLlama 7B model, 81.2% on DeepSeek-Coder 6.7B, and over 76% on StarCoder2 7B.
  • All models achieve 100% ASR@10 at the 0.5% poisoning rate, indicating consistent and high exploitability across multiple test cases.
  • The backdoored models outperform models explicitly instructed to generate malicious code, with the latter achieving a maximum ASR@1 of 81.2% on DeepSeek-Coder 6.7B.
  • Even GPT-3.5, when explicitly prompted, achieves an ASR@1 of 98%, showing that the backdoored models are highly competitive with explicit instruction attacks.
  • The pass@1 score on the HumanEval benchmark drops by at most 3.8% for the StarCoder2 7B model, indicating minimal degradation in standard performance.
  • ASR@1 saturates above 96% at a 3% poisoning rate, and ASR@10 reaches 100% even at 0.5% poisoning, confirming the attack’s high efficiency and scalability.
Figure 2. Attack performance against instruction-tuned (FT) Code LLMs under various poisoning rates in Adversarial Scenario A, employing the clean prompt poisoning attack method.
Figure 2. Attack performance against instruction-tuned (FT) Code LLMs under various poisoning rates in Adversarial Scenario A, employing the clean prompt poisoning attack method.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.