Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

Securing Code Understanding: Detecting Natural Backdoor Vulnerability in Code Language Models

About

Code Language Models (CodeLMs) have become integral to software engineering, significantly advancing code intelligence tasks. However, their widespread adoption has raised critical security concerns, particularly regarding susceptibility to backdoor attacks. Recent studies have uncovered naturally occurring backdoors, referred to as natural backdoors, in normally trained deep learning models. Despite posing threats as serious as those introduced through data poisoning, security implications of natural backdoor vulnerabilities in CodeLMs remain poorly understood. In this paper, we conduct a thorough empirical study of natural backdoor vulnerabilities in CodeLMs across various model architectures and code intelligence tasks. Specifically, we examine potential natural backdoor vulnerabilities across 44 scenarios, demonstrating that natural backdoors are prevalent and intrinsic to CodeLMs. We reveal differences between injected and natural backdoor vulnerabilities at both the model and parameter levels. We then analyze the transferability of natural backdoor vulnerabilities from three perspectives: datasets, model architectures, and shared knowledge. We further investigate the causes of natural backdoors from two aspects: training datasets and the model training procedure. We evaluate existing backdoor defense techniques, including pre-training, in-training, and post-training defenses, in mitigating natural backdoors. Finally, we propose ScanNBT, a novel detection method designed to improve comprehensive detection of natural backdoor vulnerabilities in CodeLMs. We aim for our findings to enhance understanding of these vulnerabilities and provide insights for strengthening CodeLM security against backdoor threats.

Yuchen Chen, Weisong Sun, Haocheng Huang, Yuan Xiao, Chunrong Fang, Yiran Zhang, Tingting Xu, Zhenpeng Chen, An Guo, Peizhuo Lv, Xiaofang Zhang, Zhenyu Chen, Yang Liu, Baowen Xu• 2026

Related benchmarks

TaskDatasetResultRank
Code RepairR2
ASR6.77
3
Code SummarizationM3
ASR10.01
3
Code SummarizationM4
ASR2.49
3
Defect DetectionD2
ASR35.88
3
Code RepairR1
ASR11.61
3
Code RepairR3
ASR1.91
3
Code RepairR4
ASR4.95
3
Code SearchS1
ANR35.17
3
Code SearchS2
ANR33.78
3
Code SummarizationM1
ASR6.71
3
Showing 10 of 12 rows

Other info

Follow for update