agent-threat-rules 3.5.4 → 3.5.6

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 (59) hide show
  1. package/README.md +1 -1
  2. package/dist/engine.d.ts +17 -0
  3. package/dist/engine.d.ts.map +1 -1
  4. package/dist/engine.js +127 -53
  5. package/dist/engine.js.map +1 -1
  6. package/dist/hook-handler.d.ts +25 -1
  7. package/dist/hook-handler.d.ts.map +1 -1
  8. package/dist/hook-handler.js +64 -2
  9. package/dist/hook-handler.js.map +1 -1
  10. package/package.json +4 -3
  11. package/rules/agent-manipulation/ATR-2026-00032-goal-hijacking.yaml +1 -1
  12. package/rules/context-exfiltration/ATR-2026-00201-credential-pipe-exfiltration.yaml +1 -1
  13. package/rules/context-exfiltration/ATR-2026-00524-claude-code-anthropic-base-url-credential-exfil.yaml +1 -1
  14. package/rules/context-exfiltration/ATR-2026-00566-librechat-is-a-chatgpt-clone-with-additi.yaml +1 -1
  15. package/rules/context-exfiltration/ATR-2026-00569-agent-mcp-path-traversal-arbitrary-file-access.yaml +1 -1
  16. package/rules/context-exfiltration/ATR-2026-00571-xss-in-agent-mcp-rendered-output.yaml +1 -1
  17. package/rules/context-exfiltration/ATR-2026-00574-semantic-paraphrased-context-extraction.yaml +1 -1
  18. package/rules/context-exfiltration/ATR-2026-01984-mcp-server-kubernetes-kubectl-generic-token-exfil.yaml +170 -0
  19. package/rules/data-poisoning/ATR-2026-00570-sql-injection-in-agent-tool-query.yaml +1 -1
  20. package/rules/excessive-autonomy/ATR-2026-00051-resource-exhaustion.yaml +1 -1
  21. package/rules/privilege-escalation/ATR-2026-00040-privilege-escalation.yaml +0 -33
  22. package/rules/privilege-escalation/ATR-2026-00111-shell-escape.yaml +19 -11
  23. package/rules/privilege-escalation/ATR-2026-00204-stealth-execution-persistence.yaml +1 -1
  24. package/rules/privilege-escalation/ATR-2026-00539-crewai-codeinterpreter-sandbox-escape-rce.yaml +1 -1
  25. package/rules/privilege-escalation/ATR-2026-00546-crewai-json-loader-local-file-read.yaml +1 -1
  26. package/rules/privilege-escalation/ATR-2026-00547-crewai-rag-url-ssrf-bypass.yaml +1 -1
  27. package/rules/privilege-escalation/ATR-2026-01933-litellm-user-role-privilege-escalation-cve-2026-47102.yaml +160 -0
  28. package/rules/privilege-escalation/ATR-2026-01934-litellm-allowed-routes-authz-bypass-cve-2026-47101.yaml +161 -0
  29. package/rules/privilege-escalation/ATR-2026-01981-network-ai-approval-inbox-unauth-cors-bypass.yaml +152 -0
  30. package/rules/privilege-escalation/ATR-2026-01986-windows-mcp-unauth-http-powershell-cors.yaml +170 -0
  31. package/rules/prompt-injection/ATR-2026-00003-jailbreak-attempt.yaml +1 -1
  32. package/rules/prompt-injection/ATR-2026-00005-multi-turn-injection.yaml +1 -1
  33. package/rules/prompt-injection/ATR-2026-00203-context-pollution-skill-description.yaml +1 -1
  34. package/rules/prompt-injection/ATR-2026-00535-windsurf-ide-zero-click-prompt-injection.yaml +1 -1
  35. package/rules/prompt-injection/ATR-2026-00554-langchain-vulnerable-to-template-injecti.yaml +1 -1
  36. package/rules/prompt-injection/ATR-2026-00565-the-llm-cli-tool-thru-0-27-1-contains-a-.yaml +1 -1
  37. package/rules/prompt-injection/ATR-2026-00573-semantic-paraphrased-injection.yaml +1 -1
  38. package/rules/skill-compromise/ATR-2026-00060-skill-impersonation.yaml +0 -4
  39. package/rules/skill-compromise/ATR-2026-00066-parameter-injection.yaml +2 -2
  40. package/rules/skill-compromise/ATR-2026-00523-claude-code-hooks-session-start-pre-trust-rce.yaml +1 -1
  41. package/rules/tool-poisoning/ATR-2026-00012-unauthorized-tool-call.yaml +3 -3
  42. package/rules/tool-poisoning/ATR-2026-00161-important-tag-cross-tool-shadowing.yaml +4 -3
  43. package/rules/tool-poisoning/ATR-2026-00531-praisonai-unauthenticated-agent-api.yaml +1 -1
  44. package/rules/tool-poisoning/ATR-2026-00532-apache-doris-mcp-sql-injection.yaml +1 -1
  45. package/rules/tool-poisoning/ATR-2026-00533-apache-pinot-mcp-unauthenticated-takeover.yaml +1 -1
  46. package/rules/tool-poisoning/ATR-2026-00534-alibaba-rds-mcp-unauthenticated-metadata-exfil.yaml +1 -1
  47. package/rules/tool-poisoning/ATR-2026-00536-nginx-ui-mcp-unauthenticated-command-execution.yaml +1 -1
  48. package/rules/tool-poisoning/ATR-2026-00561-fastmcp-vulnerable-to-windows-command-in.yaml +1 -1
  49. package/rules/tool-poisoning/ATR-2026-00567-mcp-stdio-config-command-injection.yaml +1 -1
  50. package/rules/tool-poisoning/ATR-2026-00568-agent-ssrf-cloud-metadata-file-inclusion.yaml +1 -1
  51. package/rules/tool-poisoning/ATR-2026-00572-symjack-symlink-config-redirection.yaml +1 -1
  52. package/rules/tool-poisoning/ATR-2026-00581-mcp-tool-rug-pull-post-approval-redefinition.yaml +1 -0
  53. package/rules/tool-poisoning/ATR-2026-01932-shadow-undeclared-mcp-server-registration.yaml +1 -0
  54. package/rules/tool-poisoning/ATR-2026-01935-litellm-custom-code-sandbox-escape-cve-2026-40217.yaml +161 -0
  55. package/rules/tool-poisoning/ATR-2026-01980-agentic-flow-mcp-tool-param-command-injection.yaml +153 -0
  56. package/rules/tool-poisoning/ATR-2026-01982-dbt-mcp-node-selection-argument-injection.yaml +160 -0
  57. package/rules/tool-poisoning/ATR-2026-01983-mcp-for-stata-log-file-name-command-injection.yaml +170 -0
  58. package/rules/tool-poisoning/ATR-2026-01985-mcp-connect-bridge-unauth-process-spawn-rce.yaml +180 -0
  59. package/rules/tool-poisoning/ATR-2026-01987-langroid-sqlchatagent-prompt-to-sql-rce.yaml +165 -0
@@ -18,7 +18,7 @@ author: "ATR Community"
18
18
  date: "2026/05/20"
19
19
  schema_version: "0.1"
20
20
  detection_tier: pattern
21
- maturity: experimental
21
+ maturity: test
22
22
  severity: critical
23
23
 
24
24
  references:
@@ -9,7 +9,7 @@ author: ATR Community (GHSA sync)
9
9
  date: 2026/06/01
10
10
  schema_version: '0.1'
11
11
  detection_tier: pattern
12
- maturity: experimental
12
+ maturity: test
13
13
  severity: high
14
14
  references:
15
15
  cve:
@@ -9,7 +9,7 @@ author: ATR Community (NVD sync)
9
9
  date: 2026/05/30
10
10
  schema_version: '0.1'
11
11
  detection_tier: pattern
12
- maturity: experimental
12
+ maturity: test
13
13
  severity: critical
14
14
  references:
15
15
  cve:
@@ -15,7 +15,7 @@ author: "ATR Community"
15
15
  date: "2026/06/03"
16
16
  schema_version: "0.1"
17
17
  detection_tier: semantic
18
- maturity: "experimental"
18
+ maturity: test
19
19
  severity: high
20
20
 
21
21
  references:
@@ -110,10 +110,6 @@ detection:
110
110
  value: >-
111
111
  (?i)(?:web[-_]?search|google[-_]?search|bing[-_]?search)[-_]?(?:v2|v3|pro|enhanced|premium|fast|turbo|plus|ultra|new)
112
112
  description: Fake enhanced versions of known search tools
113
- - field: tool_name
114
- operator: regex
115
- value: (?i)(?:exec|execute|run|shell)[-_]?(?:cmd|command|script|code)[-_]?(?:safe|secure|sandbox|trusted|verified)?
116
- description: Shell execution tools with deceptive safety suffixes
117
113
  - field: tool_name
118
114
  operator: regex
119
115
  value: >-
@@ -1,6 +1,6 @@
1
1
  title: "Parameter Injection via Tool Arguments"
2
2
  id: ATR-2026-00066
3
- rule_version: 1
3
+ rule_version: 2
4
4
  status: experimental
5
5
  description: >
6
6
  Detects injection attacks delivered through MCP tool arguments. An attacker
@@ -78,7 +78,7 @@ detection:
78
78
  conditions:
79
79
  - field: tool_args
80
80
  operator: regex
81
- value: "(?i)(;|&&|\\|\\||`|\\$\\()\\s*(cat|ls|id|whoami|uname|pwd|env|curl|wget|nc|bash|sh|python)"
81
+ value: "(?i)(;|&&|\\|\\||`|\\$\\()\\s*(whoami|\\bid\\b|uname\\s+-a|curl\\s+(?:-\\S+\\s+)*https?://(?!localhost|127\\.)|wget\\s+https?://(?!localhost|127\\.)|\\bnc\\b\\s|ncat\\s|cat\\s+/etc/(?:passwd|shadow|sudoers)|\\b(?:ba)?sh\\s+-[ic]|python[0-9]?\\s+-c|base64\\s+-d|rm\\s+-[rf])"
82
82
  - field: tool_args
83
83
  operator: regex
84
84
  value: "(?i)('\\s*(OR|AND|UNION)\\s+'|'?\\s*;\\s*(DROP|DELETE|INSERT|UPDATE|ALTER|CREATE)\\s|--\\s*[;\\\"'\\)\\]]|/\\*.*\\*/)"
@@ -25,7 +25,7 @@ author: "ATR Community"
25
25
  date: "2026/05/13"
26
26
  schema_version: "0.1"
27
27
  detection_tier: pattern
28
- maturity: experimental
28
+ maturity: test
29
29
  severity: critical
30
30
 
31
31
  references:
@@ -1,6 +1,6 @@
1
1
  title: Unauthorized Tool Call Detection
2
2
  id: ATR-2026-00012
3
- rule_version: 1
3
+ rule_version: 2
4
4
  status: experimental
5
5
  description: >
6
6
  Detects unauthorized or malicious tool call attempts including parameter injection, path traversal, shell injection in
@@ -74,8 +74,8 @@ detection:
74
74
  - field: tool_args
75
75
  operator: regex
76
76
  value: >-
77
- (;|&&|\|\||\$\(|`|\|\s*\w)\s*.{0,50}(curl|wget|nc|ncat|bash|sh|zsh|python|ruby|perl|node|php|powershell|cmd|eval|exec|system|rm\s+-|cat\s+/etc|whoami|id\b|uname|hostname|ifconfig|ipconfig|net\s+user|net\s+localgroup)
78
- description: Shell metacharacter injection followed by dangerous commands
77
+ (;|&&|\|\|)\s*(?:sudo\s+)?(?:curl\s+(?:-\S+\s+)*['"]?https?://(?!localhost|127\.0\.0\.1|0\.0\.0\.0)|wget\s+(?:-\S+\s+)*['"]?https?://(?!localhost|127\.)|\bnc\b\s+-?[a-z0-9]|ncat\s+\S|\b(?:ba)?sh\s+-[ic]|python[0-9]?\s+-c|perl\s+-e|ruby\s+-e|node\s+-e|\beval\s|rm\s+-[rf]|cat\s+/etc/(?:passwd|shadow|sudoers)|whoami|\bid\b\s*(?:;|&|\||$)|uname\s+-a|base64\s+(?:-d|--decode)|ifconfig|>&\s*/dev/tcp)|[$`]\([^)`]{0,80}(?:curl|wget|\bnc\b|\bbash\b|\bsh\s+-|whoami|\bid\b|base64\s+-d|/etc/(?:passwd|shadow))
78
+ description: Shell metacharacter chained to a genuinely dangerous command — external network fetch, pipe-to-shell / interpreter one-liner, recon (whoami/id/uname -a), or sensitive-file read (v2 tightened; legit build chains like "npm i && bash setup.sh", "&& python -m pytest", "| jq" no longer fire)
79
79
  - field: tool_name
80
80
  operator: regex
81
81
  value: (?i)^(admin_|root_|sudo_|system_|internal_|debug_|maintenance_|privileged_|superuser_|__)
@@ -1,6 +1,6 @@
1
1
  title: "MCP Tool Description — IMPORTANT Tag Cross-Tool Shadowing Attack"
2
2
  id: ATR-2026-00161
3
- rule_version: 1
3
+ rule_version: 2
4
4
  status: experimental
5
5
  description: >
6
6
  Detects MCP tool poisoning attacks that embed hidden instructions inside an
@@ -33,6 +33,7 @@ references:
33
33
  - "AML.T0051.001 - Indirect"
34
34
  - "AML.T0053 - AI Agent Tool Invocation"
35
35
  - "AML.T0110 - AI Agent Tool Poisoning"
36
+ - "AML.T0104 - Publish Poisoned AI Agent Tool"
36
37
  safe_mcp:
37
38
  - "SAFE-T1102 - Prompt Manipulation"
38
39
  - "SAFE-T1001 - Tool Poisoning"
@@ -124,8 +125,8 @@ detection:
124
125
  # variants like $HOME/.ssh/id_rsa, ~/.ssh/id_rsa, /root/.ssh/id_rsa.
125
126
  - field: content
126
127
  operator: regex
127
- value: '\b(?:id_rsa|id_dsa|id_ed25519|id_ecdsa|mcp\.json|\.aws/credentials|\.aws/config|\.kube/config|\.docker/config\.json|\.netrc|known_hosts)\b|/etc/(?:passwd|shadow|ssl/private)|/proc/self/environ|\b\.env(?:\.local|\.production|\.secret)?\b(?![/a-zA-Z])'
128
- description: "Sensitive credential file referenced in tool description — tool signatures should not need to read private keys or cloud credentials"
128
+ value: '\b(?:id_rsa|id_dsa|id_ed25519|id_ecdsa)\b(?!\.pub)|\b(?:\.aws/credentials|\.kube/config|\.docker/config\.json|\.netrc|known_hosts)\b|/etc/(?:passwd|shadow|ssl/private)|/proc/self/environ|\b\.env(?:\.local|\.production|\.secret)?\b(?![/a-zA-Z])'
129
+ description: "Sensitive credential file referenced in tool description — private keys or cloud credentials (v2: dropped mcp.json + .aws/config — common non-secret config files that appear in ordinary git/edit operations; the exfil case is still caught by the <IMPORTANT>-tag and read/send-directive layers. id_rsa excludes the .pub public key.)"
129
130
 
130
131
  # Layer 4 — Concealment directive combined with "implementation detail"
131
132
  # justification. This is the exact pattern Invariant Labs documented for
@@ -16,7 +16,7 @@ author: "ATR Community"
16
16
  date: "2026/05/20"
17
17
  schema_version: "0.1"
18
18
  detection_tier: pattern
19
- maturity: experimental
19
+ maturity: test
20
20
  severity: critical
21
21
 
22
22
  references:
@@ -14,7 +14,7 @@ author: "ATR Community"
14
14
  date: "2026/05/20"
15
15
  schema_version: "0.1"
16
16
  detection_tier: pattern
17
- maturity: experimental
17
+ maturity: test
18
18
  severity: critical
19
19
 
20
20
  references:
@@ -15,7 +15,7 @@ author: "ATR Community"
15
15
  date: "2026/05/20"
16
16
  schema_version: "0.1"
17
17
  detection_tier: pattern
18
- maturity: experimental
18
+ maturity: test
19
19
  severity: critical
20
20
 
21
21
  references:
@@ -17,7 +17,7 @@ author: "ATR Community"
17
17
  date: "2026/05/20"
18
18
  schema_version: "0.1"
19
19
  detection_tier: pattern
20
- maturity: experimental
20
+ maturity: test
21
21
  severity: high
22
22
 
23
23
  references:
@@ -18,7 +18,7 @@ author: "ATR Community"
18
18
  date: "2026/05/20"
19
19
  schema_version: "0.1"
20
20
  detection_tier: pattern
21
- maturity: experimental
21
+ maturity: test
22
22
  severity: critical
23
23
 
24
24
  references:
@@ -9,7 +9,7 @@ author: ATR Community (GHSA sync)
9
9
  date: 2026/06/01
10
10
  schema_version: '0.1'
11
11
  detection_tier: pattern
12
- maturity: experimental
12
+ maturity: test
13
13
  severity: critical
14
14
  references:
15
15
  cve:
@@ -7,7 +7,7 @@ author: ATR Community
7
7
  date: 2026/06/02
8
8
  schema_version: '0.1'
9
9
  detection_tier: pattern
10
- maturity: experimental
10
+ maturity: test
11
11
  severity: high
12
12
  references:
13
13
  cve:
@@ -7,7 +7,7 @@ author: ATR Community
7
7
  date: 2026/06/02
8
8
  schema_version: '0.1'
9
9
  detection_tier: pattern
10
- maturity: experimental
10
+ maturity: test
11
11
  severity: high
12
12
  references:
13
13
  cve:
@@ -24,7 +24,7 @@ author: "ATR Community"
24
24
  date: "2026/06/03"
25
25
  schema_version: "0.1"
26
26
  detection_tier: pattern
27
- maturity: experimental
27
+ maturity: test
28
28
  severity: critical
29
29
  references:
30
30
  owasp_llm:
@@ -29,6 +29,7 @@ references:
29
29
  mitre_atlas:
30
30
  - "AML.T0053 - AI Agent Tool Invocation"
31
31
  - "AML.T0051.001 - Indirect"
32
+ - "AML.T0104 - Publish Poisoned AI Agent Tool"
32
33
  vulnerablemcp_id:
33
34
  - tool-poisoning-rce-rug-pull
34
35
  external:
@@ -29,6 +29,7 @@ references:
29
29
  - "ASI09:2026 - Identity Spoofing and Impersonation"
30
30
  mitre_atlas:
31
31
  - "AML.T0010 - AI Supply Chain Compromise"
32
+ - "AML.T0104 - Publish Poisoned AI Agent Tool"
32
33
  mitre_attack:
33
34
  - "T1195.002 - Compromise Software Supply Chain"
34
35
  - "T1036 - Masquerading"
@@ -0,0 +1,161 @@
1
+ title: "LiteLLM Custom-Code Guardrail Sandbox Escape (CVE-2026-40217)"
2
+ id: ATR-2026-01935
3
+ rule_version: 1
4
+ status: draft
5
+ description: >
6
+ Detects CVE-2026-40217 (CWE-94/CWE-265): LiteLLM's custom-code guardrail
7
+ test/compile path /guardrails/test_custom_code evaluates caller-supplied
8
+ Python in an unsafe sandbox that can be escaped via bytecode rewriting and
9
+ dunder-attribute traversal, yielding server-side code execution as the
10
+ LiteLLM proxy process. Affected through 2026-04-08 builds.
11
+
12
+ Detection covers:
13
+ (a) a request to the /guardrails/test_custom_code endpoint carrying Python
14
+ code-execution primitives (import os, subprocess, exec/eval/compile);
15
+ (b) sandbox-escape primitives (dunder traversal __subclasses__/__globals__/
16
+ __builtins__, code-object/bytecode rewriting) in a guardrail code body;
17
+ (c) explicit CVE-2026-40217 exploitation framing.
18
+
19
+ The detection target is custom guardrail code reaching the test endpoint
20
+ with escape primitives — the exact sandbox-escape shape — caught before the
21
+ proxy compiles and runs it.
22
+ author: "ATR Community"
23
+ date: "2026/06/26"
24
+ schema_version: "0.1"
25
+ detection_tier: pattern
26
+ maturity: test
27
+ severity: critical
28
+
29
+ references:
30
+ owasp_llm:
31
+ - "LLM05:2025 - Improper Output Handling"
32
+ - "LLM06:2025 - Excessive Agency"
33
+ owasp_agentic:
34
+ - "ASI05:2026 - Unexpected Code Execution"
35
+ - "ASI06:2026 - Tool Misuse"
36
+ mitre_atlas:
37
+ - "AML.T0049 - Exploit Public-Facing Application"
38
+ mitre_attack:
39
+ - "T1059.006 - Command and Scripting Interpreter: Python"
40
+ cve:
41
+ - "CVE-2026-40217"
42
+
43
+ metadata_provenance:
44
+ mitre_atlas: human-reviewed
45
+ owasp_llm: human-reviewed
46
+ owasp_agentic: human-reviewed
47
+
48
+ compliance:
49
+ eu_ai_act:
50
+ - article: "15"
51
+ context: >
52
+ CVE-2026-40217 lets a caller escape the LiteLLM custom-code guardrail
53
+ sandbox and run code as the proxy; Article 15 cybersecurity
54
+ requirements mandate that AI guardrail code-evaluation paths refuse
55
+ sandbox-escape primitives.
56
+ strength: primary
57
+ - article: "9"
58
+ context: "Article 9 (risk management system) requires identified risks to be addressed by appropriate measures; this rule is a runtime risk-treatment control that detects the code-execution technique (LiteLLM Custom-Code Guardrail Sandbox Escape (CVE-2026-40217))."
59
+ strength: secondary
60
+ nist_ai_rmf:
61
+ - subcategory: "MP.5.1"
62
+ context: >
63
+ Custom guardrail code carrying sandbox-escape primitives is an
64
+ adversarial input; MP.5.1 requires scanning /guardrails/test_custom_code
65
+ payloads for code-execution and dunder-traversal patterns.
66
+ strength: primary
67
+ - subcategory: "MG.3.2"
68
+ context: "NIST AI RMF MANAGE 3.2 is supported where this rule detects the code-execution technique (LiteLLM Custom-Code Guardrail Sandbox Escape (CVE-2026-40217))."
69
+ strength: secondary
70
+ iso_42001:
71
+ - clause: "8.1"
72
+ context: >
73
+ Operational controls must detect guardrail code-evaluation payloads
74
+ carrying sandbox-escape primitives at the LiteLLM test endpoint before
75
+ the proxy compiles and runs them.
76
+ strength: primary
77
+ - clause: "8.3"
78
+ context: "ISO/IEC 42001 Clause 8.3 (AI risk treatment) is supported by this rule, which implements runtime detection of the code-execution technique (LiteLLM Custom-Code Guardrail Sandbox Escape (CVE-2026-40217)) as a treatment control."
79
+ strength: secondary
80
+
81
+ tags:
82
+ category: tool-poisoning
83
+ subcategory: sandbox-escape
84
+ scan_target: both
85
+ confidence: high
86
+ source: cve-disclosure
87
+ vendor_sources: litellm-cve-2026-40217
88
+
89
+ agent_source:
90
+ type: llm_io
91
+ framework:
92
+ - litellm
93
+ - any
94
+ provider:
95
+ - any
96
+
97
+ detection:
98
+ condition: any
99
+ false_positives:
100
+ - "Security advisory or PR text quoting the CVE-2026-40217 sandbox-escape payload."
101
+ - "A benign custom guardrail that only inspects request text and uses no os/subprocess/exec or dunder traversal."
102
+ - "Documentation describing the /guardrails endpoints without code-execution primitives."
103
+ conditions:
104
+ - field: content
105
+ operator: regex
106
+ value: '(?i)/guardrails/test_custom_code[\s\S]{0,400}(?:import\s+os\b|import\s+subprocess\b|subprocess\.(?:Popen|run|call|check_output)|\bos\.(?:system|popen|exec|spawn)|\bexec\s*\(|\beval\s*\(|\bcompile\s*\()'
107
+ description: >
108
+ A request to /guardrails/test_custom_code carrying Python
109
+ code-execution primitives — direct CVE-2026-40217 attack shape.
110
+ - field: content
111
+ operator: regex
112
+ value: '(?i)(?:test_custom_code|custom[_-]?code[_-]?guardrail)[\s\S]{0,400}(?:__subclasses__|__globals__|__builtins__|__class__\s*\.\s*__|\bco_code\b|types\.CodeType|\.__code__\b|bytecode)'
113
+ description: >
114
+ Custom guardrail code reaching the test path with dunder-traversal or
115
+ bytecode-rewriting sandbox-escape primitives.
116
+ - field: content
117
+ operator: regex
118
+ value: '(?i)CVE-2026-40217[\s\S]{0,200}(?:litellm|guardrail|sandbox|custom[_\s-]?code|bytecode|escape|rce)'
119
+ description: >
120
+ Explicit CVE-2026-40217 reference combined with LiteLLM guardrail
121
+ sandbox-escape language — attack framing in a skill or tool description.
122
+
123
+ response:
124
+ actions:
125
+ - alert
126
+ - block_input
127
+ message_template: >
128
+ [ATR-2026-01935] CRITICAL: LiteLLM custom-code guardrail sandbox escape
129
+ detected (CVE-2026-40217, CWE-94). Custom guardrail code reaches
130
+ /guardrails/test_custom_code with code-execution or sandbox-escape
131
+ primitives, yielding RCE as the proxy. Block the request and upgrade
132
+ LiteLLM to a build after 2026-04-08.
133
+
134
+ confidence: 80
135
+
136
+ wild_fp_rate: 0
137
+
138
+ test_cases:
139
+ true_positives:
140
+ - input: "POST /guardrails/test_custom_code {\"code\": \"import os; os.system('id')\"}"
141
+ expected: triggered
142
+ description: "Custom-code guardrail test payload running os.system"
143
+ - input: "POST /guardrails/test_custom_code {\"code\": \"().__class__.__bases__[0].__subclasses__()\"}"
144
+ expected: triggered
145
+ description: "Dunder-traversal sandbox escape via test_custom_code"
146
+ - input: "CVE-2026-40217: send custom_code guardrail to LiteLLM /guardrails/test_custom_code using bytecode rewriting to escape the sandbox for RCE."
147
+ expected: triggered
148
+ description: "Explicit CVE-2026-40217 LiteLLM sandbox-escape framing"
149
+ true_negatives:
150
+ - input: "POST /guardrails/test_custom_code {\"code\": \"return 'blocked' if 'ssn' in text else 'allow'\"}"
151
+ expected: not_triggered
152
+ description: "Benign guardrail inspecting text, no os/exec/dunder primitives"
153
+ - input: "GET /guardrails/list"
154
+ expected: not_triggered
155
+ description: "Read-only guardrail listing, no custom code"
156
+ - input: "How do custom-code guardrails work in LiteLLM?"
157
+ expected: not_triggered
158
+ description: "General question, no code-execution primitives"
159
+ - input: "import os is a common Python pattern in many legitimate scripts."
160
+ expected: not_triggered
161
+ description: "import os outside the test_custom_code endpoint context"
@@ -0,0 +1,153 @@
1
+ title: "Agentic-Flow MCP Tool-Parameter OS Command Injection (GHSA-vcv2-r9jh-99m5)"
2
+ id: ATR-2026-01980
3
+ rule_version: 1
4
+ status: draft
5
+ description: >
6
+ Detects GHSA-vcv2-r9jh-99m5 (CWE-78): agentic-flow <= 2.0.13 MCP server
7
+ tools (agentic_flow_agent, agentic_flow_create_agent, agent_booster_edit_file,
8
+ agentdb_pattern_store, and related tools under standalone-stdio.ts / fastmcp
9
+ servers) interpolate attacker-influenceable parameters (agent, task, name,
10
+ language, agentdb arguments) directly into shell strings passed to
11
+ execSync(). A parameter value that breaks out of the surrounding
12
+ double-quoted argument executes arbitrary OS commands with the privileges
13
+ of the MCP server process.
14
+
15
+ Detection covers:
16
+ (a) an agentic-flow tool-call argument value containing a double-quote
17
+ breakout followed by shell command chaining (`; `, backticks, or
18
+ `$(...)`) — the exact PoC shape from the advisory
19
+ (task = `x"; touch /tmp/INJECTED; id > /tmp/rce.txt; echo "`);
20
+ (b) the resulting interpolated `npx ... agentic-flow --agent/--task`
21
+ command string itself carrying injected shell metacharacters;
22
+ (c) explicit GHSA-vcv2-r9jh-99m5 exploitation framing.
23
+
24
+ The detection target is the request shape — a quote-breakout + command
25
+ chain inside an agentic-flow tool argument — which is the exact
26
+ command-injection primitive, caught before execSync() hands it to
27
+ /bin/sh -c. Bound to the agentic-flow tool surface so a benign
28
+ shell-looking string elsewhere does not fire.
29
+ author: "ATR Community"
30
+ date: "2026/07/04"
31
+ schema_version: "0.1"
32
+ detection_tier: pattern
33
+ maturity: test
34
+ severity: critical
35
+
36
+ references:
37
+ owasp_llm:
38
+ - "LLM06:2025 - Excessive Agency"
39
+ owasp_agentic:
40
+ - "ASI06:2026 - Tool Misuse"
41
+ mitre_atlas:
42
+ - "AML.T0053 - LLM Plugin Compromise"
43
+ mitre_attack:
44
+ - "T1059 - Command and Scripting Interpreter"
45
+ ghsa:
46
+ - "GHSA-vcv2-r9jh-99m5"
47
+
48
+ metadata_provenance:
49
+ mitre_atlas: human-reviewed
50
+ owasp_llm: human-reviewed
51
+ owasp_agentic: human-reviewed
52
+
53
+ compliance:
54
+ eu_ai_act:
55
+ - { article: "15", context: "Article 15 cybersecurity — runtime detection of agentic-flow MCP tool-parameter OS command injection.", strength: primary }
56
+ - { article: "9", context: "Article 9 risk management — runtime risk-treatment control for agentic-flow MCP tool-parameter OS command injection.", strength: secondary }
57
+ nist_ai_rmf:
58
+ - { subcategory: "MP.5.1", context: "MAP 5.1 — adversarial input characterised/detected for agentic-flow MCP tool-parameter OS command injection.", strength: primary }
59
+ - { subcategory: "MG.3.2", context: "MANAGE 3.2 — runtime monitoring control for agentic-flow MCP tool-parameter OS command injection.", strength: secondary }
60
+ iso_42001:
61
+ - { clause: "8.1", context: "Clause 8.1 operational control — detection of agentic-flow MCP tool-parameter OS command injection payload.", strength: primary }
62
+ - { clause: "8.3", context: "Clause 8.3 AI risk treatment — runtime detection as treatment control.", strength: secondary }
63
+
64
+ tags:
65
+ category: tool-poisoning
66
+ subcategory: command-injection
67
+ scan_target: mcp
68
+ confidence: high
69
+ source: ghsa-disclosure
70
+ vendor_sources: agentic-flow-ghsa-vcv2-r9jh-99m5
71
+
72
+ agent_source:
73
+ type: tool_call
74
+ framework:
75
+ - agentic-flow
76
+ - any
77
+ provider:
78
+ - any
79
+
80
+ detection:
81
+ condition: any
82
+ false_positives:
83
+ - "A tool_args value that legitimately contains a semicolon or backtick as literal text data (e.g. discussing shell syntax) without an adjacent quote-breakout shape."
84
+ - "Security advisory or PR text quoting the GHSA-vcv2-r9jh-99m5 payload for review purposes."
85
+ - "A benign agentic-flow agent/task value with no quote character or shell metacharacter."
86
+ conditions:
87
+ - field: tool_args
88
+ operator: regex
89
+ value: '(?i)\b(?:agent|task|name|language|agentdb)["\x27]?\s*[:=]\s*["\x27][^"\x27\n]{0,200}["\x27]\s*;\s*[\s\S]{0,120}\b(?:touch|rm|curl|wget|cat|id|nc|bash|sh|chmod|echo)\b'
90
+ description: >
91
+ agentic-flow tool argument (agent/task/name/language/agentdb) whose
92
+ value breaks out of its quote with `";` followed by a chained shell
93
+ command — the canonical GHSA-vcv2-r9jh-99m5 PoC shape.
94
+ - field: tool_args
95
+ operator: regex
96
+ value: '(?i)npx\s+--yes\s+agentic-flow[\s\S]{0,80}--(?:agent|task)\s+"[^"\n]{0,200}"\s*;\s*[\s\S]{0,120}\b(?:touch|rm|curl|wget|cat|id|nc|bash|sh|chmod)\b'
97
+ description: >
98
+ The interpolated `npx --yes agentic-flow --agent/--task` command
99
+ string itself carrying an injected chained shell command after the
100
+ closing quote — the post-interpolation execSync() payload.
101
+ - field: tool_args
102
+ operator: regex
103
+ value: '(?i)["\x27][^"\x27\n]{0,200}["\x27]\s*;[\s\S]{0,80}`[^`\n]{0,120}`|["\x27][^"\x27\n]{0,200}["\x27]\s*;[\s\S]{0,80}\$\([^)\n]{0,120}\)'
104
+ description: >
105
+ Quote-breakout followed by a backtick or $() command substitution
106
+ inside an agentic-flow tool argument.
107
+ - field: content
108
+ operator: regex
109
+ value: '(?i)GHSA-vcv2-r9jh-99m5[\s\S]{0,200}(?:agentic-flow|execSync|command\s*inject|RCE)'
110
+ description: >
111
+ Explicit GHSA-vcv2-r9jh-99m5 reference combined with agentic-flow
112
+ command-injection language — attack framing in a skill or tool
113
+ description.
114
+
115
+ response:
116
+ actions:
117
+ - alert
118
+ - block_tool
119
+ message_template: >
120
+ [ATR-2026-01980] CRITICAL: Agentic-Flow MCP tool-parameter OS command
121
+ injection detected (GHSA-vcv2-r9jh-99m5, CWE-78). A tool argument breaks
122
+ out of its shell quote and chains a command; agentic-flow <= 2.0.13
123
+ interpolates this into execSync() unsanitized. Block the tool call and
124
+ upgrade agentic-flow to >= 2.0.14.
125
+
126
+ confidence: 85
127
+
128
+ wild_fp_rate: 0
129
+
130
+ test_cases:
131
+ true_positives:
132
+ - tool_args: 'task="x\"; touch /tmp/INJECTED; id > /tmp/rce.txt; echo \""'
133
+ expected: triggered
134
+ description: "Canonical PoC: task param quote-breakout chaining touch+id+echo"
135
+ - tool_args: 'npx --yes agentic-flow --agent "coder" --task "x"; touch /tmp/INJECTED; id > /tmp/rce.txt; echo ""'
136
+ expected: triggered
137
+ description: "Post-interpolation execSync() command string with injected chain"
138
+ - tool_description: "Exploiting GHSA-vcv2-r9jh-99m5 in agentic-flow: craft a task value that breaks the execSync quoting for command injection RCE."
139
+ expected: triggered
140
+ description: "Explicit GHSA-vcv2-r9jh-99m5 agentic-flow exploitation framing"
141
+ true_negatives:
142
+ - tool_args: 'agent="coder", task="Refactor the login handler to use async/await"'
143
+ expected: not_triggered
144
+ description: "Legitimate agentic-flow task description, no quote-breakout"
145
+ - content: "How do I configure the agentic-flow MCP server's agent and task parameters?"
146
+ expected: not_triggered
147
+ description: "Benign question about agentic-flow configuration"
148
+ - tool_args: 'name="release-notes", language="typescript"'
149
+ expected: not_triggered
150
+ description: "Normal name/language params with no shell metacharacters"
151
+ - tool_args: 'agentdb_pattern_search query="find all functions that touch the user; audit them"'
152
+ expected: not_triggered
153
+ description: "Benign text containing the word touch and a semicolon in natural language, no quote-breakout or dangerous command token"