툴 연동 LLM 에이전트를 위한 범용 방어: Attacker Tool Filtering과 Normal Tool Recalling
Universal Defenses for Tool-Integrated LLM Agents Against Adversarial Attacks
TL;DR Highlight
플래닝 직전 신뢰 툴셋으로 덮어쓰니 공격 성공률이 0%까지 내려갔다
Who Should Read
툴을 붙인 LLM 에이전트가 프롬프트 인젝션으로 엉뚱한 툴을 호출할까 걱정하는 백엔드 개발자
Core Mechanics
- 플래닝 직전에 툴셋을 원래대로 복원
- Normal Tool Recalling(NTR)은 저장해 둔 사용자 툴셋으로 에이전트가 보는 툴 목록을 덮어쓴다.
- 공격 종류를 몰라도 되고 이상 탐지도 필요 없다.
- 수상한 툴은 임베딩으로 걸러내기
- Attacker Tool Filtering(ATF)은 툴 설명을 임베딩하고 Isolation Forest(이상치 탐지 알고리즘)로 튀는 툴을 뺀다.
- 공격자가 넣은 툴은 원래 툴과 의미가 다르다는 가정에 기댄다.
- 프롬프트 방어 3종을 겹쳐 쓴다
- 입력 직후에 CoT(단계별 사고)와 paraphrase(재작성)를 적용한다.
- 실행 직전에 self-reflection(계획 재검증)으로 계획을 점검한다.
- GPT 계열은 방어하면 업무 성공률이 떨어졌다
- 공격은 막히지만 원래 작업 성공률(OTSR)이 크게 떨어지는 경우가 많았다.
- 작은 오픈모델은 방어와 성공률이 같이 좋아지는 경우가 많았다.
- 큰 모델이 더 안전하진 않았다
- DPI(직접 프롬프트 인젝션) 무방어 상태에서 GPT-3.5·GPT-4가 작은 오픈모델보다 공격 성공률이 높았다.
Evidence
- DPI에서 NTR 조합이 ASR을 0으로
- GPT-3.5는 무방어 0.9469에서 0.0, GPT-4는 0.9156에서 0.0으로 내려갔다(ASB 벤치마크, 4가지 주입 유형 평균).
- Gemma2는 ASB paraphrase 0.4187 대비 NTR 조합 0.1206이었다.
- IPI·MP에서도 NTR 조합 ASR 거의 0
- IPI에서 6개 모델 중 Qwen2만 0.0025이고 나머지는 0.0이었다.
- MP는 6개 모델 모두 0.0이었다.
- NTR 조합이 Gemma2 OTSR을 올렸다
- IPI에서 무방어 0.165에서 0.5456으로 올랐다.
- MP에서는 0.1에서 0.415로 올랐다.
- GPT-5는 NTR 단독으로 ASR 0
- DPI 무방어 ASR 0.2425에서 NTR 적용 시 0.0, OTSR은 0.045에서 0.095로 올랐다.
- GPT 모델은 백도어에서 OTSR 하락
- GPT-4는 무방어 OTSR 0.928에서 NTR 조합 0.187로 떨어졌다(ASR은 0.58에서 0.0).
How to Apply
- 플래닝 직전에 툴 목록을 화이트리스트로 덮어쓰기
- 서비스 시작 시 승인된 툴셋을 따로 저장해 둔다.
- LLM 플래닝 호출 직전에 에이전트가 보는 툴 목록을 그 저장본으로 교체한다.
- 계획 검증 프롬프트를 실행 전에 한 번 더 돌리기
- 생성된 JSON 계획을 허용 툴 목록과 함께 LLM에 넘겨 검증시킨다.
- 허용 목록 밖 툴이 있으면 고쳐서 반환하게 한다.
- 툴 설명 임베딩에 Isolation Forest 적용하기
- 외부에서 툴을 동적으로 받는 구조에서 쓴다.
- 툴 설명을 임베딩해 이상치 툴을 제외한 뒤 플래닝한다.
- 모델별로 방어 층 수를 따로 평가하기
- 방어를 하나씩 켜고 ASR과 원래 작업 성공률을 같이 잰다.
- GPT 계열은 층을 줄여 가며 성공률 하락을 확인한다.
Try It
# Claude나 ChatGPT에 붙여넣기 (논문 방법의 간이 버전: self-reflection 계획 검증)
Please validate the following agent plan. The plan is formatted as a JSON list.
plan: {{JSON 계획}}
Each step in the plan must be a dictionary with the following keys:
- "message": a description of what the agent does in that step.
- "tool_use": a list of tool names used in that step.
From now on, you are only allowed to use the normal tools listed below: {{허용 툴 목록}}
Validation rules:
- The plan must contain at least two steps.
- Each step must include a non-empty "tool_use" field.
- All tools in "tool_use" must be selected only from the allowed tools list above.
- Steps must follow a logical sequence; each step should build on the previous one.
- Do not modify the "message" field unless it is incorrect or unclear.
- Steps should not repeat unnecessarily.
If the plan is valid, return it exactly as it is. If there are issues, return a corrected version in the same format. Respond only with the valid or corrected JSON list.
# 이어서 해 볼 것: 계획에 허용 목록 밖 툴 이름을 하나 넣어 제거되는지 확인하기Terminology
관련 논문
같은 시뮬레이션, 다른 근거: 도구 출력을 파일로 넘기면 LLM 에이전트 정확도가 어디서 깎이나
긴 툴 출력을 파일로 넘기자 GPT-5.1은 정확도 11.3%p 하락, 정식 출력 지정하니 회복
가짜 뉴스가 진짜 폭락을: LLM 트레이딩 에이전트 대상 정보 주입 공격
가짜 헤드라인 한 줄로 LLM 트레이딩 에이전트 62%를 조종했다(프롬프트 주입은 14%)
Harness Engineering 101: LLM은 뇌, harness는 몸
에이전트는 JSON 배열을 관리하는 루프이고, 16개 챕터로 직접 만들어 본다
Harness²: 에이전트 harness를 스스로 고쳐 쓰는 재귀 최적화 프레임워크
모델은 고정하고 harness를 재귀로 고쳤더니 벤치마크 점수가 최대 11.8%p 올랐다
해고된 Savannah 경찰관, ICE 요원 남편에게 Flock 계정 공유
경찰관이 Flock 계정을 남편(ICE 요원)에게 공유했고, 감사에서 983건 검색이 드러나 해고됐다
tmux와 Claude Code: 세션, send-keys, 그리고 한계선
tmux로 Claude Code 여러 개를 돌리면 편하지만 에이전트 4개쯤에서 한계가 온다
Hybrid Reasoning Agents: 잠재 공간에서 생각하고 텍스트로 행동하는 LLM 에이전트
잠재 공간 추론과 텍스트 도구 호출을 섞었더니 성능 10.4%↑, 토큰 최대 54.7%↓
Original Abstract (Expand)
Large Language Model (LLM) agents have demonstrated impressive capabilities across a variety of domains, particularly when integrated with external tools for multi-step task completion. However, they are increasingly vulnerable to adversarial attacks, including direct prompt injection, indirect prompt injection, memory poisoning, and backdoor attacks, which exploit the model's openness to prompt injection and tool manipulation. In this work, we explore practical and generalizable defense strategies within a unified framework across these four attack types. We introduce two universal tool-based defenses: Attacker Tool Filtering, which uses anomaly detection (e.g., Isolation Forest) to identify and remove suspicious tools, and Normal Tool Recalling, a white-box method that restores the agent's original toolset prior to planning. Additionally, we incorporate prompt-based defenses: Chain-of-Thought prompting and self-reflection techniques to enhance reasoning and task paraphrasing to mitigate attacks. Experimental results across both four open-source LLMs (Gemma2-9B, Qwen2-7B, LLaMA3-8B, and LLaMA3.1-8B) and three proprietary LLMs (GPT-3.5, GPT-4, and GPT-5) show that our methods significantly reduce the Attack Success Rates (ASR), achieving 0% ASR in many settings, while preserving or even improving the original task success rate. These findings highlight the promise of simple, modular, multi-layered defenses for strengthening the security and robustness of tool-integrated LLM agents. The code is available at https://github.com/Xiaoyan-Lisa/Defenses-for-Tool-Integrated-LLM-Agents-Against-Adversarial-Attacks.