당신의 AI 에이전트가 방금 rm -rf / 를 실행했습니다 — 이를 멈추는 방법
I’m happy to translate the article for you, but I’ll need the full text you’d like translated. Could you please paste the content (excluding the source line you already provided) here? Once I have it, I’ll keep the source link at the top unchanged and translate the rest into Korean while preserving all formatting, markdown, and technical terms.
개요
Claude Code, Cursor, Copilot 같은 AI 코딩 에이전트는 셸 명령을 실행하고, 파일을 편집하며, API를 호출할 수 있습니다. 이는 강력하지만, 에이전트가 위험한 작업을 실행하면 문제가 됩니다.
BodAIGuard는 AI 에이전트와 시스템 사이에 위치해 위험한 동작을 실행 전에 차단하는 가드레일입니다.
왜 가드레일이 필요한가?
- AI 에이전트는 프롬프트 인젝션을 통해 속을 수 있습니다: 도구 결과, 이메일, 웹 페이지에 숨겨진 악성 텍스트가 에이전트의 행동을 장악합니다.
- 보호가 없으면 에이전트가 실제로 위험한 명령을 실행할 수 있습니다.
BodAIGuard는 실행 전에 모든 동작을 평가합니다:
AI Agent → BodAIGuard → System
↑
45 block rules
45 confirm rules
12 categories
Prompt‑injection scanner
강제 모드
| Mode | Description |
|---|---|
| Claude Code hooks | PreToolUse를 통해 도구 호출을 가로챕니다. |
| MCP Proxy | 모든 MCP 서버를 보안으로 감쌉니다. |
| HTTP Proxy | 에이전트와 API 사이에 위치합니다. |
| Shell Guard | extdebug를 통한 Bash 통합. |
| REST API | 명령을 프로그래밍 방식으로 평가합니다. |
설치
바이너리
플랫폼에 맞는 바이너리를 GitHub Releases 페이지에서 다운로드하십시오.
# 실행 가능하게 만들기
chmod +x bodaiguard-linux-x64
sudo mv bodaiguard-linux-x64 /usr/local/bin/bodaiguard
Claude 코드 훅
bodaiguard install hooks
빠른 테스트
bodaiguard test 'rm -rf /'
# → BLOCK: Filesystem root destruction
bodaiguard test 'ls -la'
# → ALLOW
MCP 서버 래핑하기
{
"mcpServers": {
"my-tool": {
"command": "bodaiguard",
"args": ["mcp-proxy", "node", "/path/to/mcp-server.js"]
}
}
}
모든 도구 호출은 규칙에 따라 평가됩니다. 위험한 호출은 실행되는 대신 JSON‑RPC 오류를 반환합니다.
프롬프트‑인젝션 스캐닝
bodaiguard scan 'Check encoded payloads'
# → Detects base64‑encoded attacks, hidden HTML, zero‑width obfuscation
탐지 범위
- 명령어 재정의 및 역할 탈취
- ChatML 구분자 인젝션
- Base64‑인코딩 공격
- 숨겨진 HTML 인젝션
- 제로‑폭 문자 난독화
최소 3‑계층 탐지기 (Python)
import re, base64, unicodedata
# Tier 1: Regex patterns for known attack types
PATTERNS = [
(r'you\s+are\s+now\s+(DAN|evil|unrestricted)', 'role_hijack'),
(r'', 'chatml_delimiter'),
(r'pretend\s+you\s+have\s+no\s+restrictions', 'jailbreak'),
]
def detect(content: str) -> dict:
# Normalize unicode
text = unicodedata.normalize('NFKC', content)
text = re.sub(r'[\u200b-\u200d\u2060\ufeff]', '', text)
# Tier 1: Fast regex
for pattern, category in PATTERNS:
if re.search(pattern, text, re.IGNORECASE):
return {'blocked': True, 'reason': category}
# Tier 2: Base64 decode + re‑scan
for match in re.findall(r'[A-Za-z0-9+/]{24,}={0,2}', text):
try:
decoded = base64.b64decode(match, validate=True).decode()
for pattern, category in PATTERNS:
if re.search(pattern, decoded, re.IGNORECASE):
return {'blocked': True, 'reason': f'encoded_{category}'}
except Exception:
pass
return {'blocked': False}
이것은 기본적인 사항을 포착합니다. BodAIGuard는 DOM 파싱, 유니코드 유사 문자 감지, 그리고 YAML 기반 규칙을 통해 훨씬 더 확장됩니다.
구성 (default.yaml)
actions:
destructive:
block:
- pattern: 'rm\\s+(-[a-zA-Z]*)?\\s*/'
reason: Filesystem root destruction
- pattern: 'mkfs\\.'
reason: Filesystem format
confirm:
- pattern: 'rm\\s+-r'
reason: Recursive delete
paths:
block:
- ~/.ssh/**
- /etc/shadow
readonly:
- /etc/passwd
모든 규칙은 default.yaml에 존재합니다—코드 변경이 필요하지 않습니다.
프로젝트 링크
- GitHub:
- 다운로드: GitHub 최신 릴리스
- 라이선스: ALD Proprietary (무료 사용, 요청 시 소스 제공)
자신이 직접 학습한 시스템 오케스트레이터가 서버에서 AI 에이전트가 위험한 일을 하는 것에 지쳐서 만든 프로젝트.