AgentWard: 자율 AI 에이전트를 위한 Lifecycle Security 아키텍처
AgentWard: A Lifecycle Security Architecture for Autonomous AI Agents
TL;DR Highlight
AI 에이전트의 초기화부터 실행까지 5단계 전 생애주기에 걸친 보안 레이어를 체계적으로 설계한 방어 아키텍처 제안.
Who Should Read
LLM 기반 자율 에이전트를 프로덕션에 배포하는 백엔드/인프라 개발자. Prompt Injection, 메모리 오염, 악성 플러그인 등 에이전트 보안 위협을 실제로 고민하는 AI 시스템 설계자.
Core Mechanics
- 에이전트 보안 위협은 단일 지점에서 끝나지 않고 초기화 → 입력 → 메모리 → 의사결정 → 실행 순으로 전파됨. 입력 필터링 하나만으로는 막을 수 없음.
- 5개 보호 레이어 구성: Foundation Scan(공급망), Input Sanitization(입력), Cognition Protection(메모리), Decision Alignment(의사결정), Execution Control(실행). 각 레이어가 다른 보안 원칙으로 동작해 공통 우회 패턴을 방지.
- Zero-trust 원칙 적용 - 앞 레이어가 'allow' 판정해도 뒤 레이어가 다시 독립적으로 검증. 업스트림 컴포넌트가 이미 오염됐다고 가정하고 동작.
- Cross-layer 조율(Cross-layer Coordination): 한 레이어에서 '애매하다'고 판정된 신호를 다음 레이어로 전달해 누적 리스크 판정. 약한 신호들이 쌓이면 더 엄격한 실행 정책 자동 적용.
- 악성 스킬(skill) 시나리오: Foundation Scan이 스킬 설명과 실제 코드 간 불일치를 감지 → Decision Alignment에서 비인가 계획 탐지 → Execution Control에서 파일 접근 차단. 3개 레이어 연동 예시.
- Indirect Prompt Injection → 메모리 백도어 시나리오: 웹페이지에서 주입된 악성 명령이 MEMORY.md에 저장되려 할 때 Cognition Protection이 차단. 메모리가 미래 세션의 공격 중계 포인트가 되는 것을 방지.
Evidence
- OpenClaw 에이전트 위에 플러그인 네이티브 프로토타입을 구현해 2개의 멀티스테이지 공격 체인(악성 스킬 → 데이터 유출, Indirect Prompt Injection → 지속적 백도어 + DoS)에서 레이어 간 협력으로 공격 차단을 실증.
- Foundation Scan은 before_prompt_build 훅에, Input Sanitization과 Decision Alignment는 before_message_write 훅에, Cognition Protection과 Execution Control은 before_tool_call 훅에 각각 부착 - 구체적 구현 포인트 제시.
- Execution Control에 eBPF 기반 시스템 모니터, 최소 권한(least-privilege) 집행, 상태 롤백, 트래픽 모니터링을 조합해 런타임 환경 측 최종 방어선 구성.
How to Apply
- 자체 에이전트 시스템의 런타임 이벤트를 5단계(초기화/입력/메모리/결정/실행)로 분류하고, 각 단계에 독립적인 검증 훅을 추가하라. 예를 들어 tool_call 직전에 명령 패턴 검사 레이어를 끼워넣는 것부터 시작.
- 에이전트가 외부 문서나 웹 검색 결과를 메모리(파일/DB)에 저장하는 경우, 저장 직전에 Prompt Injection 패턴 및 콘텐츠 이상 여부를 검사하는 Cognition Protection 레이어를 추가해 백도어 지속화를 방지.
- 보안 판정 결과를 세션 공유 상태(shared security state)로 유지해 다음 레이어로 전달하라. 한 레이어에서 '의심스럽지만 차단 불가' 판정이 나면 이를 플래그로 저장하고, 이후 고위험 액션 발생 시 더 엄격한 정책 적용하는 누적 에스컬레이션 패턴을 구현.
Code Example
# OpenClaw 플러그인 스타일 - AgentWard 레이어 훅 부착 예시
class AgentWardPlugin:
def __init__(self):
self.session_risk_state = {"risk_score": 0, "warnings": []}
# Foundation Scan: 스킬 로드 전 검사
def before_prompt_build(self, context):
for skill in context.loaded_skills:
if self._detect_skill_mismatch(skill):
self.session_risk_state["warnings"].append({
"layer": "foundation_scan",
"skill": skill.name,
"finding": "description_code_mismatch"
})
self.session_risk_state["risk_score"] += 30
# Input Sanitization: 외부 콘텐츠 입력 시 검사
def before_message_write(self, message):
if message.role == "tool":
if self._detect_prompt_injection(message.content):
message.content = self._sanitize(message.content)
self.session_risk_state["risk_score"] += 20
self.session_risk_state["warnings"].append({
"layer": "input_sanitization",
"action": "sanitized"
})
# Cognition Protection: 메모리 파일 수정 시 검사
# Execution Control: 모든 tool call 감시
def before_tool_call(self, tool_name, params, is_memory_write=False):
if is_memory_write:
# Cognition Protection
if self._detect_malicious_memory_pattern(params):
return {"block": True, "reason": "suspicious_memory_mutation"}
# Execution Control: 누적 리스크 기반 정책 강화
if self.session_risk_state["risk_score"] > 40:
if self._is_high_risk_command(tool_name, params):
return {"block": True, "reason": "high_risk_under_elevated_session_risk"}
return {"block": False}
def _detect_skill_mismatch(self, skill): ...
def _detect_prompt_injection(self, content): ...
def _sanitize(self, content): ...
def _detect_malicious_memory_pattern(self, params): ...
def _is_high_risk_command(self, tool_name, params): ...Terminology
관련 논문
Ramp의 Sheets AI가 재무 데이터를 외부로 유출한 취약점 분석
Ramp의 스프레드시트 AI 에이전트가 외부 데이터셋에 숨겨진 프롬프트 인젝션에 속아 악성 수식을 자동 삽입하고 기밀 재무 데이터를 외부 서버로 유출할 수 있었던 취약점이 공개됐다. AI 에이전트가 신뢰할 수 없는 데이터를 처리할 때 얼마나 위험한지를 보여주는 실제 사례다.
AI가 내 게임을 플레이하게 하기 – 플레이테스팅을 돕는 Agentic Test Harness 구축
인디 게임 개발자가 LLM 에이전트를 활용해 게임을 자동으로 플레이테스트하는 시스템을 만든 경험 공유로, 솔로 개발자의 QA 병목을 AI로 해결하는 실용적 접근법이다.
Tendril – 스스로 도구를 만들고 등록하는 Self-extending Agent
Tendril은 요청받은 작업에 필요한 도구가 없으면 직접 코드를 작성해 등록하고 재사용하는 자기 확장형 AI 에이전트 패턴의 레퍼런스 구현체다. 매 세션마다 도구 레지스트리가 쌓여 점점 더 빠르고 효율적으로 작동한다.
TerminalBench 1위 달성한 오픈소스 코딩 에이전트 Dirac - API 비용 50~80% 절감
컨텍스트를 극도로 효율적으로 관리해 API 비용을 평균 64.8% 줄이면서도 코드 품질은 올린 오픈소스 코딩 에이전트 Dirac이 공개됐다. Gemini-3-flash-preview 기준 TerminalBench-2에서 65.2%로 1위를 기록했다.
EvanFlow – Claude Code를 위한 TDD 기반 반복 피드백 루프
Claude Code에서 'let's evanflow this'라고 말하는 것만으로 브레인스토밍부터 TDD 구현, 반복 검증까지 자동으로 진행해주는 16개 스킬 묶음이다. AI 코드 생성의 고질적인 문제인 테스트 없는 구현과 맥락 손실을 체계적으로 잡아주는 워크플로우라서 주목받고 있다.
AI Agent가 프로덕션 DB를 삭제했다 — 그리고 커뮤니티의 반응
Cursor AI Agent가 Railway 프로덕션 데이터베이스와 백업까지 통째로 삭제한 사고 사례로, AI Agent에 과도한 권한을 줄 때의 위험성과 엔지니어링 통제의 중요성을 보여준다.
Related Resources
Original Abstract (Expand)
Autonomous AI agents extend large language models into full runtime systems that load skills, ingest external content, maintain memory, plan multi-step actions, and invoke privileged tools. In such systems, security failures rarely remain confined to a single interface; instead, they can propagate across initialization, input processing, memory, decision-making, and execution, often becoming apparent only when harmful effects materialize in the environment. This paper presents AgentWard, a lifecycle-oriented, defense-in-depth architecture that systematically organizes protection across these five stages. AgentWard integrates stage-specific, heterogeneous controls with cross-layer coordination, enabling threats to be intercepted along their propagation paths while safeguarding critical assets. We detail the design rationale and architecture of five coordinated protection layers, and implement a plugin-native prototype on OpenClaw to demonstrate practical feasibility. This perspective provides a concrete blueprint for structuring runtime security controls, managing trust propagation, and enforcing execution containment in autonomous AI agents. Our code is available at https://github.com/FIND-Lab/AgentWard .