FDI: Attack Neural Code Generation Systems through User Feedback Channel

Zhensu Sun,Xiaoning Du,Xiapu Luo,Fu Song,David Lo,Li Li
2024-08-08
Abstract:Neural code generation systems have recently attracted increasing attention to improve developer productivity and speed up software development. Typically, these systems maintain a pre-trained neural model and make it available to general users as a service (e.g., through remote APIs) and incorporate a feedback mechanism to extensively collect and utilize the users' reaction to the generated code, i.e., user feedback. However, the security implications of such feedback have not yet been explored. With a systematic study of current feedback mechanisms, we find that feedback makes these systems vulnerable to feedback data injection (FDI) attacks. We discuss the methodology of FDI attacks and present a pre-attack profiling strategy to infer the attack constraints of a targeted system in the black-box setting. We demonstrate two proof-of-concept examples utilizing the FDI attack surface to implement prompt injection attacks and backdoor attacks on practical neural code generation systems. The attacker may stealthily manipulate a neural code generation system to generate code with vulnerabilities, attack payload, and malicious and spam messages. Our findings reveal the security implications of feedback mechanisms in neural code generation systems, paving the way for increasing their security.
Software Engineering,Cryptography and Security
What problem does this paper attempt to address?
The problem this paper attempts to address is the potential security risks posed by user feedback mechanisms in neural code generation systems. Specifically, the authors found that these systems optimize and enhance code generation services through user feedback, but this feedback mechanism can be maliciously exploited, leading to Feedback Data Injection (FDI) attacks. Such attacks can inject malicious data samples, causing the neural code generation system to produce code snippets containing vulnerabilities, malicious code, or junk information, thereby threatening the system's security and reliability. The paper discusses in detail the methodology of FDI attacks, including how to analyze the target system, design malicious samples, inject malicious samples, and verify the attack's effectiveness. Additionally, the authors propose a pre-attack configuration strategy to identify constraints in the target system, improving the success rate of the attack. Through two specific attack cases—prompt injection attacks and backdoor attacks—the authors demonstrate the feasibility and potential hazards of FDI attacks in actual neural code generation systems. In summary, this paper reveals the security risks of user feedback mechanisms in neural code generation systems and provides important references for future security research and defense measures.