paper-with-me

홈 › Papers

Show Me Your Code! Kill Code Poisoning: A Lightweight Method Based on Code Naturalness

2025-02-20 · Weisong Sun, Yuchen Chen, Mengzhe Yuan, Chunrong Fang, Zhenpeng Chen, Chong Wang, Yang Liu, Baowen Xu, Zhenyu Chen

Neural code models (NCMs) have demonstrated extraordinary capabilities in code intelligence tasks. Meanwhile, the security of NCMs and NCMs-based systems has garnered increasing attention. In particular, NCMs are often trained on large-scale data from potentially untrustworthy sources, providing attackers with the opportunity to manipulate them by inserting crafted samples into the data. This type of attack is called a code poisoning attack (also known as a backdoor attack). It allows attackers to implant backdoors in NCMs and thus control model behavior, which poses a significant security threat. However, there is still a lack of effective techniques for detecting various complex code poisoning attacks. In this paper, we propose an innovative and lightweight technique for code poisoning detection named KillBadCode. KillBadCode is designed based on our insight that code poisoning disrupts the naturalness of code. Specifically, KillBadCode first builds a code language model (CodeLM) on a lightweight $n$-gram language model. Then, given poisoned data, KillBadCode utilizes CodeLM to identify those tokens in (poisoned) code snippets that will make the code snippets more natural after being deleted as trigger tokens. Considering that the removal of some normal tokens in a single sample might also enhance code naturalness, leading to a high false positive rate (FPR), we aggregate the cumulative improvement of each token across all samples. Finally, KillBadCode purifies the poisoned data by removing all poisoned samples containing the identified trigger tokens. The experimental results on two code poisoning attacks and four code intelligence tasks demonstrate that KillBadCode significantly outperforms four baselines. More importantly, KillBadCode is very efficient, with a minimum time consumption of only 5 minutes, and is 25 times faster than the best baseline on average.

📄 PDF Abstract BibTeX arXiv:2502.15830

Code (0)

등록된 구현이 없습니다.

Tasks

Backdoor AttackLanguage ModelingLanguage Modelling

Similar Papers 제목 키워드 기반

EVOMAL: Self-Poisoning in Self-Evolving Coding Agents

2026-08-26 · Xiaodong Wu, Yu Shi, Qi Li, Zhimin Zhao 외 arxiv

Self-evolving LLM coding agents write their own tools by imitating retrieved skills from shared skill libraries. We identify a vulnerability in this loop: during authoring, a retrieved malicious skill can become the temp…

SkillVetBench: LLM-as-Judge for Multi-Dimensional Security Risk Evaluation in Open-Source LLM Agent Skills

2026-06-14 · Ismail Hossain, Sai Puppala, Md Jahangir Alam, Tanzim Ahad 외 arxiv

Open-source LLM agent ecosystems are growing rapidly, yet the security of community-contributed skills - modular tool definitions that extend agent capabilities - remains largely unvetted. The gap we fill: existing scann…

RouteGuard: Internal-Signal Detection of Skill Poisoning in LLM Agents

2026-04-24 · Wenjie Xiao, Xuehai Tang, Biyu Zhou, Songlin Hu 외 arxiv

Agent skills introduce a new and more severe form of indirect injection for LLM agents: unlike traditional indirect prompt injection, attackers can hide malicious instructions inside a dense, action-oriented skill that a…

POISE: Position-Aware Undetectable Skill Injection on LLM Agents

2026-06-06 · Haochang Hao, Dehai Min, Zhifang Zhang, Yunbei Zhang 외 arxiv

Agent skills provide a lightweight mechanism for extending general-purpose agents, but their open format exposes them to skill-poisoning attacks. A practically dangerous injection must stay invisible: if executing the pa…

When Experience Becomes Instruction: Trajectory Poisoning in Self-Evolving Agent Skill Systems

2026-08-06 · Jialuo Chen, Lingqi Jiang, Xinhao Deng, Xiaohu Du 외 arxiv

Self-evolving skill (SES) systems distill agent trajectories into persistent skills, allowing untrusted experience to become trusted instruction. We introduce PoisonedEvolution, a trajectory-poisoning attack on this prom…