arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2603.17174cs.CRcs.AIcs.SE
收藏

通过黑盒、面向漏洞的扫描检测代码生成LLM中的数据中毒

Detecting Data Poisoning in Code Generation LLMs via Black-Box, Vulnerability-Oriented Scanning

University of Connecticut(康涅狄格大学);Visa Research(Visa研究)

Shenao Yan, Shan Jin, Shimaa Ahmed, Sunpreet Singh Arora, Yiwei Cai, Yizhen Wang, Yuan Hong

AI总结:

本文提出CodeScan框架,通过分析多生成代码的结构相似性,结合抽象语法树规范化,检测代码生成模型中的安全漏洞,实现高准确率的数据中毒检测。

摘要:

代码生成大型语言模型(LLM)正越来越多地集成到现代软件开发工作流中。最近的研究表明,这些模型易受后门和中毒攻击的影响,导致生成不安全的代码,但有效的防御措施仍然有限。现有的扫描方法依赖于令牌级生成一致性来反转攻击目标,这在源代码中效果不佳,因为相同语义可以以多样的语法形式出现。我们提出了CodeScan,据我们所知,这是首个针对代码生成模型的中毒扫描框架。CodeScan通过分析多个生成代码在不同干净提示下的结构相似性来识别攻击目标。它结合了迭代分歧分析与基于抽象语法树(AST)的规范化,以抽象掉表面变化,统一语义等价的代码,隔离在多个生成中反复出现的结构。CodeScan随后应用基于LLM的漏洞分析,确定提取的结构是否包含安全漏洞,并在发现此类结构时标记模型为受攻击。我们评估了CodeScan在四种代表性攻击下的表现,包括后门和中毒设置,覆盖三个现实世界的漏洞类别。在108个模型上进行的实验,涵盖三种架构和多种模型大小,展示了97%以上的检测准确率,且假阳性显著低于先前方法。

英文摘要:

Code generation large language models (LLMs) are increasingly integrated into modern software development workflows. Recent work has shown that these models are vulnerable to backdoor and poisoning attacks that induce the generation of insecure code, yet effective defenses remain limited. Existing scanning approaches rely on token-level generation consistency to invert attack targets, which is ineffective for source code where identical semantics can appear in diverse syntactic forms. We present CodeScan, the first black-box, vulnerability-specific scanning framework for auditing code generation LLMs, assuming that the defender specifies the target vulnerability classes and provides corresponding task-relevant prompts. CodeScan identifies attack targets by analyzing structural similarities across multiple generations conditioned on different clean prompts. It combines iterative divergence analysis with abstract syntax tree (AST)-based normalization to abstract away surface-level variation and unify semantically equivalent code, isolating structures that recur consistently across generations. CodeScan then applies LLM-based vulnerability analysis to determine whether the extracted structures contain security vulnerabilities and flags the model as compromised when such a structure is found. We evaluate CodeScan against four representative attacks under both backdoor and poisoning settings across three real-world vulnerability classes. Experiments on 117 models spanning three architectures and multiple model sizes demonstrate 97%+ detection accuracy with substantially lower false positives than prior methods.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑