Lune

ICML2025顶会

Black-Box Adversarial Attacks on LLM-Based Code Completion

Slobodan Jenko, Niels Mündler, Jingxuan He, Mark Vero, Martin T. Vechev

摘要

Modern code completion engines, powered by large language models (LLMs), assist millions of developers with their strong capabilities to generate functionally correct code. Due to this popularity, it is crucial to investigate the security implications of relying on LLM-based code completion. In this work, we demonstrate that state-of-the-art black-box LLM-based code completion engines can be stealthily biased by adversaries to significantly increase their rate of insecure code generation. We present the first attack, named INSEC, that achieves this goal. INSEC works by injecting an attack string as a short comment in the completion input. The attack string is crafted through a query-based optimization procedure starting from a set of carefully designed initialization schemes. We demonstrate INSEC's broad applicability and effectiveness by evaluating it on various state-ofthe-art open-source models and black-box commercial services (e.g., OpenAI API and GitHub Copilot). On a diverse set of security-critical test cases, covering 16 CWEs across 5 programming languages, INSEC increases the rate of generated insecure code by more than 50%, while maintaining the functional correctness of generated code. We consider INSEC practical -it requires low resources and costs less than 10 US dollars to develop on commodity hardware. Moreover, we showcase the attack's real-world deployability, by developing an IDE plug-in that stealthily injects INSEC into the GitHub Copilot extension.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 5 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • BlueCodeAgent: A Blue Teaming Agent Powered by Automated Red Teaming for CodeGen AI 引用了 Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributions
  • Grounded Copilot: How Programmers Interact with Code-Generating Models 引用了 Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributions
  • When "Correct" Is Not Safe: Can We Trust Functionally Correct Patches Generated by Code Agents? 引用了 SWE-bench: Can Language Models Resolve Real-world Github Issues?
  • When "Correct" Is Not Safe: Can We Trust Functionally Correct Patches Generated by Code Agents? 引用了 RedCoder: Automated Multi-Turn Red Teaming for Code LLMs
  • RedCoder: Automated Multi-Turn Red Teaming for Code LLMs 引用了 CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis
  • RedCoder: Automated Multi-Turn Red Teaming for Code LLMs 引用了 Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributions
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper5

  1. RedCoder: Automated Multi-Turn Red Teaming for Code LLMsWenjie Jacky Mo, Qin Liu, Xiaofei Wen, Dongwon Jung 等ACL 2026 · 6 次引用
  2. XOXO: Stealthy Cross-Origin Context Poisoning Attacks against AI Coding AssistantsAdam Storek, Mukur Gupta, Noopur Bhatt, Aditya Gupta 等ACL 2026 · 5 次引用
  3. When "Correct" Is Not Safe: Can We Trust Functionally Correct Patches Generated by Code Agents?Yibo Peng, James Song, Lei Li, Xinyu Yang 等ACL 2026 · 2 次引用
  4. BlueCodeAgent: A Blue Teaming Agent Powered by Automated Red Teaming for CodeGen AIChengquan Guo, Yuzhou Nie, Chulin Xie, Zinan Lin 等ICML 2026
  5. PARASITE: Conditional System Prompt Poisoning to Hijack LLMsViet Pham, Thai LeACL 2026

它引用的 Paper19

  1. SWE-bench: Can Language Models Resolve Real-world Github Issues?Carlos E. Jimenez, John Yang, Alexander Wettig, Shunyu Yao 等ICLR 2024 · 2,082 次引用
  2. Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code ContributionsHammond Pearce, Baleegh Ahmad, Benjamin Tan, Brendan Dolan-Gavitt 等S&P 2022 · 725 次引用
  3. Grounded Copilot: How Programmers Interact with Code-Generating ModelsShraddha Barke, Michael B. James, Nadia PolikarpovaOOPSLA 2023 · 408 次引用
  4. Poisoning Web-Scale Training Datasets is PracticalNicholas Carlini, Matthew Jagielski, Christopher A. Choquette-Choo, Daniel Paleka 等S&P 2024 · 309 次引用
  5. CodeGen: An Open Large Language Model for Code with Multi-Turn Program SynthesisErik Nijkamp, Bo Pang, Hiroaki Hayashi, Lifu Tu 等ICLR 2023 · 234 次引用

相关 Paper

  1. Security Attacks on LLM-based Code Completion ToolsWen Cheng, Ke Sun, Xinyu Zhang, Wei WangAAAI 2025 · 21 次引用
  2. TrojanPuzzle: Covertly Poisoning Code-Suggestion ModelsHojjat Aghakhani, Wei Dai, Andre Manoel, Xavier Fernandes 等S&P 2024 · 70 次引用
  3. Attribution-guided Adversarial Code Prompt Generation for Code Completion ModelsXueyang Li, Guozhu Meng, Shangqing Liu, Lu Xiang 等ASE 2024 · 5 次引用
  4. You Autocomplete Me: Poisoning Vulnerabilities in Neural Code CompletionRoei Schuster, Congzheng Song, Eran Tromer, Vitaly ShmatikovUSENIX Security 2021 · 199 次引用
  5. CoSec: On-the-Fly Security Hardening of Code LLMs via Supervised Co-decodingDong Li, Meng Yan, Yaosheng Zhang, Zhongxin Liu 等ISSTA 2024 · 10 次引用
黄昏的海面,两侧是细线勾勒的悬崖