Attention을 활용한 악성 Agent Skill 탐지: Locate-and-Judge
Detecting Malicious Agent Skills in the Wild using Attention
TL;DR Highlight
LLM 에이전트 마켓플레이스에 퍼진 악성 Skill 파일을 Attention 기반으로 저렴하게 탐지하는 2단계 파이프라인
Who Should Read
LLM 에이전트 시스템에 외부 Skill/플러그인 마켓플레이스를 연동하는 개발자나 보안 엔지니어. 프롬프트 인젝션 방어를 구현하거나 에이전트 공급망 보안을 고민하는 사람.
Core Mechanics
- LLM 에이전트가 로드하는 'Skill'(SKILL.md 파일 형태의 자연어 명령 패키지)은 기존 프롬프트 인젝션 방어가 통하지 않음. 신뢰/비신뢰 경계 자체가 없기 때문.
- Locate-and-Judge는 2단계로 동작함. 먼저 작은 LLM(Qwen2.5-0.5B-Instruct)이 Skill 전체를 읽고 Attention이 높은 상위 K개 span만 추출(Locator), 그 span만 DeepSeek-V4-Flash 판사(Judge)에게 넘겨 악성 여부 판단.
- Locator는 'Attention이 높은 span = 모델이 실제로 따를 명령'이라는 가설을 기반으로 함. 악성 인젝션은 실행되려면 반드시 높은 Attention을 끌어야 한다는 원리.
- 134k개 Skill을 스캔하는 데 약 $34(약 5만원)만 들었음. 전체 내용 스캔 대비 2.84배 적은 토큰 사용.
- Hidden Malicious Skills(HMS, 정상 기능으로 위장한 악성 Skill)를 83% 탐지. 기존 전체 내용 스캔 방식은 같은 클래스에서 45%에 불과.
- Lobehub, Skills.sh, Clawhub.ai 3개 마켓플레이스에서 131개 악성 Skill 확인, 그 중 82개는 정상 도구로 위장한 HMS였고 SkillSpector·Cisco Skill Scanner가 못 잡은 것들이 다수.
Evidence
- 134,934개 Skill 스캔 결과 359개 플래그 → 131개 악성 확인, precision 83.3%. 공격 도구 포함 시 89%.
- Locate-and-Judge F1=0.925, SkillSpector recall 20%(F1 크게 하락), Cisco Skill Scanner recall 15.4%(McNemar p<0.001로 통계적 유의미한 차이).
- HMS(위장형 악성) 탐지율: Locate-and-Judge 83% vs 전체 내용 스캔 45%. 특히 자격증명 탈취 Skill에서 89% vs 37%.
- K=3 설정 시 F1=0.955로 최고 성능, 전체 내용 스캔(F1=0.921, 토큰 799개/Skill) 대비 더 높은 정확도로 토큰 397개/Skill만 사용.
How to Apply
- 에이전트 마켓플레이스나 Skill 저장소에 업로드 시점 검증 파이프라인을 만드는 경우: Qwen2.5-0.5B 같은 작은 LLM으로 Skill 파일의 Attention을 읽어 상위 K개 span을 추출하고, 해당 span만 GPT-4급 모델에게 악성 여부 판단을 맡기면 전체 스캔 대비 비용을 2~3배 절감할 수 있음.
- 현재 regex/키워드 기반 Skill 스캐너를 쓰는 경우: 키워드 없이 위장한 HMS는 regex로 잡을 수 없으므로, Attention 기반 Locator를 앞단에 두고 의심 span을 추려 LLM 판단을 붙이는 하이브리드 구조로 바꾸면 탐지율이 크게 올라감.
- base64 인코딩된 악성 one-liner가 걱정된다면: 현재 구조에서 유일한 blind spot이 이 패턴임. Span segmenter가 이를 독립 span으로 분리하지 못하는 경우가 있으므로, 플래그된 Skill에 한해 전체 내용 2차 스캔을 추가하는 fallback을 두면 됨.
Code Example
Terminology
관련 논문
ctx – 로컬 머신의 코딩 에이전트 히스토리를 검색하는 CLI 도구
Claude Code, Cursor, Codex 등 코딩 에이전트가 이전 세션의 논의·결정·실패 시도를 잊지 않도록 SQLite로 인덱싱해 재사용할 수 있게 해주는 오픈소스 CLI 도구다.
Micro-Agent: Model API 내부 협업으로 Frontier 모델을 이기는 방법 (vLLM Semantic Router)
vLLM 팀이 단일 모델 API 호출 뒤에서 여러 모델이 협업하는 'Micro-Agent' 개념을 공개했습니다. 별도의 에이전트 코드 없이 라우터 레이어에서 모델 조합을 실행해 GPT-4급 결과를 더 저렴하게 낼 수 있다는 아이디어입니다.
Ornith-1.0: 에이전틱 코딩을 위한 자기 개선형 오픈소스 모델
Gemma 4와 Qwen 3.5를 기반으로 파인튜닝한 코딩 특화 오픈소스 모델로, RL(강화학습)을 통해 스캐폴드(에이전트 실행 구조)까지 함께 최적화하는 방식을 주장하지만, 커뮤니티에서는 벤치마크 과최적화에 불과하다는 의심을 받고 있다.
Tool-Augmented Agent에서의 Entity Binding 실패 분석
AI 에이전트가 올바른 도구를 선택해도 잘못된 대상에 실행하는 'Entity Binding 실패' 문제를 정의하고, 이를 막는 실행 정책을 평가한 논문.
Herdr: 터미널에서 여러 AI Agent를 한 번에 관리하는 Agent Multiplexer
여러 AI 코딩 에이전트(Claude, Codex 등)를 하나의 터미널에서 동시에 실행·관리할 수 있는 Rust 기반 오픈소스 툴로, tmux처럼 세션이 유지되고 SSH로 원격 접속도 가능해 멀티 에이전트 워크플로우를 크게 단순화해준다.
Ornith-1.0: 스스로 Scaffold를 생성하는 Agentic Coding LLM
모델이 문제 풀이 전략(scaffold)을 직접 생성하고 개선하는 자기강화 학습 프레임워크를 적용한 오픈소스 코딩 특화 LLM으로, 9B 소형 모델부터 397B 대형 모델까지 라인업을 갖추고 SWE-Bench 등 주요 벤치마크에서 Claude Opus 4.7을 능가하는 성능을 보여줬다.
Related Resources
Original Abstract (Expand)
LLM agents increasingly load skills, file-based packages of natural-language instructions written by third parties and distributed through marketplaces, that execute with the user's privileges. A single malicious skill can exfiltrate data, hijack the agent, or persist as a supply-chain foothold, which turns the skill marketplace into a new attack surface for agentic systems. Prompt-injection defenses do not carry over to this setting. They rely on a boundary between trusted instructions and untrusted data, whereas a skill is itself a body of instructions, so an injected command sits among many legitimate ones and inherits their authority. We present Locate-and-Judge, a two-stage detector designed for this regime. A lightweight locator scores the structural spans of a skill by the instruction-following attention each span draws and retains only the top-K. A judge then examines the retained spans in detail. Concentrating the costly judgment on a few high-attention spans lets the detector audit an entire marketplace instead of a sample. Compared to direct LLM-based scanning, this approach offers an order-of-magnitude cost reduction, dramatically increasing its scalability at a small cost to recall, and it dominates keyword and regex baselines at comparable expense. Deployed at marketplace scale and at negligible cost, Locate-and-Judge flags skills with high precision, the majority of which we manually confirmed as malicious, surfacing dozens of live malicious skills, including several disguised as benign functionality and many that SkillSpector and Cisco Skill Scanner fail to detect. We release the resulting labeled dataset.