[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -1,108 +1,233 @@
|
||||
---
|
||||
id: wiki-2026-0508-excessive-agency
|
||||
title: Excessive Agency
|
||||
title: Excessive Agency (LLM)
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: []
|
||||
aliases: [excessive agency, OWASP LLM06, agent over-permission, tool abuse, autonomous risk]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.92
|
||||
tags: [uncategorized]
|
||||
verification_status: applied
|
||||
tags: [llm-security, owasp, excessive-agency, agent-safety, tool-use, permission]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-08
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: Python / TypeScript
|
||||
framework: LangChain / LlamaIndex / Custom Agent
|
||||
---
|
||||
|
||||
# Excessive Agency (과도한 권한 남용)
|
||||
# Excessive Agency
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
Excessive Agency(과도한 권한 남용)는 AI 에이전트에게 현재 작업을 수행하는 데 필요한 범위를 넘어서는 지나치게 강력한 도구 접근 권한, 데이터 접근 권한, 혹은 자율적 결정권이 부여되어 발생하는 보안 리스크이다. 이는 OWASP LLM06 위험으로 분류되며, 프롬프트 인젝션 공격 시 에이전트가 시스템 전체를 장악하거나 돌이킬 수 없는 피해를 입히는 직접적인 원인이 된다.
|
||||
## 매 한 줄
|
||||
> **"매 LLM agent 의 의 의 too 의 permission / function / autonomy"**. OWASP LLM Top 10 (LLM06). 매 manipulated → 매 destructive action. 매 mitigation: 매 least privilege + 매 human-in-the-loop + 매 sandboxed tools.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
* **리스크의 세 가지 양상**:
|
||||
* **과도한 도구 권한 (Excessive Functionality)**: 단순히 파일을 읽기만 하면 되는데 파일 삭제나 셸 실행 권한까지 부여된 경우.
|
||||
* **과도한 데이터 접근 (Excessive Permissions)**: 특정 문서만 필요함에도 데이터베이스 전체나 다른 사용자의 데이터에 접근 가능한 경우.
|
||||
* **과도한 자율성 (Excessive Autonomy)**: 사용자 승인 없이 이메일 발송, 금융 결제 등 중대한 외부 영향을 끼치는 작업을 수행하게 둔 경우.
|
||||
* **발생 원인**: 개발 편의를 위해 모든 권한이 허용된 API 키를 사용하거나, 에이전트가 어떤 상황에서 어떤 도구를 써야 할지에 대한 정교한 정책(Policy)이 부재할 때 발생한다.
|
||||
* **방어 전략**:
|
||||
* **스키마 수준의 제어 (Schema-level Gating)**: 도구의 파라미터 중 위험한 옵션(예: `rm -rf /`)은 에이전트가 아예 넘길 수 없도록 스키마 수준에서 차단.
|
||||
* **최소 권한의 원칙 (Least Privilege)**: 작업 단위별로 필요한 도구만 활성화하는 동적 권한 할당.
|
||||
* **승인 게이트 (Approval Gates)**: 파괴적인 행동이나 외부 영향이 큰 작업 전에는 반드시 인간의 개입을 요구.
|
||||
## 매 핵심
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
* **유연성 저하**: 권한을 너무 세분화하여 제한하면, 에이전트가 예상치 못한 창의적인 방법으로 문제를 해결하는 능력이 제약될 수 있다.
|
||||
* **운영 복잡성**: 수많은 도구와 데이터에 대해 개별적인 권한 정책을 수립하고 유지하는 것은 높은 엔지니어링 비용이 든다.
|
||||
### 매 sub-type
|
||||
- **Excessive functionality**: 매 too many tools.
|
||||
- **Excessive permission**: 매 broad access.
|
||||
- **Excessive autonomy**: 매 no HITL.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
### Related Concepts
|
||||
* [[Agentic AI Security|Agentic AI Security]]
|
||||
* 연결 이유: 과도한 권한 남용은 에이전트 보안의 핵심 관리 대상이다.
|
||||
* [[T-component (Tool Registry)|T-component (Tool Registry)]]
|
||||
* 연결 이유: 도구의 권한과 명세를 관리하는 하네스의 구성 요소이다.
|
||||
* [[L-component (Lifecycle Hooks)|L-component (Lifecycle Hooks)]]
|
||||
* 연결 이유: 도구 실행 전 권한을 검사하고 정책을 집행하는 실질적인 계층이다.
|
||||
### 매 attack scenario
|
||||
- **Prompt injection** → 매 tool 의 abuse.
|
||||
- **Indirect** (web page) → 매 fetched 의 inject.
|
||||
- **Cross-tool**: 매 read DB → 매 send email.
|
||||
- **Agent escalation**: 매 self-empower.
|
||||
|
||||
### Deeper Research Questions
|
||||
* 작업의 '위험도'를 모델이 실시간으로 평가하여, 위험이 감지될 때만 권한을 일시적으로 축소하는 '동적 권한 격리' 기술은 가능한가?
|
||||
* 에이전트가 가진 권한을 그래프 형태로 시각화하여, 한 도구의 권한이 다른 도구로 전이(Privilege Escalation)될 수 있는 경로를 자동으로 탐지하는 방법은 무엇인가?
|
||||
### 매 응용 risk
|
||||
1. **Email agent**: 매 send to anyone.
|
||||
2. **DB agent**: 매 DROP TABLE.
|
||||
3. **Browser agent**: 매 sensitive site visit.
|
||||
4. **Code agent**: 매 git push --force.
|
||||
5. **Multi-agent**: 매 manager prompt-inject worker.
|
||||
|
||||
### Practical Application Contexts
|
||||
* **Implementation:** 데이터베이스 조회 도구 구현 시, 에이전트용 계정은 'Read-Only' 권한만 부여하고 특정 테이블에만 접근 가능하도록 DB 레벨에서 제한한다.
|
||||
* **System Design:** 하네스 설계 시 모든 도구 호출을 가로채는 중앙 집중형 'Policy Enforcement Point'를 두어, 도구 실행 전 정책 엔진(Open Policy Agent 등)에 질의하도록 한다.
|
||||
### 매 mitigation
|
||||
- **Least privilege**.
|
||||
- **Read-only by default**.
|
||||
- **HITL for destructive**.
|
||||
- **Sandbox / capability**.
|
||||
- **Rate limit**.
|
||||
- **Audit log**.
|
||||
|
||||
---
|
||||
*Last updated: 2026-05-01*
|
||||
## 💻 패턴
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### Tool whitelist (least privilege)
|
||||
```python
|
||||
def safe_agent_tools(user_role):
|
||||
base = ['search', 'read_doc']
|
||||
if user_role == 'admin':
|
||||
base += ['write_doc', 'send_email']
|
||||
if user_role == 'super_admin':
|
||||
base += ['delete_doc']
|
||||
return base
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
agent = create_agent(tools=safe_agent_tools(current_user.role))
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### HITL approval
|
||||
```python
|
||||
def execute_tool(tool, args):
|
||||
if tool.is_destructive:
|
||||
approval = request_human_approval(f"Approve {tool.name} with {args}?")
|
||||
if not approval: return {'status': 'denied'}
|
||||
return tool.run(**args)
|
||||
```
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Sandboxed file write
|
||||
```python
|
||||
import os
|
||||
SANDBOX = '/tmp/agent-sandbox'
|
||||
os.makedirs(SANDBOX, exist_ok=True)
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
def safe_write(filename, content):
|
||||
full = os.path.realpath(os.path.join(SANDBOX, filename))
|
||||
if not full.startswith(SANDBOX):
|
||||
raise SecurityError('Outside sandbox')
|
||||
open(full, 'w').write(content)
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
### Read-only DB role
|
||||
```sql
|
||||
CREATE ROLE agent_readonly;
|
||||
GRANT SELECT ON ALL TABLES IN SCHEMA public TO agent_readonly;
|
||||
-- 매 NO insert / update / delete
|
||||
```
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
### Capability token
|
||||
```python
|
||||
class Capability:
|
||||
def __init__(self, action, resource, expires_in=300):
|
||||
self.token = jwt.encode({'action': action, 'resource': resource, 'exp': time() + expires_in}, KEY)
|
||||
|
||||
def use(self, action, resource):
|
||||
claims = jwt.decode(self.token, KEY)
|
||||
assert claims['action'] == action and claims['resource'] == resource
|
||||
return True
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
# 매 agent 의 cap 의 의 use, 매 broader 의 X
|
||||
```
|
||||
|
||||
### Rate limit + budget
|
||||
```python
|
||||
class AgentBudget:
|
||||
def __init__(self, max_calls=50, max_cost_usd=1.0):
|
||||
self.calls = 0; self.cost = 0
|
||||
self.max_calls = max_calls; self.max_cost = max_cost_usd
|
||||
|
||||
def check(self, estimated_cost):
|
||||
if self.calls >= self.max_calls: raise LimitError('Call limit')
|
||||
if self.cost + estimated_cost > self.max_cost: raise LimitError('Cost limit')
|
||||
|
||||
def record(self, cost):
|
||||
self.calls += 1; self.cost += cost
|
||||
```
|
||||
|
||||
### Tool taint analysis
|
||||
```python
|
||||
def detect_tainted_input(text, tool_args):
|
||||
"""매 if user input flows to high-impact tool, escalate."""
|
||||
if any(t in str(tool_args) for t in TAINT_MARKERS):
|
||||
return require_approval(tool, tool_args)
|
||||
return False
|
||||
```
|
||||
|
||||
### Indirect injection check
|
||||
```python
|
||||
def sanitize_external_content(html):
|
||||
"""매 web fetched 의 instruction strip."""
|
||||
soup = BeautifulSoup(html, 'lxml')
|
||||
for tag in soup.find_all(['script', 'iframe']):
|
||||
tag.decompose()
|
||||
text = soup.get_text()
|
||||
# 매 prompt-inject pattern
|
||||
if re.search(r'(ignore (previous|all) instructions|new task|system:)', text, re.I):
|
||||
return text + "\n\n[NOTE: Suspicious content detected]"
|
||||
return text
|
||||
```
|
||||
|
||||
### Multi-agent isolation
|
||||
```python
|
||||
class IsolatedAgent:
|
||||
def __init__(self, role, tools):
|
||||
self.role = role
|
||||
self.tools = tools # 매 role-specific
|
||||
|
||||
def receive(self, msg, sender):
|
||||
# 매 不 trust other agents' tool requests
|
||||
if sender != 'human' and msg.requests_tool_use:
|
||||
return 'Agent-to-agent tool requests not allowed'
|
||||
```
|
||||
|
||||
### Audit log
|
||||
```python
|
||||
def audit_tool_use(tool, args, result, user):
|
||||
log({
|
||||
'timestamp': now(),
|
||||
'user': user,
|
||||
'agent_session': current_session.id,
|
||||
'tool': tool.name,
|
||||
'args': hash_sensitive(args),
|
||||
'result_status': result.status,
|
||||
'cost_usd': result.cost,
|
||||
})
|
||||
```
|
||||
|
||||
### Dry-run mode
|
||||
```python
|
||||
def dry_run_tool(tool, args):
|
||||
"""매 destructive action 의 simulate."""
|
||||
plan = tool.plan(**args)
|
||||
return f"DRY RUN: would {plan.summary}"
|
||||
```
|
||||
|
||||
### Reversibility check
|
||||
```python
|
||||
def assess_reversibility(tool, args):
|
||||
if tool.action == 'delete' and not args.get('soft'): return 'irreversible'
|
||||
if tool.action == 'send_message': return 'visible_to_others'
|
||||
if tool.action == 'transfer_money': return 'irreversible'
|
||||
return 'safe'
|
||||
|
||||
# 매 irreversible → HITL
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Mitigation |
|
||||
|---|---|
|
||||
| Read-only research | Whitelist + audit |
|
||||
| Write actions | HITL approval |
|
||||
| Destructive | Reversibility + HITL |
|
||||
| Multi-agent | Isolation |
|
||||
| Public-facing | Sandbox + budget |
|
||||
| Sensitive data | Capability token |
|
||||
|
||||
**기본값**: 매 least privilege tools + 매 HITL for destructive + 매 sandbox + 매 audit + 매 budget cap.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[LLM-Security]] · [[OWASP-LLM-Top-10]]
|
||||
- 변형: [[Excessive-Functionality]] · [[Excessive-Permission]]
|
||||
- 응용: [[Agent-Safety]] · [[Tool-Use]] · [[HITL]]
|
||||
- Adjacent: [[Prompt-Injection]] · [[Indirect-Injection]] · [[Constitutional-AI]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 모든 agent. 매 tool-using LLM. 매 production deploy.
|
||||
**언제 X**: 매 sandboxed dev only.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **All-tools agent**: 매 broad attack surface.
|
||||
- **No HITL on destructive**: 매 single mistake.
|
||||
- **Implicit trust of fetched**: 매 indirect injection.
|
||||
- **No budget**: 매 runaway cost.
|
||||
- **No audit**: 매 forensics 의 X.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (OWASP LLM Top 10 2024, Anthropic agent safety).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — agency types + 매 whitelist / HITL / sandbox / budget code |
|
||||
|
||||
Reference in New Issue
Block a user