NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

FDI: Attack Neural Code Generation Systems through User Feedback Channel

Zhensu Sun, Xiaoning Du, Xiapu Luo, Fu Song, David Lo, Li Li · DOI

Introduction

Modern AI coding assistants like GitHub Copilot and Amazon CodeWhisperer are not static models; they evolve by learning from user interactions. This feedback loop, while essential for improving accuracy and staying current with new libraries, introduces a significant security vulnerability. A recent study explores Feedback Data Injection (FDI), a novel attack vector that targets the very mechanisms meant to refine these models.

The Vulnerability of Feedback Channels

Neural code generation systems typically incorporate user feedback through two primary methods:

  1. Retrieval-Augmented Generation (RAG): Systems maintain a database of previous queries and successful code snippets to provide contextually relevant examples in future prompts.
  2. Continual Learning: Models are periodically fine-tuned on new, user-provided data to adapt to changing coding patterns.

Because these channels are often open to any user, they represent an unvetted attack surface. Unlike traditional poisoning attacks that rely on scraping open-source repositories, FDI attacks the system directly through its official feedback API.

Overview of the Feedback Data Injection (FDI) attack process.

The FDI Attack Framework

The researchers propose a four-stage framework for executing FDI attacks:

  • Target Analysis: Identifying whether the system utilizes RAG or continual learning.
  • Pre-attack Profiling: A novel technique where attackers send "neutral" probes to reverse-engineer hidden system constraints, such as syntax checkers or quality filters.
  • Malicious Sample Design: Crafting "corrections" that appear legitimate but contain hidden triggers or instructions.
  • Injection & Validation: Submitting the feedback and verifying the model's compromised output.

Case Study: Prompt Injection in RAG Systems

In a RAG-based system, the attacker targets the example retriever. By injecting instructions disguised as comments (e.g., # Print 'attacked') into the feedback corpus, the attacker ensures that when a victim submits a similar query, the malicious example is retrieved. The Large Code Model (LCM) then imitates the style or follows the explicit instructions within that example.

Illustration of a prompt injection attack targeting a RAG-based code generation system.

Case Study: Backdoor Attacks in Continual Learning

For systems using continual learning, attackers pair a specific "trigger" (such as a rare code comment) with a "target" malicious payload (e.g., an insecure SSL configuration). Once the model is fine-tuned on this poisoned data, encountering the trigger in a user's query causes the model to suggest the insecure code. The study found that an injection rate as low as 0.01% was sufficient to plant a successful backdoor.

Key Insights and Results

The study's evaluation across datasets like PandasDoc and CodeSearchNet revealed several critical findings:

  • High Success Rates: In RAG scenarios, 93.6% of malicious samples were successfully collected. Backdoor attacks achieved success rates between 68.6% and 100%.
  • Stealth through Profiling: Pre-attack profiling allows attackers to bypass filters by ensuring malicious samples are "just right"—sufficiently novel to be learned but similar enough to pass quality checks.
  • Ineffective Defenses: Current anomaly detection methods, such as Activation Clustering, proved largely ineffective against these carefully crafted, context-aware attacks.

Conclusion

The FDI attack demonstrates that securing the user feedback channel is an urgent priority for AI developers. Future defenses must move beyond simple syntax checking toward trust-based filtering and more robust, context-sensitive anomaly detection to protect the integrity of neural code generation systems.

Summary updated

BibTeX
@inproceedings{sun2024fdi,
  author = {Zhensu Sun and Xiaoning Du and Xiapu Luo and Fu Song and David Lo and Li Li},
  title = {{FDI: Attack Neural Code Generation Systems through User Feedback Channel}},
  booktitle = {ISSTA},
  year = {2024},
  doi = {10.1145/3650212.3680300},
}
Figure