@panguard-ai/atr 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.
Files changed (129) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +299 -0
  3. package/dist/cli.d.ts +12 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +720 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/coverage-analyzer.d.ts +43 -0
  8. package/dist/coverage-analyzer.d.ts.map +1 -0
  9. package/dist/coverage-analyzer.js +329 -0
  10. package/dist/coverage-analyzer.js.map +1 -0
  11. package/dist/engine.d.ts +127 -0
  12. package/dist/engine.d.ts.map +1 -0
  13. package/dist/engine.js +636 -0
  14. package/dist/engine.js.map +1 -0
  15. package/dist/index.d.ts +26 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +18 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/loader.d.ts +21 -0
  20. package/dist/loader.d.ts.map +1 -0
  21. package/dist/loader.js +124 -0
  22. package/dist/loader.js.map +1 -0
  23. package/dist/mcp-server.d.ts +13 -0
  24. package/dist/mcp-server.d.ts.map +1 -0
  25. package/dist/mcp-server.js +220 -0
  26. package/dist/mcp-server.js.map +1 -0
  27. package/dist/mcp-tools/coverage-gaps.d.ts +13 -0
  28. package/dist/mcp-tools/coverage-gaps.d.ts.map +1 -0
  29. package/dist/mcp-tools/coverage-gaps.js +55 -0
  30. package/dist/mcp-tools/coverage-gaps.js.map +1 -0
  31. package/dist/mcp-tools/list-rules.d.ts +17 -0
  32. package/dist/mcp-tools/list-rules.d.ts.map +1 -0
  33. package/dist/mcp-tools/list-rules.js +45 -0
  34. package/dist/mcp-tools/list-rules.js.map +1 -0
  35. package/dist/mcp-tools/scan.d.ts +18 -0
  36. package/dist/mcp-tools/scan.d.ts.map +1 -0
  37. package/dist/mcp-tools/scan.js +75 -0
  38. package/dist/mcp-tools/scan.js.map +1 -0
  39. package/dist/mcp-tools/submit-proposal.d.ts +12 -0
  40. package/dist/mcp-tools/submit-proposal.d.ts.map +1 -0
  41. package/dist/mcp-tools/submit-proposal.js +95 -0
  42. package/dist/mcp-tools/submit-proposal.js.map +1 -0
  43. package/dist/mcp-tools/threat-summary.d.ts +12 -0
  44. package/dist/mcp-tools/threat-summary.d.ts.map +1 -0
  45. package/dist/mcp-tools/threat-summary.js +74 -0
  46. package/dist/mcp-tools/threat-summary.js.map +1 -0
  47. package/dist/mcp-tools/validate.d.ts +15 -0
  48. package/dist/mcp-tools/validate.d.ts.map +1 -0
  49. package/dist/mcp-tools/validate.js +45 -0
  50. package/dist/mcp-tools/validate.js.map +1 -0
  51. package/dist/modules/index.d.ts +144 -0
  52. package/dist/modules/index.d.ts.map +1 -0
  53. package/dist/modules/index.js +82 -0
  54. package/dist/modules/index.js.map +1 -0
  55. package/dist/modules/semantic.d.ts +105 -0
  56. package/dist/modules/semantic.d.ts.map +1 -0
  57. package/dist/modules/semantic.js +283 -0
  58. package/dist/modules/semantic.js.map +1 -0
  59. package/dist/modules/session.d.ts +70 -0
  60. package/dist/modules/session.d.ts.map +1 -0
  61. package/dist/modules/session.js +128 -0
  62. package/dist/modules/session.js.map +1 -0
  63. package/dist/rule-scaffolder.d.ts +39 -0
  64. package/dist/rule-scaffolder.d.ts.map +1 -0
  65. package/dist/rule-scaffolder.js +173 -0
  66. package/dist/rule-scaffolder.js.map +1 -0
  67. package/dist/session-tracker.d.ts +56 -0
  68. package/dist/session-tracker.d.ts.map +1 -0
  69. package/dist/session-tracker.js +175 -0
  70. package/dist/session-tracker.js.map +1 -0
  71. package/dist/skill-fingerprint.d.ts +96 -0
  72. package/dist/skill-fingerprint.d.ts.map +1 -0
  73. package/dist/skill-fingerprint.js +337 -0
  74. package/dist/skill-fingerprint.js.map +1 -0
  75. package/dist/types.d.ts +129 -0
  76. package/dist/types.d.ts.map +1 -0
  77. package/dist/types.js +6 -0
  78. package/dist/types.js.map +1 -0
  79. package/package.json +75 -0
  80. package/rules/agent-manipulation/ATR-2026-030-cross-agent-attack.yaml +175 -0
  81. package/rules/agent-manipulation/ATR-2026-032-goal-hijacking.yaml +135 -0
  82. package/rules/agent-manipulation/ATR-2026-074-cross-agent-privilege-escalation.yaml +115 -0
  83. package/rules/agent-manipulation/ATR-2026-076-inter-agent-message-spoofing.yaml +165 -0
  84. package/rules/agent-manipulation/ATR-2026-077-human-trust-exploitation.yaml +144 -0
  85. package/rules/context-exfiltration/ATR-2026-020-system-prompt-leak.yaml +175 -0
  86. package/rules/context-exfiltration/ATR-2026-021-api-key-exposure.yaml +176 -0
  87. package/rules/context-exfiltration/ATR-2026-075-agent-memory-manipulation.yaml +115 -0
  88. package/rules/data-poisoning/ATR-2026-070-data-poisoning.yaml +160 -0
  89. package/rules/excessive-autonomy/ATR-2026-050-runaway-agent-loop.yaml +134 -0
  90. package/rules/excessive-autonomy/ATR-2026-051-resource-exhaustion.yaml +137 -0
  91. package/rules/excessive-autonomy/ATR-2026-052-cascading-failure.yaml +153 -0
  92. package/rules/model-security/ATR-2026-072-model-behavior-extraction.yaml +115 -0
  93. package/rules/model-security/ATR-2026-073-malicious-finetuning-data.yaml +108 -0
  94. package/rules/privilege-escalation/ATR-2026-040-privilege-escalation.yaml +175 -0
  95. package/rules/privilege-escalation/ATR-2026-041-scope-creep.yaml +124 -0
  96. package/rules/prompt-injection/ATR-2026-001-direct-prompt-injection.yaml +265 -0
  97. package/rules/prompt-injection/ATR-2026-002-indirect-prompt-injection.yaml +214 -0
  98. package/rules/prompt-injection/ATR-2026-003-jailbreak-attempt.yaml +250 -0
  99. package/rules/prompt-injection/ATR-2026-004-system-prompt-override.yaml +204 -0
  100. package/rules/prompt-injection/ATR-2026-005-multi-turn-injection.yaml +181 -0
  101. package/rules/prompt-injection/ATR-PRED-2026-001.yaml +61 -0
  102. package/rules/prompt-injection/ATR-PRED-2026-002.yaml +58 -0
  103. package/rules/prompt-injection/ATR-PRED-2026-003.yaml +61 -0
  104. package/rules/prompt-injection/ATR-PRED-2026-005.yaml +55 -0
  105. package/rules/prompt-injection/ATR-PRED-2026-006.yaml +51 -0
  106. package/rules/prompt-injection/ATR-PRED-2026-007.yaml +57 -0
  107. package/rules/prompt-injection/ATR-PRED-2026-008.yaml +57 -0
  108. package/rules/prompt-injection/ATR-PRED-2026-009.yaml +51 -0
  109. package/rules/prompt-injection/ATR-PRED-2026-010.yaml +57 -0
  110. package/rules/prompt-injection/ATR-PRED-2026-011.yaml +53 -0
  111. package/rules/prompt-injection/ATR-PRED-2026-012.yaml +57 -0
  112. package/rules/prompt-injection/ATR-PRED-2026-023.yaml +56 -0
  113. package/rules/prompt-injection/ATR-PRED-2026-025.yaml +68 -0
  114. package/rules/prompt-injection/ATR-PRED-2026-026.yaml +66 -0
  115. package/rules/prompt-injection/ATR-PRED-2026-027.yaml +62 -0
  116. package/rules/skill-compromise/ATR-2026-060-skill-impersonation.yaml +153 -0
  117. package/rules/skill-compromise/ATR-2026-061-description-behavior-mismatch.yaml +98 -0
  118. package/rules/skill-compromise/ATR-2026-062-hidden-capability.yaml +96 -0
  119. package/rules/skill-compromise/ATR-2026-063-skill-chain-attack.yaml +96 -0
  120. package/rules/skill-compromise/ATR-2026-064-over-permissioned-skill.yaml +115 -0
  121. package/rules/skill-compromise/ATR-2026-065-skill-update-attack.yaml +93 -0
  122. package/rules/skill-compromise/ATR-2026-066-parameter-injection.yaml +106 -0
  123. package/rules/tool-poisoning/ATR-2026-010-mcp-malicious-response.yaml +237 -0
  124. package/rules/tool-poisoning/ATR-2026-011-tool-output-injection.yaml +185 -0
  125. package/rules/tool-poisoning/ATR-2026-012-unauthorized-tool-call.yaml +190 -0
  126. package/rules/tool-poisoning/ATR-2026-013-tool-ssrf.yaml +208 -0
  127. package/rules/tool-poisoning/ATR-PRED-2026-004.yaml +54 -0
  128. package/rules/tool-poisoning/ATR-PRED-2026-024.yaml +68 -0
  129. package/spec/atr-schema.yaml +375 -0
@@ -0,0 +1,68 @@
1
+ title: "供应链投毒:百万级MCP技能生态的系统性风险"
2
+ id: ATR-PRED-2026-024
3
+ status: draft
4
+ description: >
5
+ MiroFish AI Prediction: 2026年AI代理生态系统的规模化部署带来了前所未有的供应链风险: > \"AI代理在2026年包含了数百万个MCP技能,形成了主要攻击面。\" 供应链攻击的演化趋势显示出高度的复杂性和隐蔽性: > \"ML供应链妥协预计将演化为包括技能注册表投毒。\" > \"预期会向涉及被妥协的合法技能的复杂供应链攻击演化,这意味着与代理工具调用等执行机制的关系。\" 这类攻击的严重程度被评估为**极高**,因为它能够在整个生态系统中造成级联影响。MITRE ATLAS框架将其归类为**AML.T0056 - 技能与供应链妥协**技术。 应对策略需要建立多层次的审计体系: > \"Panguard利用包括
6
+ author: "MiroFish Prediction Engine"
7
+ date: "2026/03/11"
8
+ schema_version: "0.1"
9
+ detection_tier: pattern
10
+ maturity: test
11
+ severity: critical
12
+
13
+ references:
14
+ mitre_atlas:
15
+ - "AML.T0056"
16
+ mitre_attack:
17
+ - "T0056"
18
+
19
+ tags:
20
+ category: tool-poisoning
21
+ subcategory: mirofish-predicted
22
+ confidence: medium
23
+
24
+ agent_source:
25
+ type: mcp_exchange
26
+ framework:
27
+ - any
28
+ provider:
29
+ - any
30
+
31
+ detection:
32
+ conditions:
33
+ - field: tool_response
34
+ operator: regex
35
+ value: "(?i)AI代理在2026年包含了数百万个MCP技能,形成了主要攻击面。"
36
+ description: "MiroFish predicted pattern 1"
37
+ - field: tool_response
38
+ operator: regex
39
+ value: "(?i)ML供应链妥协预计将演化为包括技能注册表投毒。"
40
+ description: "MiroFish predicted pattern 2"
41
+ - field: tool_response
42
+ operator: regex
43
+ value: "(?i)预期会向涉及被妥协的合法技能的复杂供应链攻击演化,这意味着与代理工具调用等执行机制的关系。"
44
+ description: "MiroFish predicted pattern 3"
45
+ - field: tool_response
46
+ operator: regex
47
+ value: "(?i)Panguard利用包括清单、指令、权限、依赖、代码和AI语义层检查的6层审计系统。"
48
+ description: "MiroFish predicted pattern 4"
49
+ - field: tool_response
50
+ operator: regex
51
+ value: "(?i)审计检查正在被设计来捕获基于观察到的规避尝试的新型规避技术。"
52
+ description: "MiroFish predicted pattern 5"
53
+
54
+ condition: any
55
+ false_positives:
56
+ - "Legitimate traffic matching predicted pattern"
57
+
58
+ response:
59
+ actions:
60
+ - block_input
61
+ - quarantine_session
62
+ - alert
63
+ - escalate
64
+ - kill_agent
65
+ auto_response_threshold: critical
66
+ message_template: >
67
+ [ATR-PRED-2026-024] MiroFish predicted attack pattern detected.
68
+ Category: tool-poisoning, Severity: critical.
@@ -0,0 +1,375 @@
1
+ # ATR Rule Schema -- Agent Threat Rules
2
+ # Version: 0.1.0-draft
3
+ #
4
+ # Inspired by Sigma rule format, extended for AI Agent attack surfaces.
5
+ # This schema defines the structure for all ATR detection rules.
6
+ #
7
+ # Status: RFC (Request for Comments)
8
+ # License: MIT
9
+
10
+ $schema: "https://json-schema.org/draft/2020-12/schema"
11
+ title: ATR Rule Schema
12
+ description: Schema for Agent Threat Rules (ATR) detection rules
13
+ version: "0.1.0-draft"
14
+
15
+ type: object
16
+ required:
17
+ - schema_version
18
+ - title
19
+ - id
20
+ - status
21
+ - description
22
+ - author
23
+ - date
24
+ - severity
25
+ - detection_tier
26
+ - maturity
27
+ - tags
28
+ - agent_source
29
+ - detection
30
+ - response
31
+
32
+ properties:
33
+
34
+ # === Metadata ===
35
+
36
+ schema_version:
37
+ type: string
38
+ description: "ATR schema version this rule conforms to (e.g., \"0.1\")"
39
+
40
+ title:
41
+ type: string
42
+ description: Human-readable rule name
43
+
44
+ id:
45
+ type: string
46
+ pattern: "^ATR-\\d{4}-\\d{3}$"
47
+ description: "Unique rule identifier. Format: ATR-YYYY-NNN (e.g., ATR-2026-001)"
48
+
49
+ status:
50
+ type: string
51
+ enum: [draft, experimental, stable, deprecated]
52
+ description: Rule maturity status
53
+
54
+ description:
55
+ type: string
56
+ description: Detailed description of the attack this rule detects
57
+
58
+ author:
59
+ type: string
60
+ description: Rule author or organization
61
+
62
+ date:
63
+ type: string
64
+ pattern: "^\\d{4}/\\d{2}/\\d{2}$"
65
+ description: "Creation date in YYYY/MM/DD format"
66
+
67
+ modified:
68
+ type: string
69
+ pattern: "^\\d{4}/\\d{2}/\\d{2}$"
70
+ description: "Last modification date in YYYY/MM/DD format"
71
+
72
+ # === Classification ===
73
+
74
+ detection_tier:
75
+ type: string
76
+ enum: [pattern, behavioral, protocol]
77
+ description: Detection approach used by this rule
78
+
79
+ maturity:
80
+ type: string
81
+ enum: [experimental, test, stable, deprecated]
82
+ description: Maturity level of this rule
83
+
84
+ # === Severity ===
85
+
86
+ severity:
87
+ type: string
88
+ enum: [critical, high, medium, low, informational]
89
+ description: Severity level of the detected threat
90
+
91
+ # === References (alignment with existing frameworks) ===
92
+
93
+ references:
94
+ type: object
95
+ description: Mappings to established security frameworks
96
+ properties:
97
+ owasp_llm:
98
+ type: array
99
+ items:
100
+ type: string
101
+ description: "OWASP LLM Top 10 references (e.g., LLM01:2025)"
102
+ mitre_atlas:
103
+ type: array
104
+ items:
105
+ type: string
106
+ description: "MITRE ATLAS technique IDs (e.g., AML.T0054)"
107
+ mitre_attack:
108
+ type: array
109
+ items:
110
+ type: string
111
+ description: "MITRE ATT&CK technique IDs (if applicable)"
112
+ cve:
113
+ type: array
114
+ items:
115
+ type: string
116
+ description: Related CVE identifiers
117
+
118
+ # === Tags (ATR classification) ===
119
+
120
+ tags:
121
+ type: object
122
+ required: [category]
123
+ properties:
124
+ category:
125
+ type: string
126
+ enum:
127
+ - prompt-injection
128
+ - tool-poisoning
129
+ - context-exfiltration
130
+ - agent-manipulation
131
+ - privilege-escalation
132
+ - excessive-autonomy
133
+ - data-poisoning
134
+ - model-abuse
135
+ - skill-compromise
136
+ description: Primary attack category
137
+ subcategory:
138
+ type: string
139
+ description: More specific classification within the category
140
+ confidence:
141
+ type: string
142
+ enum: [high, medium, low]
143
+ description: Expected accuracy of this rule (high = low false positive rate)
144
+
145
+ # === Agent Source (analogous to Sigma's logsource) ===
146
+
147
+ agent_source:
148
+ type: object
149
+ required: [type]
150
+ description: >
151
+ Defines what kind of agent data this rule inspects.
152
+ Analogous to Sigma's logsource, but for agent behaviors.
153
+ properties:
154
+ type:
155
+ type: string
156
+ enum:
157
+ - llm_io # LLM input/output (prompts and completions)
158
+ - tool_call # Function/tool call requests
159
+ - mcp_exchange # MCP protocol messages
160
+ - agent_behavior # Agent behavioral metrics and patterns
161
+ - multi_agent_comm # Inter-agent communication
162
+ - context_window # Context window contents
163
+ - memory_access # Agent memory read/write operations
164
+ - skill_lifecycle # MCP skill registration, update, removal events
165
+ - skill_permission # Skill permission requests and boundary checks
166
+ - skill_chain # Multi-skill invocation sequences
167
+ description: Type of agent data stream to monitor
168
+ framework:
169
+ type: array
170
+ items:
171
+ type: string
172
+ description: >
173
+ Applicable AI frameworks (e.g., langchain, crewai, autogen,
174
+ openai, anthropic, custom, any)
175
+ provider:
176
+ type: array
177
+ items:
178
+ type: string
179
+ description: >
180
+ Applicable LLM providers (e.g., ollama, openai, anthropic, any)
181
+
182
+ # === Detection Logic ===
183
+
184
+ detection:
185
+ type: object
186
+ required: [conditions, condition]
187
+ properties:
188
+ conditions:
189
+ description: >
190
+ Detection conditions. Supports two formats:
191
+ 1. Array format (recommended): List of {field, operator, value} objects
192
+ 2. Named-map format: Named condition blocks for complex detection logic
193
+ oneOf:
194
+ # -- Array format (used by most rules) --
195
+ - type: array
196
+ items:
197
+ type: object
198
+ required: [field, operator, value]
199
+ properties:
200
+ field:
201
+ type: string
202
+ description: >
203
+ Field to inspect (e.g., user_input, agent_output,
204
+ tool_response, tool_name, tool_args, content)
205
+ operator:
206
+ type: string
207
+ enum: [regex, contains, exact, starts_with]
208
+ description: How the value is matched against the field
209
+ value:
210
+ type: string
211
+ description: Pattern to match (regex string if operator is regex)
212
+ description:
213
+ type: string
214
+ description: Human-readable description of what this condition detects
215
+
216
+ # -- Named-map format (for complex/behavioral detection) --
217
+ - type: object
218
+ description: Named condition blocks (referenced by the condition expression)
219
+ additionalProperties:
220
+ type: object
221
+ properties:
222
+ field:
223
+ type: string
224
+ description: Field to inspect
225
+ patterns:
226
+ type: array
227
+ items:
228
+ type: string
229
+ description: Patterns to match against the field value
230
+ match_type:
231
+ type: string
232
+ enum: [contains, regex, exact, starts_with]
233
+ description: How patterns are matched
234
+ case_sensitive:
235
+ type: boolean
236
+ default: false
237
+ metric:
238
+ type: string
239
+ description: Behavioral metric to evaluate (v0.2+)
240
+ operator:
241
+ type: string
242
+ enum: [gt, lt, eq, gte, lte, deviation_from_baseline]
243
+ description: Comparison operator for behavioral thresholds
244
+ threshold:
245
+ type: number
246
+ description: Numeric threshold for the metric
247
+ window:
248
+ type: string
249
+ description: "Time window for behavioral analysis (e.g., 5m, 1h, 30s)"
250
+ ordered:
251
+ type: boolean
252
+ description: Whether steps must occur in order
253
+ within:
254
+ type: string
255
+ description: Maximum time span for the full sequence
256
+ steps:
257
+ type: array
258
+ items:
259
+ type: object
260
+ description: Ordered list of conditions that form the attack sequence
261
+
262
+ condition:
263
+ type: string
264
+ description: >
265
+ How to combine conditions. Use "any" or "or" for match-any,
266
+ "all" or "and" for match-all.
267
+ Example: "pattern_match AND behavioral"
268
+
269
+ false_positives:
270
+ type: array
271
+ items:
272
+ type: string
273
+ description: Known scenarios that may trigger false positives
274
+
275
+ # === Response Actions (ATR-specific, not in Sigma) ===
276
+
277
+ response:
278
+ type: object
279
+ required: [actions]
280
+ properties:
281
+ actions:
282
+ type: array
283
+ items:
284
+ type: string
285
+ enum:
286
+ - block_input # Reject the user/agent input
287
+ - block_output # Suppress the agent output
288
+ - block_tool # Prevent the tool call from executing
289
+ - quarantine_session # Isolate the entire session
290
+ - reset_context # Clear agent context/memory
291
+ - alert # Send alert to security team
292
+ - snapshot # Capture full session state for forensics
293
+ - escalate # Escalate to human reviewer
294
+ - reduce_permissions # Reduce agent's available tools/capabilities
295
+ - kill_agent # Terminate the agent process
296
+ description: Actions to take when the rule triggers
297
+ auto_response_threshold:
298
+ type: string
299
+ enum:
300
+ - low
301
+ - medium
302
+ - high
303
+ - critical
304
+ description: >
305
+ Severity threshold for automatic response.
306
+ Below this threshold, only alert; above, execute response actions.
307
+ message_template:
308
+ type: string
309
+ description: >
310
+ Template for alert messages. Supports placeholders:
311
+ {matched_pattern}, {truncated_input}, {truncated_output},
312
+ {source_ip_or_user}, {tool_name}, {mcp_server_url},
313
+ {rule_id}, {severity}
314
+
315
+ # === Test Cases ===
316
+
317
+ test_cases:
318
+ type: object
319
+ description: Validation test cases shipped with the rule
320
+ properties:
321
+ true_positives:
322
+ type: array
323
+ items:
324
+ type: object
325
+ properties:
326
+ input:
327
+ type: string
328
+ tool_response:
329
+ type: string
330
+ agent_output:
331
+ type: string
332
+ expected:
333
+ type: string
334
+ enum: [triggered]
335
+ description:
336
+ type: string
337
+ description: Inputs that SHOULD trigger this rule
338
+ true_negatives:
339
+ type: array
340
+ items:
341
+ type: object
342
+ properties:
343
+ input:
344
+ type: string
345
+ tool_response:
346
+ type: string
347
+ agent_output:
348
+ type: string
349
+ expected:
350
+ type: string
351
+ enum: [not_triggered]
352
+ description:
353
+ type: string
354
+ description: Inputs that should NOT trigger this rule
355
+
356
+ # === Evasion Tests ===
357
+
358
+ evasion_tests:
359
+ type: array
360
+ description: Optional test cases for known evasion/bypass techniques
361
+ items:
362
+ type: object
363
+ properties:
364
+ input:
365
+ type: string
366
+ description: The evasion attempt input
367
+ expected:
368
+ type: string
369
+ description: Expected detection outcome
370
+ bypass_technique:
371
+ type: string
372
+ description: Name or description of the bypass technique used
373
+ notes:
374
+ type: string
375
+ description: Additional notes about the evasion test