SkillHarm: Lifecycle-Aware Skill-Based Attacks via Automated Construction
TL;DR Highlight
AI 에이전트가 사용하는 'Skill 패키지'에 악성 페이로드를 심으면 최신 모델도 86%까지 뚫린다는 보안 벤치마크.
Who Should Read
Claude Code, Codex 같은 코딩 에이전트를 프로덕션에 도입하거나 MCP/Skill 기반 워크플로우를 설계하는 백엔드·MLOps 개발자. AI 에이전트 보안 취약점을 평가하거나 방어 전략을 고민하는 팀에게 필수.
Core Mechanics
- AI 에이전트가 쓰는 'Skill 패키지'(자연어 지침 + 참조 문서 + 실행 스크립트를 묶은 재사용 가능 패키지)는 에이전트가 암묵적으로 신뢰하고 실행하기 때문에, 공격자가 악성 내용을 심기 딱 좋은 공격 표면이다.
- 공격 유형은 두 가지: FPP(Fixed-Payload Poisoning, 설치 즉시 발동)와 SMP(Self-Mutating Poisoning, 첫 실행은 정상처럼 보이다가 Skill 파일을 조용히 변조해 다음 세션에서 피해 발생). SMP는 기존 단일 세션 평가에서 절대 잡히지 않는 공격이다.
- GPT-5.4(Codex)가 가장 취약해서 FPP 공격 성공률 86.3%, SMP 69.3%를 기록. Claude Opus 4.7이 상대적으로 강하지만 그래도 FPP 27.4%, SMP 9.4%로 안전하지 않다.
- '공격 실패'의 상당수가 에이전트가 악성 파일을 아예 안 열었기 때문이지, 공격을 인지해서 거부한 게 아니다. 실제로 파일을 열었을 때(Conditional ASR)는 성공률이 최대 32.1%p 더 높아진다.
- 스크립트 기반 페이로드가 문서 기반보다 훨씬 위험하다. 에이전트들이 helper script는 내용 검사 없이 그냥 실행하기 때문에, 자연어 prompt injection 방어 훈련을 받아도 스크립트 공격은 막지 못한다.
- 기존 방어 수단은 모두 불충분: Skill Scanner는 최대 55.6% 감지, 방어용 System Prompt를 추가해도 거의 모든 설정에서 ASR 70% 이상 유지.
Evidence
- FPP 공격 성공률: Codex GPT-5.4 86.3%, GPT-5.5 81.4%, Gemini 3 Flash 63.8%, Claude Sonnet 4.6 52.4%, Qwen3.6-27B 53.9%, Claude Opus 4.7 27.4%.
- SMP 공격 성공률: Codex GPT-5.4 69.3%, GPT-5.5 65.6%, Gemini 3 Flash 45.8%, Claude Sonnet 4.6 51.6%, Qwen3.6-27B 51.6%, Claude Opus 4.7 9.4%. SMP는 '변조 성공 + 다음 세션 피해 발동' 두 단계를 모두 통과해야 성공으로 인정한다.
- 가장 강력한 Skill Scanner(Skill Scanner + Opus 4.7 백본)도 FPP 55.6%, SMP 68.8% 감지에 그쳤고, Agent Scan(Snyk)은 FPP 7.4%, SMP 9.9%로 사실상 무용지물.
- 방어용 System Prompt(DSP) 적용 후에도 모든 에이전트에서 FPP·SMP 모두 ASR 70% 이상 유지. 실제로 일부 설정(Codex FPP)은 DSP 없을 때 86.3% → DSP 적용 후 83.0%로 불과 3.3%p 감소.
How to Apply
- 에이전트 워크플로우에 third-party Skill 패키지를 도입할 때, SKILL.md·스크립트를 에이전트가 암묵적으로 신뢰하는 구조를 그대로 쓰지 말고, 별도 샌드박스(Docker 격리)에서 실행하고 파일 시스템 접근을 최소 권한으로 제한해라.
- 단일 세션 보안 테스트만으로는 SMP 공격을 잡을 수 없다. Skill 파일이 세션 간에 변경됐는지 체크하는 해시 검증 레이어를 추가하거나, Skill 디렉토리를 읽기 전용으로 마운트해 변조 자체를 차단하는 방식을 고려해라.
- Skill Scanner나 DSP에만 의존하지 말고, 에이전트가 스크립트를 실행하기 전에 내용을 사람이 리뷰하거나 정적 분석 도구로 검사하는 파이프라인을 추가해라. 특히 Import-based injection(외부 모듈을 import하는 패턴)은 scanner가 잘 못 잡는다.
Code Example
# SMP 방어를 위한 Skill 파일 무결성 검증 예시
import hashlib
import json
from pathlib import Path
def compute_skill_hashes(skill_dir: str) -> dict:
"""Skill 패키지 내 모든 파일의 SHA256 해시를 기록"""
hashes = {}
for path in Path(skill_dir).rglob('*'):
if path.is_file():
content = path.read_bytes()
hashes[str(path.relative_to(skill_dir))] = hashlib.sha256(content).hexdigest()
return hashes
def verify_skill_integrity(skill_dir: str, baseline_hashes: dict) -> list:
"""이전 세션과 비교해 변경된 파일 탐지 (SMP 공격 감지)"""
current_hashes = compute_skill_hashes(skill_dir)
tampered = []
for filepath, expected_hash in baseline_hashes.items():
current_hash = current_hashes.get(filepath)
if current_hash != expected_hash:
tampered.append({
'file': filepath,
'expected': expected_hash,
'actual': current_hash or 'MISSING'
})
# 새로 추가된 파일도 의심
for filepath in current_hashes:
if filepath not in baseline_hashes:
tampered.append({'file': filepath, 'status': 'NEWLY_ADDED'})
return tampered
# 사용 예시
# Task A 실행 전: 기준 해시 저장
baseline = compute_skill_hashes('/workspace/.codex/skills/pdf')
with open('skill_baseline.json', 'w') as f:
json.dump(baseline, f)
# Task B 실행 전: 무결성 검증
with open('skill_baseline.json') as f:
baseline = json.load(f)
tampered_files = verify_skill_integrity('/workspace/.codex/skills/pdf', baseline)
if tampered_files:
print(f'⚠️ SKILL TAMPERING DETECTED: {tampered_files}')
raise SecurityError('Skill package has been modified between sessions!')Terminology
Related Papers
MemTrace: Tracing and Attributing Errors in Large Language Model Memory Systems
RAG, Mem0 같은 LLM 메모리 시스템이 왜 틀린 답을 내는지 자동으로 찾아주는 디버깅 프레임워크
DeepSWE: A contamination-free benchmark for long-horizon coding agents
기존 SWE-bench의 데이터 오염 및 검증 오류 문제를 해결하기 위해 처음부터 새로 만든 코딩 에이전트 벤치마크로, GPT-5.5가 70%로 1위를 차지하고 모델 간 성능 격차가 훨씬 뚜렷하게 드러난다.
Constraint Decay: The Fragility of LLM Agents in Back End Code Generation
LLM 코딩 에이전트는 구조적 제약(아키텍처 패턴, ORM, DB 설계)이 쌓일수록 성능이 급격히 떨어지는 'constraint decay' 현상을 보인다는 연구 결과로, AI 코딩 도구를 프로덕션에 쓰려는 개발자라면 반드시 알아야 할 한계다.
AMEL: Accumulated Message Effects on LLM Judgments
LLM을 자동 평가자로 쓸 때 이전 대화 기록의 긍정/부정 분위기가 이후 판단을 오염시킨다는 걸 75,898개 API 호출로 증명한 연구.
Language-Switching Triggers Take a Latent Detour Through Language Models
8B LLM에 심어진 백도어 트리거가 중간 레이어에서 언어 탐지기를 완전히 속이는 직교 부분공간(orthogonal subspace)으로 숨어 이동한다는 걸 회로 분석으로 밝혀냈다.
Formal Methods Meet LLMs: Auditing, Monitoring, and Intervention for Compliance of Advanced AI Systems
LLM이 규칙을 잘 지키고 있는지 감시하려면 LLM에게 맡기지 말고 LTL(시간 논리 공식) 기반 모니터를 쓰세요.
Related Resources
Original Abstract (Expand)
Agent skills occupy a privileged position in the agent workflow, as agents are expected to implicitly follow and execute them, rendering third-party skills a vulnerable attack surface. Existing studies have revealed unsafe agent behaviors induced by skill-based attacks, but they primarily evaluate poisoned skills within a single task execution and enumerate harms through ad-hoc risk lists. To bridge these gaps, we introduce SkillHarm, a benchmark of skill-based attacks across the skill-use lifecycle, paired with a systematic taxonomy of skill-relevant risks. SkillHarm evaluates two attack scenarios: Fixed-Payload Poisoning (FPP), where a fixed poisoned skill package directly compromises any task session that invokes it, and Self-Mutating Poisoning (SMP), where an initially benign execution silently mutates persistent skill content, deferring harm until a subsequent reuse. It further defines 12 risk types based on the agent workflow component targeted by the harm: data pipelines, system environments, and agent autonomy. To instantiate these attacks at scale, we build AutoSkillHarm, an automated construction pipeline with coding agents driven by natural-language harnesses. The resulting benchmark contains 879 attack samples across 71 skills. Experiments show that current agents remain vulnerable with attack success rates up to 86.3% in FPP and 69.3% in SMP. Our analysis further reveals a latent risk: many apparent attack failures stem from the agent failing to engage with the poisoned file rather than genuine resistance, and current defenses still fail to reliably mitigate the threat.