agent-threat-rules 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +358 -96
- package/dist/cli.js +90 -0
- package/dist/cli.js.map +1 -1
- package/dist/coverage-analyzer.d.ts +43 -0
- package/dist/coverage-analyzer.d.ts.map +1 -0
- package/dist/coverage-analyzer.js +329 -0
- package/dist/coverage-analyzer.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.d.ts +13 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +220 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/mcp-tools/coverage-gaps.d.ts +13 -0
- package/dist/mcp-tools/coverage-gaps.d.ts.map +1 -0
- package/dist/mcp-tools/coverage-gaps.js +55 -0
- package/dist/mcp-tools/coverage-gaps.js.map +1 -0
- package/dist/mcp-tools/list-rules.d.ts +17 -0
- package/dist/mcp-tools/list-rules.d.ts.map +1 -0
- package/dist/mcp-tools/list-rules.js +45 -0
- package/dist/mcp-tools/list-rules.js.map +1 -0
- package/dist/mcp-tools/scan.d.ts +18 -0
- package/dist/mcp-tools/scan.d.ts.map +1 -0
- package/dist/mcp-tools/scan.js +75 -0
- package/dist/mcp-tools/scan.js.map +1 -0
- package/dist/mcp-tools/submit-proposal.d.ts +12 -0
- package/dist/mcp-tools/submit-proposal.d.ts.map +1 -0
- package/dist/mcp-tools/submit-proposal.js +95 -0
- package/dist/mcp-tools/submit-proposal.js.map +1 -0
- package/dist/mcp-tools/threat-summary.d.ts +12 -0
- package/dist/mcp-tools/threat-summary.d.ts.map +1 -0
- package/dist/mcp-tools/threat-summary.js +74 -0
- package/dist/mcp-tools/threat-summary.js.map +1 -0
- package/dist/mcp-tools/validate.d.ts +15 -0
- package/dist/mcp-tools/validate.d.ts.map +1 -0
- package/dist/mcp-tools/validate.js +45 -0
- package/dist/mcp-tools/validate.js.map +1 -0
- package/dist/modules/index.d.ts +5 -4
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/index.js +6 -4
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/semantic.d.ts +105 -0
- package/dist/modules/semantic.d.ts.map +1 -0
- package/dist/modules/semantic.js +283 -0
- package/dist/modules/semantic.js.map +1 -0
- package/dist/rule-scaffolder.d.ts +39 -0
- package/dist/rule-scaffolder.d.ts.map +1 -0
- package/dist/rule-scaffolder.js +173 -0
- package/dist/rule-scaffolder.js.map +1 -0
- package/dist/skill-fingerprint.d.ts +96 -0
- package/dist/skill-fingerprint.d.ts.map +1 -0
- package/dist/skill-fingerprint.js +337 -0
- package/dist/skill-fingerprint.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -1
- package/rules/agent-manipulation/ATR-2026-030-cross-agent-attack.yaml +1 -1
- package/rules/agent-manipulation/ATR-2026-032-goal-hijacking.yaml +1 -1
- package/rules/agent-manipulation/ATR-2026-074-cross-agent-privilege-escalation.yaml +1 -1
- package/rules/agent-manipulation/ATR-2026-076-inter-agent-message-spoofing.yaml +1 -1
- package/rules/agent-manipulation/ATR-2026-077-human-trust-exploitation.yaml +1 -1
- package/rules/context-exfiltration/ATR-2026-020-system-prompt-leak.yaml +1 -1
- package/rules/context-exfiltration/ATR-2026-021-api-key-exposure.yaml +1 -1
- package/rules/context-exfiltration/ATR-2026-075-agent-memory-manipulation.yaml +1 -1
- package/rules/data-poisoning/ATR-2026-070-data-poisoning.yaml +1 -1
- package/rules/excessive-autonomy/ATR-2026-050-runaway-agent-loop.yaml +1 -1
- package/rules/excessive-autonomy/ATR-2026-051-resource-exhaustion.yaml +1 -1
- package/rules/excessive-autonomy/ATR-2026-052-cascading-failure.yaml +1 -1
- package/rules/model-security/ATR-2026-072-model-behavior-extraction.yaml +1 -1
- package/rules/model-security/ATR-2026-073-malicious-finetuning-data.yaml +1 -1
- package/rules/privilege-escalation/ATR-2026-040-privilege-escalation.yaml +1 -1
- package/rules/privilege-escalation/ATR-2026-041-scope-creep.yaml +1 -1
- package/rules/prompt-injection/ATR-2026-001-direct-prompt-injection.yaml +1 -1
- package/rules/prompt-injection/ATR-2026-002-indirect-prompt-injection.yaml +1 -1
- package/rules/prompt-injection/ATR-2026-003-jailbreak-attempt.yaml +1 -1
- package/rules/prompt-injection/ATR-2026-004-system-prompt-override.yaml +1 -1
- package/rules/prompt-injection/ATR-2026-005-multi-turn-injection.yaml +1 -1
- package/rules/prompt-injection/ATR-2026-080-encoding-evasion.yaml +75 -0
- package/rules/prompt-injection/ATR-2026-081-semantic-multi-turn.yaml +72 -0
- package/rules/prompt-injection/ATR-2026-082-fingerprint-evasion.yaml +71 -0
- package/rules/prompt-injection/ATR-2026-083-indirect-tool-injection.yaml +71 -0
- package/rules/prompt-injection/ATR-2026-084-structured-data-injection.yaml +73 -0
- package/rules/prompt-injection/ATR-2026-085-audit-evasion.yaml +71 -0
- package/rules/prompt-injection/ATR-2026-086-visual-spoofing.yaml +75 -0
- package/rules/prompt-injection/ATR-2026-087-rule-probing.yaml +69 -0
- package/rules/prompt-injection/ATR-2026-088-adaptive-countermeasure.yaml +71 -0
- package/rules/prompt-injection/ATR-2026-089-polymorphic-skill.yaml +72 -0
- package/rules/prompt-injection/ATR-2026-090-threat-intel-exfil.yaml +71 -0
- package/rules/prompt-injection/ATR-2026-091-nested-payload.yaml +75 -0
- package/rules/prompt-injection/ATR-2026-092-consensus-poisoning.yaml +79 -0
- package/rules/prompt-injection/ATR-2026-093-gradual-escalation.yaml +73 -0
- package/rules/prompt-injection/ATR-2026-094-audit-bypass.yaml +73 -0
- package/rules/skill-compromise/ATR-2026-060-skill-impersonation.yaml +1 -1
- package/rules/tool-poisoning/ATR-2026-010-mcp-malicious-response.yaml +1 -1
- package/rules/tool-poisoning/ATR-2026-011-tool-output-injection.yaml +1 -1
- package/rules/tool-poisoning/ATR-2026-012-unauthorized-tool-call.yaml +1 -1
- package/rules/tool-poisoning/ATR-2026-013-tool-ssrf.yaml +1 -1
- package/rules/tool-poisoning/ATR-2026-095-supply-chain-poisoning.yaml +77 -0
- package/rules/tool-poisoning/ATR-2026-096-registry-poisoning.yaml +79 -0
package/README.md
CHANGED
|
@@ -1,34 +1,112 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img alt="ATR - Agent Threat Rules" src="assets/logo-light.png" width="480" />
|
|
4
|
+
|
|
5
|
+
### An Open Detection Standard for the AI Agent Era
|
|
6
|
+
|
|
7
|
+
AI Agent 時代的開放威脅偵測標準 -- 由社群共同定義
|
|
8
|
+
|
|
9
|
+
<br />
|
|
10
|
+
|
|
11
|
+
[](https://github.com/Agent-Threat-Rule/agent-threat-rules/stargazers)
|
|
12
|
+
[](https://github.com/Agent-Threat-Rule/agent-threat-rules/network)
|
|
13
|
+
[](https://github.com/Agent-Threat-Rule/agent-threat-rules/watchers)
|
|
14
|
+
[](LICENSE)
|
|
15
|
+
[](#roadmap)
|
|
16
|
+
[](#coverage-map)
|
|
17
|
+
[](#mcp-server)
|
|
18
|
+
|
|
19
|
+
[English](#what-is-atr) | [Quick Start](docs/quick-start.md) | [Contributing](CONTRIBUTING.md) | [Schema](docs/schema-spec.md)
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
---
|
|
3
24
|
|
|
4
25
|
> Every era of computing gets the detection standard it deserves.
|
|
5
|
-
> Servers got Sigma
|
|
26
|
+
> Servers got **Sigma**. Network traffic got **Suricata**. Malware got **YARA**.
|
|
6
27
|
>
|
|
7
28
|
> AI agents face prompt injection, tool poisoning, MCP exploitation,
|
|
8
29
|
> skill supply-chain attacks, and context exfiltration --
|
|
9
|
-
> and until now, there was no standardized way to detect any of them.
|
|
30
|
+
> and until now, there was **no standardized way** to detect any of them.
|
|
10
31
|
>
|
|
11
|
-
> ATR
|
|
32
|
+
> **ATR is our attempt to change that. But we can't do it alone.**
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Why This Matters
|
|
37
|
+
|
|
38
|
+
AI agents are no longer experiments -- they run in production, with real system access, handling real user data. The attack surface is growing faster than any single team can map.
|
|
39
|
+
|
|
40
|
+
AI Agent 不再只是實驗。它們運行在生產環境,擁有真實的系統權限,處理真實的使用者資料。攻擊面的增長速度遠超任何單一團隊能覆蓋的範圍。
|
|
41
|
+
|
|
42
|
+
We started ATR because we saw a gap:
|
|
43
|
+
|
|
44
|
+
- **OWASP** names the risks, but provides no executable detection rules
|
|
45
|
+
- **MITRE ATLAS** catalogs attack techniques, but offers no detection format
|
|
46
|
+
- **Real CVEs are already here**: CVE-2025-53773 (Copilot RCE), CVE-2025-32711 (EchoLeak), CVE-2025-68143 (MCP server exploit)
|
|
47
|
+
- **Zero standardized, declarative formats** exist for AI agent threat detection
|
|
48
|
+
|
|
49
|
+
ATR is our first step toward filling that gap -- starting with a YAML-based rule format that security teams can read, write, test, and share. It's early. It's imperfect. But we believe the direction is right, and we need the community's help to get there.
|
|
50
|
+
|
|
51
|
+
ATR 是我們填補這個空白的第一步。現在還很早期,還不完美。但我們相信方向是對的,而我們需要社群的力量一起走下去。
|
|
12
52
|
|
|
13
|
-
|
|
14
|
-

|
|
15
|
-

|
|
16
|
-

|
|
17
|
-

|
|
18
|
-

|
|
53
|
+
---
|
|
19
54
|
|
|
20
|
-
|
|
21
|
-
|
|
55
|
+
## Table of Contents
|
|
56
|
+
|
|
57
|
+
- [What is ATR? / 什麼是 ATR?](#what-is-atr)
|
|
58
|
+
- [Quick Start / 快速開始](#quick-start)
|
|
59
|
+
- [Design Principles / 設計原則](#design-principles)
|
|
60
|
+
- [Rule Format / 規則格式](#rule-format)
|
|
61
|
+
- [Agent Source Types / 事件來源類型](#agent-source-types)
|
|
62
|
+
- [Coverage Map / 目前覆蓋範圍](#coverage-map)
|
|
63
|
+
- [How to Use / 使用方式](#how-to-use)
|
|
64
|
+
- [Engine Capabilities / 引擎能力](#engine-capabilities)
|
|
65
|
+
- [Directory Structure / 目錄結構](#directory-structure)
|
|
66
|
+
- [MCP Server / MCP 伺服器](#mcp-server)
|
|
67
|
+
- [Three-Layer Detection / 三層偵測架構](#three-layer-detection)
|
|
68
|
+
- [CLI Commands / CLI 指令](#cli-commands)
|
|
69
|
+
- [Contributing / 參與貢獻](#contributing)
|
|
70
|
+
- [Roadmap / 路線圖](#roadmap)
|
|
71
|
+
- [Acknowledgments / 致謝](#acknowledgments)
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## What is ATR?
|
|
76
|
+
|
|
77
|
+
ATR (Agent Threat Rules) is a proposed open standard for writing detection rules specifically for AI agent threats. Think **"Sigma for AI Agents"** -- but we're just getting started.
|
|
78
|
+
|
|
79
|
+
ATR 是一個提議中的開放標準,專門用來撰寫 AI Agent 威脅偵測規則。可以把它想像成 **AI Agent 版的 Sigma** -- 但我們才剛開始。
|
|
80
|
+
|
|
81
|
+
ATR rules are YAML files that describe:
|
|
82
|
+
|
|
83
|
+
| Aspect | Description | 說明 |
|
|
84
|
+
|--------|-------------|------|
|
|
85
|
+
| **What** to detect | Patterns in LLM I/O, tool calls, agent behaviors | LLM 輸入輸出、工具呼叫、Agent 行為中的異常模式 |
|
|
86
|
+
| **How** to detect it | Regex patterns, behavioral thresholds, multi-step sequences | 正則匹配、行為閾值、多步驟序列偵測 |
|
|
87
|
+
| **What to do** | Block, alert, quarantine, escalate | 阻擋、警報、隔離、升級處理 |
|
|
88
|
+
| **How to test** | Built-in true positive and true negative test cases | 內建正反測試案例,確保規則品質 |
|
|
89
|
+
|
|
90
|
+
> **Status: RFC (Request for Comments)** -- This is a draft proposal. The schema, rule format, and engine are all open for discussion. We're actively seeking feedback from the security community before stabilizing.
|
|
91
|
+
>
|
|
92
|
+
> 目前狀態:RFC(徵求意見)。Schema、規則格式、引擎都開放討論中。我們正在積極尋求安全社群的回饋。
|
|
93
|
+
|
|
94
|
+
---
|
|
22
95
|
|
|
23
96
|
## Quick Start
|
|
24
97
|
|
|
98
|
+
Clone, install, run tests -- three commands to explore what we have so far:
|
|
99
|
+
三行指令,看看我們目前做到哪裡:
|
|
100
|
+
|
|
25
101
|
```bash
|
|
26
|
-
# Clone and validate all rules
|
|
27
102
|
git clone https://github.com/Agent-Threat-Rule/agent-threat-rules
|
|
28
103
|
cd agent-threat-rules
|
|
29
104
|
npm install && npm test
|
|
30
105
|
```
|
|
31
106
|
|
|
107
|
+
Try the engine in your own project:
|
|
108
|
+
在你的專案中試用 ATR 引擎:
|
|
109
|
+
|
|
32
110
|
```typescript
|
|
33
111
|
import { ATREngine } from 'agent-threat-rules';
|
|
34
112
|
|
|
@@ -43,38 +121,32 @@ const matches = engine.evaluate({
|
|
|
43
121
|
// => [{ rule: { id: 'ATR-2026-001', severity: 'high', ... }, confidence: 0.85 }]
|
|
44
122
|
```
|
|
45
123
|
|
|
46
|
-
|
|
124
|
+
Found a false positive? A missed detection? [Open an issue](https://github.com/Agent-Threat-Rule/agent-threat-rules/issues) -- that's exactly the kind of feedback we need.
|
|
47
125
|
|
|
48
|
-
|
|
49
|
-
rules specifically for AI agent threats. Think **"Sigma for AI Agents."**
|
|
126
|
+
發現誤判?漏偵測?[開個 issue](https://github.com/Agent-Threat-Rule/agent-threat-rules/issues) 告訴我們 -- 這正是我們最需要的回饋。
|
|
50
127
|
|
|
51
|
-
|
|
52
|
-
- **What** to detect (patterns in LLM I/O, tool calls, agent behaviors)
|
|
53
|
-
- **How** to detect it (regex patterns, behavioral thresholds, multi-step sequences)
|
|
54
|
-
- **What to do** when detected (block, alert, quarantine, escalate)
|
|
55
|
-
- **How to test** the rule (built-in true positive and true negative test cases)
|
|
128
|
+
---
|
|
56
129
|
|
|
57
|
-
##
|
|
130
|
+
## Design Principles
|
|
58
131
|
|
|
59
|
-
|
|
60
|
-
- Millions of AI agents are deployed in production as of 2026
|
|
61
|
-
- OWASP LLM Top 10 (2025) identifies risks but provides no executable detection rules
|
|
62
|
-
- OWASP Agentic Top 10 (2026) defines agent-specific threats -- ATR is the first rule set to cover all 10
|
|
63
|
-
- MITRE ATLAS catalogs AI attack techniques, but offers no detection format
|
|
64
|
-
- Real CVEs for AI agents are accelerating: CVE-2025-53773 (Copilot RCE), CVE-2025-32711 (EchoLeak), CVE-2025-68143 (MCP server exploit)
|
|
65
|
-
- Zero standardized, declarative formats exist for agent threat detection
|
|
132
|
+
These are the principles guiding ATR's development. We think they're right, but we're open to being challenged:
|
|
66
133
|
|
|
67
|
-
|
|
134
|
+
這些是 ATR 的設計原則。我們認為方向正確,但歡迎挑戰:
|
|
68
135
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
136
|
+
| # | Principle | Description |
|
|
137
|
+
|---|-----------|-------------|
|
|
138
|
+
| 1 | **Sigma-compatible** | Security teams already know YAML detection rules / 安全團隊熟悉的 YAML 格式 |
|
|
139
|
+
| 2 | **Framework-agnostic** | Works with LangChain, CrewAI, AutoGen, raw API calls / 不綁定任何框架 |
|
|
140
|
+
| 3 | **Actionable** | Rules include response actions, not just detection / 規則包含回應動作 |
|
|
141
|
+
| 4 | **Testable** | Every rule ships with true positive & true negative test cases / 每條規則附帶測試案例 |
|
|
142
|
+
| 5 | **Community-driven** | The format is open. The rules are built by everyone. / 開源格式,社群共建 |
|
|
143
|
+
|
|
144
|
+
---
|
|
74
145
|
|
|
75
146
|
## Rule Format
|
|
76
147
|
|
|
77
|
-
Every ATR rule is a YAML file
|
|
148
|
+
Every ATR rule is a YAML file. Here's a real example from our current rule set:
|
|
149
|
+
每條 ATR 規則都是一個 YAML 檔案。以下是目前規則庫中的實際範例:
|
|
78
150
|
|
|
79
151
|
```yaml
|
|
80
152
|
title: Direct Prompt Injection via User Input
|
|
@@ -124,10 +196,6 @@ detection:
|
|
|
124
196
|
response:
|
|
125
197
|
actions: [block_input, alert, snapshot]
|
|
126
198
|
auto_response_threshold: high
|
|
127
|
-
message_template: |
|
|
128
|
-
[ATR] Prompt injection attempt detected
|
|
129
|
-
Rule: {rule_id}
|
|
130
|
-
Pattern: {matched_pattern}
|
|
131
199
|
|
|
132
200
|
test_cases:
|
|
133
201
|
true_positives:
|
|
@@ -138,10 +206,19 @@ test_cases:
|
|
|
138
206
|
expected: not_triggered
|
|
139
207
|
```
|
|
140
208
|
|
|
141
|
-
See
|
|
209
|
+
Think a rule needs better patterns? See a detection gap? PRs and issues are welcome.
|
|
210
|
+
覺得規則可以改進?看到偵測盲區?歡迎提交 PR 或 issue。
|
|
211
|
+
|
|
212
|
+
See [`spec/atr-schema.yaml`](spec/atr-schema.yaml) for the full schema specification.
|
|
213
|
+
|
|
214
|
+
---
|
|
142
215
|
|
|
143
216
|
## Agent Source Types
|
|
144
217
|
|
|
218
|
+
ATR currently defines 10 event source types. This list will grow as the community identifies new attack surfaces:
|
|
219
|
+
|
|
220
|
+
ATR 目前定義了 10 種事件來源。隨著社群發現新的攻擊面,這個列表會持續擴展:
|
|
221
|
+
|
|
145
222
|
| Type | Description | Example Events |
|
|
146
223
|
|------|-------------|----------------|
|
|
147
224
|
| `llm_io` | LLM input/output | User prompts, agent responses |
|
|
@@ -155,14 +232,22 @@ See `spec/atr-schema.yaml` for the full schema specification.
|
|
|
155
232
|
| `skill_permission` | Skill permission requests | Capability grants, scope changes |
|
|
156
233
|
| `skill_chain` | Multi-skill execution chains | Sequential tool invocations across skills |
|
|
157
234
|
|
|
235
|
+
> Missing a source type relevant to your framework? [Propose it](https://github.com/Agent-Threat-Rule/agent-threat-rules/issues).
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
158
239
|
## Coverage Map
|
|
159
240
|
|
|
160
|
-
###
|
|
241
|
+
### Where We Are Today
|
|
242
|
+
|
|
243
|
+
We currently have rules across 9 categories, mapped to OWASP and MITRE standards. There are gaps -- and we need help filling them.
|
|
244
|
+
|
|
245
|
+
目前我們有 9 大類別的規則,對應到 OWASP 和 MITRE 標準。還有很多空白需要填補。
|
|
161
246
|
|
|
162
247
|
| Attack Category | OWASP LLM | OWASP Agentic | MITRE ATLAS | Rules | Real CVEs |
|
|
163
248
|
|---|---|---|---|---|---|
|
|
164
|
-
| Prompt Injection | LLM01 | ASI01 | AML.T0051 | 5 | CVE-2025-53773, CVE-2025-32711, CVE-2026-24307 |
|
|
165
|
-
| Tool Poisoning | LLM01/LLM05 | ASI02, ASI05 | AML.T0053 | 4 | CVE-2025-68143/68144/68145, CVE-2025-6514, CVE-2025-59536, CVE-2026-21852 |
|
|
249
|
+
| Prompt Injection | LLM01 | ASI01 | AML.T0051 | 5 + 15 predicted | CVE-2025-53773, CVE-2025-32711, CVE-2026-24307 |
|
|
250
|
+
| Tool Poisoning | LLM01/LLM05 | ASI02, ASI05 | AML.T0053 | 4 + 2 predicted | CVE-2025-68143/68144/68145, CVE-2025-6514, CVE-2025-59536, CVE-2026-21852 |
|
|
166
251
|
| Context Exfiltration | LLM02/LLM07 | ASI01, ASI03, ASI06 | AML.T0056/T0057 | 3 | CVE-2025-32711, CVE-2026-24307 |
|
|
167
252
|
| Agent Manipulation | LLM01/LLM06 | ASI01, ASI10 | AML.T0043 | 3 | -- |
|
|
168
253
|
| Privilege Escalation | LLM06 | ASI03 | AML.T0050 | 2 | CVE-2026-0628 |
|
|
@@ -171,11 +256,15 @@ See `spec/atr-schema.yaml` for the full schema specification.
|
|
|
171
256
|
| Data Poisoning | LLM04 | ASI06 | AML.T0020 | 1 | -- |
|
|
172
257
|
| Model Security | LLM03 | ASI04 | AML.T0044 | 2 | -- |
|
|
173
258
|
|
|
174
|
-
**
|
|
259
|
+
**49 total rules** (32 stable + 17 AI-predicted drafts). Categories like Data Poisoning and Excessive Autonomy have minimal coverage. If you have expertise in these areas, your contributions would be especially valuable.
|
|
260
|
+
|
|
261
|
+
**49 條規則**(32 條穩定 + 17 條 AI 預測草案)。像 Data Poisoning 和 Excessive Autonomy 這些類別的覆蓋率還很低。如果你在這些領域有專長,你的貢獻會特別有價值。
|
|
262
|
+
|
|
263
|
+
---
|
|
175
264
|
|
|
176
265
|
## How to Use
|
|
177
266
|
|
|
178
|
-
###
|
|
267
|
+
### TypeScript (reference engine)
|
|
179
268
|
|
|
180
269
|
```typescript
|
|
181
270
|
import { ATREngine } from 'agent-threat-rules';
|
|
@@ -206,36 +295,17 @@ for rule_file in rules_dir.rglob("*.yaml"):
|
|
|
206
295
|
print(f"{rule['id']}: {rule['title']} ({rule['severity']})")
|
|
207
296
|
```
|
|
208
297
|
|
|
209
|
-
|
|
298
|
+
> We'd love to see integrations with more languages and frameworks. If you build one, let us know.
|
|
299
|
+
>
|
|
300
|
+
> 我們期待看到更多語言和框架的整合。如果你做了一個,請告訴我們。
|
|
210
301
|
|
|
211
|
-
|
|
212
|
-
agent-threat-rules/
|
|
213
|
-
spec/
|
|
214
|
-
atr-schema.yaml # Full schema specification
|
|
215
|
-
rules/
|
|
216
|
-
prompt-injection/ # 5 rules
|
|
217
|
-
tool-poisoning/ # 4 rules
|
|
218
|
-
context-exfiltration/ # 3 rules
|
|
219
|
-
agent-manipulation/ # 3 rules
|
|
220
|
-
privilege-escalation/ # 2 rules
|
|
221
|
-
excessive-autonomy/ # 2 rules
|
|
222
|
-
skill-compromise/ # 7 rules
|
|
223
|
-
data-poisoning/ # 1 rule
|
|
224
|
-
model-security/ # 2 rules
|
|
225
|
-
tests/
|
|
226
|
-
validate-rules.ts # Schema validation for all rules
|
|
227
|
-
examples/
|
|
228
|
-
how-to-write-a-rule.md # Guide for rule authors
|
|
229
|
-
src/
|
|
230
|
-
engine.ts # ATR evaluation engine
|
|
231
|
-
session-tracker.ts # Behavioral session state tracking
|
|
232
|
-
loader.ts # YAML rule loader
|
|
233
|
-
types.ts # TypeScript type definitions
|
|
234
|
-
```
|
|
302
|
+
---
|
|
235
303
|
|
|
236
304
|
## Engine Capabilities
|
|
237
305
|
|
|
238
|
-
The reference engine (`src/engine.ts`)
|
|
306
|
+
The reference engine (`src/engine.ts`) is functional but far from complete:
|
|
307
|
+
|
|
308
|
+
參考引擎可以運作,但離完善還有很長的路:
|
|
239
309
|
|
|
240
310
|
| Operator | Status | Description |
|
|
241
311
|
|----------|--------|-------------|
|
|
@@ -251,49 +321,241 @@ The reference engine (`src/engine.ts`) supports:
|
|
|
251
321
|
| `sequence` (ordered) | Partial | Checks pattern co-occurrence, not strict ordering |
|
|
252
322
|
| `behavioral_drift` | Planned | ML-based behavioral baseline comparison |
|
|
253
323
|
|
|
254
|
-
|
|
324
|
+
The `sequence` operator and `behavioral_drift` detection are areas where we'd especially welcome contributions.
|
|
325
|
+
|
|
326
|
+
`sequence` 運算子和 `behavioral_drift` 偵測是我們特別歡迎貢獻的方向。
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## MCP Server
|
|
331
|
+
|
|
332
|
+
ATR ships with a built-in MCP (Model Context Protocol) server, enabling direct integration with Claude Code, Cursor, Windsurf, and other MCP-compatible AI tools.
|
|
333
|
+
|
|
334
|
+
ATR 內建 MCP 伺服器,可直接整合 Claude Code、Cursor、Windsurf 等支援 MCP 的 AI 工具。
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
# Start MCP server (stdio transport)
|
|
338
|
+
npx agent-threat-rules mcp
|
|
339
|
+
```
|
|
255
340
|
|
|
256
|
-
|
|
341
|
+
Add to your MCP client config (e.g. `claude_desktop_config.json`):
|
|
342
|
+
|
|
343
|
+
```json
|
|
344
|
+
{
|
|
345
|
+
"mcpServers": {
|
|
346
|
+
"atr": {
|
|
347
|
+
"command": "npx",
|
|
348
|
+
"args": ["agent-threat-rules", "mcp"]
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
| Tool | Description | 說明 |
|
|
355
|
+
|------|-------------|------|
|
|
356
|
+
| `atr_scan` | Scan text for threats in real-time | 即時掃描文字威脅 |
|
|
357
|
+
| `atr_list_rules` | Browse and filter rules | 瀏覽和篩選規則 |
|
|
358
|
+
| `atr_validate_rule` | Validate rule YAML | 驗證規則 YAML |
|
|
359
|
+
| `atr_submit_proposal` | Generate draft rule from description | 從描述生成草案規則 |
|
|
360
|
+
| `atr_coverage_gaps` | Analyze OWASP/MITRE coverage gaps | 分析 OWASP/MITRE 覆蓋缺口 |
|
|
361
|
+
| `atr_threat_summary` | Get threat intelligence by category | 按類別取得威脅情報 |
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Three-Layer Detection
|
|
366
|
+
|
|
367
|
+
ATR uses a layered detection architecture. Each layer catches what the previous layer misses.
|
|
368
|
+
|
|
369
|
+
ATR 使用分層偵測架構。每一層捕捉前一層遺漏的威脅。
|
|
370
|
+
|
|
371
|
+
| Layer | Method | Latency | Status |
|
|
372
|
+
|-------|--------|---------|--------|
|
|
373
|
+
| **Layer 1** | Regex pattern matching | < 1ms | v0.1 shipped |
|
|
374
|
+
| **Layer 2** | Behavioral fingerprinting + drift detection | < 10ms | v0.2 shipped |
|
|
375
|
+
| **Layer 3** | AI semantic analysis (LLM-as-judge) | ~1-5s | v0.2 shipped |
|
|
376
|
+
|
|
377
|
+
```typescript
|
|
378
|
+
import { ATREngine, SemanticModule, SkillFingerprintStore } from 'agent-threat-rules';
|
|
379
|
+
|
|
380
|
+
// Layer 1: Pattern matching (always on)
|
|
381
|
+
const engine = new ATREngine({ rulesDir: './rules' });
|
|
382
|
+
await engine.loadRules();
|
|
383
|
+
|
|
384
|
+
// Layer 2: Behavioral fingerprinting
|
|
385
|
+
const fingerprints = new SkillFingerprintStore();
|
|
386
|
+
|
|
387
|
+
// Layer 3: AI semantic analysis (optional, requires API key)
|
|
388
|
+
const semantic = new SemanticModule({
|
|
389
|
+
apiUrl: 'https://api.anthropic.com',
|
|
390
|
+
apiKey: process.env.LLM_API_KEY!,
|
|
391
|
+
model: 'claude-sonnet-4-20250514',
|
|
392
|
+
});
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
A MiroFish swarm intelligence simulation (14 AI agents, 40 rounds) predicted:
|
|
396
|
+
- **30-40%** detection rate with Layer 1 alone
|
|
397
|
+
- **70-80%** detection rate with all three layers combined
|
|
398
|
+
|
|
399
|
+
MiroFish 群體智慧模擬(14 個 AI agents,40 輪)預測:靜態規則匹配只有 30-40% 偵測率,三層架構可達 70-80%。
|
|
400
|
+
|
|
401
|
+
See [THREAT-MODEL.md](THREAT-MODEL.md) for detailed analysis and known bypass techniques.
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
## CLI Commands
|
|
406
|
+
|
|
407
|
+
```bash
|
|
408
|
+
# Scan agent events for threats
|
|
409
|
+
atr scan events.json
|
|
410
|
+
|
|
411
|
+
# Validate rule files
|
|
412
|
+
atr validate rules/
|
|
413
|
+
|
|
414
|
+
# Run embedded test cases
|
|
415
|
+
atr test rules/
|
|
416
|
+
|
|
417
|
+
# Show rule collection statistics
|
|
418
|
+
atr stats
|
|
419
|
+
|
|
420
|
+
# Start MCP server
|
|
421
|
+
atr mcp
|
|
422
|
+
|
|
423
|
+
# Interactive rule scaffolding
|
|
424
|
+
atr scaffold
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
All commands support `--json` output for CI/CD integration.
|
|
428
|
+
所有指令支援 `--json` 輸出,方便 CI/CD 整合。
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
## Directory Structure
|
|
433
|
+
|
|
434
|
+
```
|
|
435
|
+
agent-threat-rules/
|
|
436
|
+
spec/
|
|
437
|
+
atr-schema.yaml # Schema specification (evolving)
|
|
438
|
+
rules/
|
|
439
|
+
prompt-injection/ # Prompt injection (5 stable + 15 predicted)
|
|
440
|
+
tool-poisoning/ # Tool poisoning (4 stable + 2 predicted)
|
|
441
|
+
context-exfiltration/ # Context exfiltration (3 rules)
|
|
442
|
+
agent-manipulation/ # Agent manipulation (3 rules)
|
|
443
|
+
privilege-escalation/ # Privilege escalation (2 rules)
|
|
444
|
+
excessive-autonomy/ # Excessive autonomy (2 rules)
|
|
445
|
+
skill-compromise/ # Skill supply chain (7 rules)
|
|
446
|
+
data-poisoning/ # Data poisoning (1 rule, needs more)
|
|
447
|
+
model-security/ # Model security (2 rules, needs more)
|
|
448
|
+
src/
|
|
449
|
+
engine.ts # ATR evaluation engine (Layer 1)
|
|
450
|
+
session-tracker.ts # Behavioral session tracking
|
|
451
|
+
skill-fingerprint.ts # Skill fingerprint store (Layer 2)
|
|
452
|
+
modules/
|
|
453
|
+
semantic.ts # LLM-as-judge module (Layer 3)
|
|
454
|
+
session.ts # Session analysis module
|
|
455
|
+
index.ts # Module registry
|
|
456
|
+
mcp-server.ts # MCP server (stdio transport)
|
|
457
|
+
mcp-tools/ # 6 MCP tool implementations
|
|
458
|
+
rule-scaffolder.ts # Interactive rule generator
|
|
459
|
+
coverage-analyzer.ts # OWASP/MITRE gap analyzer
|
|
460
|
+
cli.ts # CLI interface
|
|
461
|
+
loader.ts # YAML rule loader
|
|
462
|
+
types.ts # TypeScript type definitions
|
|
463
|
+
docs/
|
|
464
|
+
quick-start.md # 5-minute getting started guide
|
|
465
|
+
rule-writing-guide.md # How to write ATR rules
|
|
466
|
+
contribution-paths.md # 3 ways to contribute rules
|
|
467
|
+
mirofish-prediction-guide.md # AI-predicted rule workflow
|
|
468
|
+
schema-spec.md # Full schema specification
|
|
469
|
+
tests/
|
|
470
|
+
engine.test.ts # Engine unit tests
|
|
471
|
+
attack-corpus.test.ts # Attack pattern corpus tests
|
|
472
|
+
session-tracker.test.ts # Session tracker tests
|
|
473
|
+
validate-rules.ts # Schema validation for all rules
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
---
|
|
257
477
|
|
|
258
478
|
## Contributing
|
|
259
479
|
|
|
260
|
-
ATR is
|
|
261
|
-
|
|
480
|
+
ATR is only as good as the community behind it. We're looking for people who care about AI security -- whether you have 10 years of experience or 10 minutes of curiosity.
|
|
481
|
+
|
|
482
|
+
ATR 的價值取決於背後的社群。我們在尋找關心 AI 安全的人 -- 不論你有十年經驗還是十分鐘的好奇心。
|
|
483
|
+
|
|
484
|
+
| Role | How you can help |
|
|
485
|
+
|------|------------------|
|
|
486
|
+
| **Security Researchers** | Submit new detection rules via PR / 透過 PR 提交新偵測規則 |
|
|
487
|
+
| **AI Framework Developers** | Help improve the `agent_source` spec / 協助改進事件來源規格 |
|
|
488
|
+
| **Red Teamers** | Submit attack patterns you've discovered / 提交你發現的攻擊模式 |
|
|
489
|
+
| **Anyone** | Review existing rules, report false positives, challenge our assumptions / 審查規則、回報誤判、挑戰我們的假設 |
|
|
490
|
+
|
|
491
|
+
Your first PR doesn't have to be a new rule. Fixing a typo, improving a regex, or adding a test case -- it all counts.
|
|
262
492
|
|
|
263
|
-
|
|
493
|
+
你的第一個 PR 不一定要是新規則。修正錯字、改進正則、新增測試案例 -- 都算貢獻。
|
|
264
494
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
495
|
+
**Three ways to contribute rules / 三種貢獻規則的方式:**
|
|
496
|
+
1. **Manual** -- Write rules from your own security research
|
|
497
|
+
2. **AI-Predicted** -- Generate candidate rules from threat simulations
|
|
498
|
+
3. **Detection-Driven** -- Auto-draft rules from real-world anomalies
|
|
268
499
|
|
|
269
|
-
See [CONTRIBUTING.md](./CONTRIBUTING.md) for
|
|
500
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) and [docs/contribution-paths.md](docs/contribution-paths.md) for detailed guidelines.
|
|
501
|
+
|
|
502
|
+
---
|
|
270
503
|
|
|
271
504
|
## Adopters
|
|
272
505
|
|
|
273
|
-
Organizations and projects using ATR.
|
|
506
|
+
Organizations and projects using or evaluating ATR. We'd love to know how you use it.
|
|
507
|
+
使用或評估 ATR 的組織與專案。我們很想知道你怎麼用它。
|
|
274
508
|
|
|
275
509
|
| Project | How they use ATR |
|
|
276
510
|
|---------|-----------------|
|
|
277
|
-
| *Your project here* | [
|
|
511
|
+
| *Your project here* | [Tell us](https://github.com/Agent-Threat-Rule/agent-threat-rules/issues) |
|
|
512
|
+
|
|
513
|
+
---
|
|
278
514
|
|
|
279
515
|
## Roadmap
|
|
280
516
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
517
|
+
Where we are and where we're headed -- subject to change based on community input:
|
|
518
|
+
|
|
519
|
+
我們的現狀和方向 -- 會根據社群回饋調整:
|
|
520
|
+
|
|
521
|
+
- [x] **v0.1** -- 32 rules, TypeScript engine, OWASP Agentic Top 10 coverage, session tracking
|
|
522
|
+
- [x] **v0.2** -- MCP server (6 tools), Layer 3 semantic detection, 17 AI-predicted rules, skill fingerprinting, rule scaffolder, coverage analyzer, contribution pipeline, 5 documentation guides
|
|
523
|
+
- [ ] **v0.3** -- Embedding similarity detection (Layer 2.5), Python reference engine, multi-language rule patterns
|
|
524
|
+
- [ ] **v1.0** -- Stable schema, multi-framework validation, broad adoption
|
|
525
|
+
|
|
526
|
+
> Have thoughts on what v1.0 should look like? [Join the discussion](https://github.com/Agent-Threat-Rule/agent-threat-rules/issues).
|
|
527
|
+
|
|
528
|
+
---
|
|
285
529
|
|
|
286
530
|
## Acknowledgments
|
|
287
531
|
|
|
288
|
-
ATR
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
- [
|
|
292
|
-
- [
|
|
293
|
-
- [
|
|
294
|
-
- [
|
|
295
|
-
- [
|
|
532
|
+
ATR builds on the shoulders of these foundational projects:
|
|
533
|
+
ATR 站在這些基礎專案的肩膀上:
|
|
534
|
+
|
|
535
|
+
- [Sigma](https://github.com/SigmaHQ/sigma) -- Generic signature format for SIEM systems
|
|
536
|
+
- [OWASP LLM Top 10 (2025)](https://owasp.org/www-project-top-10-for-large-language-model-applications/) -- LLM application security risks
|
|
537
|
+
- [OWASP Top 10 for Agentic Applications (2026)](https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/) -- Agent-specific threats
|
|
538
|
+
- [MITRE ATLAS](https://atlas.mitre.org/) -- Adversarial threat landscape for AI systems
|
|
539
|
+
- [NVIDIA Garak](https://github.com/NVIDIA/garak) -- LLM vulnerability scanner
|
|
540
|
+
- [Invariant Labs](https://invariantlabs.ai/) -- Guardrails and MCP security research
|
|
541
|
+
- [Meta LlamaFirewall](https://ai.meta.com/research/publications/llamafirewall-an-open-source-guardrail-system-for-building-secure-ai-agents/) -- Open-source agent guardrails
|
|
542
|
+
|
|
543
|
+
---
|
|
296
544
|
|
|
297
545
|
## License
|
|
298
546
|
|
|
299
547
|
MIT -- Use it, modify it, build on it.
|
|
548
|
+
|
|
549
|
+
---
|
|
550
|
+
|
|
551
|
+
<div align="center">
|
|
552
|
+
|
|
553
|
+
**ATR is early, imperfect, and open. That's the point.**
|
|
554
|
+
|
|
555
|
+
ATR 還在早期,還不完美,而且完全開放。這正是重點。
|
|
556
|
+
|
|
557
|
+
If AI agents are going to be safe, the detection standard can't belong to any single company. It has to be built together.
|
|
558
|
+
|
|
559
|
+
[](https://star-history.com/#Agent-Threat-Rule/agent-threat-rules&Date)
|
|
560
|
+
|
|
561
|
+
</div>
|