[논문 리뷰] Detecting Data Poisoning in Code Generation LLMs via Black-Box, Vulnerability-Oriented Scanning
논문은 CodeScan을 제시합니다. 이는 코드 생성 LLM에 대한 블랙박스 중독 스캐닝 프레임워크로, 구조적 차이점과 LLM 기반 취약점 분석을 활용하여 공격 대상(targets)을 탐지하고 회복하며, 코드 설정에서 BAIT보다 우수합니다.
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, which, to the best of our knowledge, is the first poisoning-scanning framework tailored to code generation models. 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 108 models spanning three architectures and multiple model sizes demonstrate 97%+ detection accuracy with substantially lower false positives than prior methods.
연구 동기 및 목표
- 데이터 중독과 백도어로 인해 발생하는 코드 생성 LLM의 취약점을 식별합니다.
- 학습 데이터나 모델 내부에 접근 없이 블랙박스 설정에서 작동하는 방어를 개발합니다.
- 토큰 수준 차이 한계를 넘어 구조적 코드 패턴과 의미적 취약점에 집중합니다.
- 여러 아키텍처, 모델 크기, 취약점 클래스에 걸쳐 효과를 평가합니다.
제안 방법
- 깨끗한 프롬프트로 모델 어휘를 탐색하여 각 후보 토큰에 대한 생성을 수집합니다.
- 생성된 코드를 AST 기반 표현으로 변환하고 구조적 유사성으로 클러스터링하여 낮은 차이 패턴을 식별합니다.
- 구조적으로 일관된 패턴에 타깃 취약점이 포함되었는지 평가하기 위해 취약점 탐지기(LLM 기반)를 적용합니다.
- 함수 호출 및 인수에 대한 AST 기반 다수결 투표를 통해 지배적인 구조적 클러스터에서 회수된 공격 대상(targets)을 추출합니다.
- 바이어스된 흔적에 지정된 취약점이 포함되었는지 판단하기 위해 취약점 탐지기(GPT-5-mini)를 사용합니다.
- CodeScan과 BAIT를 F1-score, precision, recall, BLEU, AST 거리, 스캐닝 오버헤드로 비교합니다.
실험 결과
연구 질문
- RQ1블랙박스식 취약점 지향 스캐닝 접근법이 코드 생성 LLM의 데이터 중독을 신뢰성 있게 탐지할 수 있습니까?
- RQ2생성 간 구조적으로 일관된 코드 패턴이 토큰 수준 방법보다 공격 대상(targets)을 더 잘 드러냅니까?
- RQ3LLM 기반 취약점 분석이 변형되거나 난독화된 공격 대상들을 견고하게 식별할 수 있습니까?
- RQ4CodeScan이 BAIT와 비교하여 다양한 아키텍처, 크기, 취약점 클래스에서 어떻게 성능을 보이나요?
주요 결과
- CodeScan은 97% 이상 탐지 정확도와 이전 방법에 비해 거짓 양성률이 상당히 낮습니다.
- CodeScan은 BAIT를 능가합니다. BAIT는 평가에서 평균 F1-score가 0.17을 달성했습니다.
- 평가는 CodeLlama-34B와 같은 대형 모델을 포함하여 세 가지 아키텍처와 여러 크기의 108개 모델에 걸쳐 진행되었습니다.
- CodeScan은 구조적 차이점과 취약점 분석을 사용하여 공격 대상을 회수합니다.
- GPT-5-mini를 통한 취약점 분석은 변형되거나 난독화된 대상들을 효과적으로 탐지합니다.
- CodeScan은 변형된 코드에 대한 강건성을 보여주며 실용적이고 확장 가능한 스캐닝을 제공합니다.
이 논문 읽기
누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.
누빈트에서 이 논문 읽기이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.