## 🛠️ 專業框架與方法論

### 威脅建模框架

#### MITRE ATLAS（Adversarial Threat Landscape for AI Systems）
- **Tactics**：Reconnaissance、Resource Development、Initial Access、ML Model Access、Execution、Persistence、Defense Evasion、Discovery、Collection、ML Attack Staging、Exfiltration、Impact
- 用於映射 AI 系統完整攻擊生命週期，產出 ATT&CK-style 矩陣

#### OWASP Top 10 for LLM Applications (2025)
| ID | 名稱 | 核心緩解策略 |
|----|------|-------------|
| LLM01 | Prompt Injection | 輸入/輸出過濾、特權分離、Human Approval |
| LLM02 | Sensitive Information Disclosure | 資料最小化、輸出掃描、RBAC |
| LLM03 | Supply Chain | 模型/套件簽章驗證、SBOM、依賴審計 |
| LLM04 | Data and Model Poisoning | 訓練資料驗證、異常偵測、模型完整性檢查 |
| LLM05 | Improper Output Handling | 輸出編碼、下游系統沙箱、schema 驗證 |
| LLM06 | Excessive Agency | 工具權限最小化、行為邊界、確認閘道 |
| LLM07 | System Prompt Leakage | 提示詞隔離、輸出過濾、分層 prompt 架構 |
| LLM08 | Vector and Embedding Weaknesses | 存取控制、輸入淨化、監控異常查詢 |
| LLM09 | Misinformation | 引用驗證、置信度標示、人工審核 |
| LLM10 | Unbounded Consumption | Rate limiting、配額、成本監控 |

#### STRIDE for AI Systems
- **S**poofing：身份偽造（API key 盜用、session hijacking）
- **T**ampering：提示詞/訓練資料/模型權重篡改
- **R**epudiation：缺乏 AI 決策稽核軌跡
- **I**nformation Disclosure：訓練資料記憶、RAG 外洩
- **D**enial of Service：Token flooding、模型資源耗盡
- **E**levation of Privilege：Agent tool abuse、越權 API 呼叫

### 安全架構模式

#### LLM 應用縱深防禦層
```
[User] → WAF/API Gateway → Input Sanitizer → Prompt Firewall
       → LLM (isolated) → Output Guardrail → DLP Scanner
       → Action Validator → [Downstream Systems]
       → Audit Logger (全鏈路) → SIEM/SOAR
```

#### AI Agent 安全設計原則
1. **Least Privilege Tools**：每個 tool 最小必要權限
2. **Human-in-the-Loop**：高風險操作需人工確認
3. **Deterministic Boundaries**：明確定義 Agent 可做/不可做清單
4. **Session Isolation**：跨用戶/跨 session 記憶隔離
5. **Observability**：結構化 log 含 prompt hash、tool calls、latency

#### RAG 安全檢查清單
- [ ] 向量庫存取控制（tenant isolation）
- [ ] 文件上傳掃描（惡意內容、隱藏指令）
- [ ] Chunk 級權限過濾
- [ ] 檢索結果 sanitization 後再注入 context
- [ ] 防止 cross-tenant data leakage

### 測試方法論

#### LLM 紅隊測試類別
1. **Direct Prompt Injection**：覆蓋 system prompt 指令
2. **Indirect Prompt Injection**：透過 RAG/外部內容注入
3. **Jailbreak**：角色扮演、編碼繞過、多輪誘導
4. **Tool Abuse**：濫用 Agent 工具執行未授權操作
5. **Data Exfiltration**：透過編碼輸出、側信道洩漏敏感資料
6. **Model Extraction**：透過 API 查詢推斷模型行為

#### 自動化測試工具參考
- **Garak**：LLM vulnerability scanner
- **Promptfoo**：Prompt 測試與 regression
- **LLM Guard**：輸入/輸出安全過濾
- **NeMo Guardrails**：對話流程控制
- **Microsoft Counterfit**：AI 系統攻擊模擬

### 治理與合規框架

#### NIST AI Risk Management Framework (AI RMF)
- **Govern** → **Map** → **Measure** → **Manage** 四階段循環
- 對應控制：風險登記、影響評估、持續監控、事件回應

#### 企業 AI 安全成熟度模型（自訂五級）
| 等級 | 特徵 |
|------|------|
| L1 Ad Hoc | 無正式 AI 安全政策 |
| L2 Developing | 有政策但未系統化執行 |
| L3 Defined | OWASP LLM 對照、基本 guardrails |
| L4 Managed | 紅隊演練、自動化掃描、事件 playbooks |
| L5 Optimizing | 持續威脅情報、adaptive defenses、零信任 AI |

### 事件應變 Playbook 骨架
```
1. 偵測與分類（AI-specific incident taxonomy）
2. 遏制（隔離模型端點、撤銷 API keys、停用 Agent tools）
3. 根除（修補 prompt、更新 guardrails、清除污染資料）
4. 復原（漸進式恢復服務、加強監控）
5. 事後檢討（RCA、威脅模型更新、培訓）
```

### 持續學習來源
- OWASP GenAI Security Project
- MITRE ATLAS 社群更新
- Anthropic / OpenAI / Google 安全研究報告
- arXiv: AI Safety & Security 最新論文
- AI Village (DEF CON)、Black Hat AI 議程