@gendigital/sage-opencode 0.11.0 → 0.13.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 (44) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +255 -74
  4. package/dist/index.js.map +1 -1
  5. package/dist/mcp-server.cjs +230 -96
  6. package/dist/mcp-server.cjs.map +4 -4
  7. package/dist/plugin-discovery.d.ts +1 -0
  8. package/dist/plugin-discovery.d.ts.map +1 -1
  9. package/dist/plugin-discovery.js +27 -1
  10. package/dist/plugin-discovery.js.map +1 -1
  11. package/dist/startup-scan.d.ts +11 -3
  12. package/dist/startup-scan.d.ts.map +1 -1
  13. package/dist/startup-scan.js +59 -21
  14. package/dist/startup-scan.js.map +1 -1
  15. package/dist/tool-handler.d.ts +2 -1
  16. package/dist/tool-handler.d.ts.map +1 -1
  17. package/dist/tool-handler.js +17 -4
  18. package/dist/tool-handler.js.map +1 -1
  19. package/package.json +3 -3
  20. package/resources/threats/_macros.yaml +193 -0
  21. package/resources/threats/agent-layer.yaml +19 -1
  22. package/resources/threats/commands.yaml +165 -31
  23. package/resources/threats/credentials.yaml +24 -4
  24. package/resources/threats/dummy.yaml +52 -17
  25. package/resources/threats/files.yaml +38 -0
  26. package/resources/threats/mac-commands.yaml +118 -27
  27. package/resources/threats/mac-credentials.yaml +34 -8
  28. package/resources/threats/mac-files.yaml +20 -0
  29. package/resources/threats/mac-obfuscation.yaml +28 -6
  30. package/resources/threats/mac-persistence.yaml +30 -4
  31. package/resources/threats/mac-supply-chain.yaml +12 -3
  32. package/resources/threats/mitre.yaml +325 -62
  33. package/resources/threats/obfuscation.yaml +33 -8
  34. package/resources/threats/persistence.yaml +40 -5
  35. package/resources/threats/prompt-injection.yaml +58 -0
  36. package/resources/threats/self-defense.yaml +15 -2
  37. package/resources/threats/supply_chain.yaml +6 -1
  38. package/resources/threats/urls.yaml +10 -0
  39. package/resources/threats/win-commands.yaml +294 -60
  40. package/resources/threats/win-credentials.yaml +68 -9
  41. package/resources/threats/win-files.yaml +20 -0
  42. package/resources/threats/win-obfuscation.yaml +56 -8
  43. package/resources/threats/win-persistence.yaml +45 -7
  44. package/resources/threats/win-supply-chain.yaml +5 -1
@@ -7,10 +7,14 @@
7
7
 
8
8
  # Pipe to IEX: irm url | iex, iwr url | iex, curl url | iex, Invoke-WebRequest url | Invoke-Expression
9
9
  - id: "CLT-WIN-CMD-001"
10
+ version: 1
11
+ detection_name: "CMD:SageWindowsCommand-A [Heur]"
10
12
  category: tool
11
13
  severity: critical
12
14
  confidence: 0.95
13
- pattern: "\\b([Ii][Rr][Mm]|[Ii][Ww][Rr]|curl|wget|[Ii]nvoke-[Ww]eb[Rr]equest|[Ii]nvoke-[Rr]est[Mm]ethod)\\b.*\\|\\s*([Ii][Ee][Xx]|[Ii]nvoke-[Ee]xpression)\\b"
15
+ # {{CMD_POS}} + {{NOT_FILENAME}} on both sides of the pipe, same shape as
16
+ # CLT-CMD-009.
17
+ pattern: "{{CMD_POS}}([Ii][Rr][Mm]|[Ii][Ww][Rr]|curl(?:\\.exe)?|wget(?:\\.exe)?|[Ii]nvoke-[Ww]eb[Rr]equest|[Ii]nvoke-[Rr]est[Mm]ethod){{NOT_FILENAME}}.*\\|\\s*([Ii][Ee][Xx]|[Ii]nvoke-[Ee]xpression){{NOT_FILENAME}}"
14
18
  match_on: command
15
19
  title: "PowerShell download piped to Invoke-Expression"
16
20
  expires_at: null
@@ -18,10 +22,15 @@
18
22
 
19
23
  # IEX wrapping download: iex(irm url), IEX((New-Object Net.WebClient).DownloadString(url))
20
24
  - id: "CLT-WIN-CMD-002"
25
+ version: 1
26
+ detection_name: "CMD:SageWindowsCommand-B [Heur]"
21
27
  category: tool
22
28
  severity: critical
23
29
  confidence: 0.95
24
- pattern: "\\b([Ii][Ee][Xx]|[Ii]nvoke-[Ee]xpression)\\s*\\(?\\s*\\(?\\s*(\\b([Ii][Rr][Mm]|[Ii][Ww][Rr])\\b|[Nn]ew-[Oo]bject|[Ii]nvoke-[Ww]eb[Rr]equest|[Ii]nvoke-[Rr]est[Mm]ethod)"
30
+ # {{CMD_POS}} + {{NOT_FILENAME}} on the outer IEX call, same shape as
31
+ # CLT-CMD-009. The inner group is an argument inside IEX's own parens, not
32
+ # itself a program name, so it's left as-is.
33
+ pattern: "{{CMD_POS}}([Ii][Ee][Xx]|[Ii]nvoke-[Ee]xpression){{NOT_FILENAME}}\\s*\\(?\\s*\\(?\\s*(\\b([Ii][Rr][Mm]|[Ii][Ww][Rr])\\b|[Nn]ew-[Oo]bject|[Ii]nvoke-[Ww]eb[Rr]equest|[Ii]nvoke-[Rr]est[Mm]ethod)"
25
34
  match_on: command
26
35
  title: "Invoke-Expression wrapping remote download"
27
36
  expires_at: null
@@ -29,10 +38,14 @@
29
38
 
30
39
  # Start-Process with executable
31
40
  - id: "CLT-WIN-CMD-003"
41
+ version: 1
42
+ detection_name: "CMD:SageWindowsCommand-C [Heur]"
32
43
  category: tool
33
44
  severity: warning
34
45
  confidence: 0.60
35
- pattern: "[Ss]tart-[Pp]rocess.*-[Ff]ile[Pp]ath.*\\.(exe|bat|cmd|ps1)"
46
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009. Had no
47
+ # boundary at all.
48
+ pattern: "{{CMD_POS}}[Ss]tart-[Pp]rocess{{NOT_FILENAME}}.*-[Ff]ile[Pp]ath.*\\.(exe|bat|cmd|ps1)"
36
49
  match_on: command
37
50
  title: "Start-Process launching executable file"
38
51
  expires_at: null
@@ -40,10 +53,13 @@
40
53
 
41
54
  # Download to file then chain-execute: curl -o install.cmd url && install.cmd
42
55
  - id: "CLT-WIN-CMD-004"
56
+ version: 1
57
+ detection_name: "CMD:SageWindowsCommand-D [Heur]"
43
58
  category: tool
44
59
  severity: critical
45
60
  confidence: 0.90
46
- pattern: "\\b(curl|wget|[Ii][Rr][Mm]|[Ii][Ww][Rr]|[Ii]nvoke-[Ww]eb[Rr]equest|[Ii]nvoke-[Rr]est[Mm]ethod)\\b[^|]*(-[Oo]\\w*\\s+|-[Oo]ut[Ff]ile\\s+)\\S+\\.(cmd|bat|ps1|exe|msi).*(&&|;)"
61
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
62
+ pattern: "{{CMD_POS}}(curl(?:\\.exe)?|wget(?:\\.exe)?|[Ii][Rr][Mm]|[Ii][Ww][Rr]|[Ii]nvoke-[Ww]eb[Rr]equest|[Ii]nvoke-[Rr]est[Mm]ethod){{NOT_FILENAME}}[^|]*(-[Oo]\\w*\\s+|-[Oo]ut[Ff]ile\\s+)\\S+\\.(cmd|bat|ps1|exe|msi).*(&&|;)"
47
63
  match_on: command
48
64
  title: "Download file then chain-execute"
49
65
  expires_at: null
@@ -51,10 +67,14 @@
51
67
 
52
68
  # .NET WebClient download
53
69
  - id: "CLT-WIN-CMD-005"
70
+ version: 1
71
+ detection_name: "CMD:SageWindowsCommand-E [Heur]"
54
72
  category: tool
55
73
  severity: critical
56
74
  confidence: 0.90
57
- pattern: "[Nn]ew-[Oo]bject\\s+[Nn]et\\.[Ww]eb[Cc]lient.*[Dd]ownload(String|File)"
75
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009. Had no
76
+ # boundary at all.
77
+ pattern: "{{CMD_POS}}[Nn]ew-[Oo]bject{{NOT_FILENAME}}\\s+[Nn]et\\.[Ww]eb[Cc]lient.*[Dd]ownload(String|File)"
58
78
  match_on: command
59
79
  title: ".NET WebClient download (DownloadString/DownloadFile)"
60
80
  expires_at: null
@@ -62,10 +82,14 @@
62
82
 
63
83
  # Start-BitsTransfer cmdlet
64
84
  - id: "CLT-WIN-CMD-006"
85
+ version: 1
86
+ detection_name: "CMD:SageWindowsCommand-F [Heur]"
65
87
  category: tool
66
88
  severity: warning
67
89
  confidence: 0.60
68
- pattern: "[Ss]tart-[Bb]its[Tt]ransfer"
90
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009. Had no
91
+ # boundary at all.
92
+ pattern: "{{CMD_POS}}[Ss]tart-[Bb]its[Tt]ransfer{{NOT_FILENAME}}"
69
93
  match_on: command
70
94
  title: "PowerShell BITS transfer download"
71
95
  expires_at: null
@@ -75,10 +99,14 @@
75
99
 
76
100
  # certutil download/decode
77
101
  - id: "CLT-WIN-CMD-007"
102
+ version: 1
103
+ detection_name: "CMD:SageWindowsCommand-G [Heur]"
78
104
  category: tool
79
105
  severity: critical
80
106
  confidence: 0.95
81
- pattern: "[Cc][Ee][Rr][Tt][Uu][Tt][Ii][Ll].*(-urlcache|-split|-decode)"
107
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009. Had no
108
+ # boundary at all.
109
+ pattern: "{{CMD_POS}}[Cc][Ee][Rr][Tt][Uu][Tt][Ii][Ll](?:\\.exe)?{{NOT_FILENAME}}.*(-urlcache|-split|-decode)"
82
110
  match_on: command
83
111
  title: "certutil used for download or decode (LOLBin)"
84
112
  expires_at: null
@@ -86,10 +114,14 @@
86
114
 
87
115
  # bitsadmin transfer
88
116
  - id: "CLT-WIN-CMD-008"
117
+ version: 1
118
+ detection_name: "CMD:SageWindowsCommand-H [Heur]"
89
119
  category: tool
90
120
  severity: critical
91
121
  confidence: 0.90
92
- pattern: "[Bb][Ii][Tt][Ss][Aa][Dd][Mm][Ii][Nn].*/transfer"
122
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009. Had no
123
+ # boundary at all.
124
+ pattern: "{{CMD_POS}}[Bb][Ii][Tt][Ss][Aa][Dd][Mm][Ii][Nn](?:\\.exe)?{{NOT_FILENAME}}.*/transfer"
93
125
  match_on: command
94
126
  title: "bitsadmin file transfer (LOLBin)"
95
127
  expires_at: null
@@ -97,10 +129,14 @@
97
129
 
98
130
  # mshta remote HTA execution
99
131
  - id: "CLT-WIN-CMD-009"
132
+ version: 1
133
+ detection_name: "CMD:SageWindowsCommand-I [Heur]"
100
134
  category: tool
101
135
  severity: critical
102
136
  confidence: 0.90
103
- pattern: "[Mm][Ss][Hh][Tt][Aa]\\s+.*https?://"
137
+ # {{CMD_POS}} + {{NOT_FILENAME}} (with optional `.exe` suffix), same shape
138
+ # as CLT-MITRE-096. Had no boundary at all.
139
+ pattern: "{{CMD_POS}}[Mm][Ss][Hh][Tt][Aa](?:\\.exe)?{{NOT_FILENAME}}\\s+.*https?://"
104
140
  match_on: command
105
141
  title: "mshta executing remote HTA file (LOLBin)"
106
142
  expires_at: null
@@ -108,10 +144,14 @@
108
144
 
109
145
  # regsvr32 scriptlet loading
110
146
  - id: "CLT-WIN-CMD-010"
147
+ version: 1
148
+ detection_name: "CMD:SageWindowsCommand-J [Heur]"
111
149
  category: tool
112
150
  severity: critical
113
151
  confidence: 0.90
114
- pattern: "[Rr][Ee][Gg][Ss][Vv][Rr]32.*/[SsIi].*\\.(dll|sct)"
152
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009. Had no
153
+ # boundary at all.
154
+ pattern: "{{CMD_POS}}[Rr][Ee][Gg][Ss][Vv][Rr]32(?:\\.exe)?{{NOT_FILENAME}}.*/[SsIi].*\\.(dll|sct)"
115
155
  match_on: command
116
156
  title: "regsvr32 loading DLL/scriptlet (LOLBin)"
117
157
  expires_at: null
@@ -119,10 +159,14 @@
119
159
 
120
160
  # rundll32 javascript execution
121
161
  - id: "CLT-WIN-CMD-011"
162
+ version: 1
163
+ detection_name: "CMD:SageWindowsCommand-K [Heur]"
122
164
  category: tool
123
165
  severity: critical
124
166
  confidence: 0.90
125
- pattern: "[Rr][Uu][Nn][Dd][Ll][Ll]32.*javascript:"
167
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009. Had no
168
+ # boundary at all.
169
+ pattern: "{{CMD_POS}}[Rr][Uu][Nn][Dd][Ll][Ll]32(?:\\.exe)?{{NOT_FILENAME}}.*javascript:"
126
170
  match_on: command
127
171
  title: "rundll32 executing JavaScript (LOLBin)"
128
172
  expires_at: null
@@ -130,10 +174,14 @@
130
174
 
131
175
  # cmstp INF install (UAC bypass)
132
176
  - id: "CLT-WIN-CMD-012"
177
+ version: 1
178
+ detection_name: "CMD:SageWindowsCommand-L [Heur]"
133
179
  category: tool
134
180
  severity: warning
135
181
  confidence: 0.85
136
- pattern: "[Cc][Mm][Ss][Tt][Pp].*/[AaUuSs].*\\.inf"
182
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009. Had no
183
+ # boundary at all.
184
+ pattern: "{{CMD_POS}}[Cc][Mm][Ss][Tt][Pp](?:\\.exe)?{{NOT_FILENAME}}.*/[AaUuSs].*\\.inf"
137
185
  match_on: command
138
186
  title: "cmstp INF install (UAC bypass LOLBin)"
139
187
  expires_at: null
@@ -141,10 +189,13 @@
141
189
 
142
190
  # wmic process create
143
191
  - id: "CLT-WIN-CMD-013"
192
+ version: 1
193
+ detection_name: "CMD:SageWindowsCommand-M [Heur]"
144
194
  category: tool
145
195
  severity: critical
146
196
  confidence: 0.90
147
- pattern: "\\b[Ww][Mm][Ii][Cc]\\b.*\\bprocess\\s+call\\s+create\\b"
197
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
198
+ pattern: "{{CMD_POS}}[Ww][Mm][Ii][Cc](?:\\.exe)?{{NOT_FILENAME}}.*\\bprocess\\s+call\\s+create\\b"
148
199
  match_on: command
149
200
  title: "wmic process call create (LOLBin)"
150
201
  expires_at: null
@@ -152,10 +203,13 @@
152
203
 
153
204
  # msiexec remote install
154
205
  - id: "CLT-WIN-CMD-014"
206
+ version: 1
207
+ detection_name: "CMD:SageWindowsCommand-N [Heur]"
155
208
  category: tool
156
209
  severity: critical
157
210
  confidence: 0.90
158
- pattern: "\\b[Mm][Ss][Ii][Ee][Xx][Ee][Cc]\\b.*/[QqIi].*https?://"
211
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
212
+ pattern: "{{CMD_POS}}[Mm][Ss][Ii][Ee][Xx][Ee][Cc](?:\\.exe)?{{NOT_FILENAME}}.*/[QqIi].*https?://"
159
213
  match_on: command
160
214
  title: "msiexec remote MSI install (LOLBin)"
161
215
  expires_at: null
@@ -163,10 +217,13 @@
163
217
 
164
218
  # forfiles command execution
165
219
  - id: "CLT-WIN-CMD-015"
220
+ version: 1
221
+ detection_name: "CMD:SageWindowsCommand-O [Heur]"
166
222
  category: tool
167
223
  severity: warning
168
224
  confidence: 0.85
169
- pattern: "\\b[Ff][Oo][Rr][Ff][Ii][Ll][Ee][Ss]\\b.*/[Cc].*\\b(cmd|powershell)\\b"
225
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
226
+ pattern: "{{CMD_POS}}[Ff][Oo][Rr][Ff][Ii][Ll][Ee][Ss](?:\\.exe)?{{NOT_FILENAME}}.*/[Cc].*\\b(cmd|powershell)\\b"
170
227
  match_on: command
171
228
  title: "forfiles dispatching cmd/powershell (LOLBin)"
172
229
  expires_at: null
@@ -174,10 +231,13 @@
174
231
 
175
232
  # pcalua execution
176
233
  - id: "CLT-WIN-CMD-016"
234
+ version: 1
235
+ detection_name: "CMD:SageWindowsCommand-P [Heur]"
177
236
  category: tool
178
237
  severity: warning
179
238
  confidence: 0.85
180
- pattern: "\\b[Pp][Cc][Aa][Ll][Uu][Aa]\\b.*-a.*\\.(exe|dll)"
239
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
240
+ pattern: "{{CMD_POS}}[Pp][Cc][Aa][Ll][Uu][Aa](?:\\.exe)?{{NOT_FILENAME}}.*-a.*\\.(exe|dll)"
181
241
  match_on: command
182
242
  title: "pcalua executing binary (LOLBin)"
183
243
  expires_at: null
@@ -185,10 +245,13 @@
185
245
 
186
246
  # installutil abuse
187
247
  - id: "CLT-WIN-CMD-017"
248
+ version: 1
249
+ detection_name: "CMD:SageWindowsCommand-Q [Heur]"
188
250
  category: tool
189
251
  severity: warning
190
252
  confidence: 0.85
191
- pattern: "\\b[Ii]nstall[Uu]til\\b.*/[Ll]og[Ff]ile="
253
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
254
+ pattern: "{{CMD_POS}}[Ii]nstall[Uu]til(?:\\.exe)?{{NOT_FILENAME}}.*/[Ll]og[Ff]ile="
192
255
  match_on: command
193
256
  title: "installutil .NET execution (LOLBin)"
194
257
  expires_at: null
@@ -196,10 +259,14 @@
196
259
 
197
260
  # regasm/regsvcs
198
261
  - id: "CLT-WIN-CMD-018"
262
+ version: 1
263
+ detection_name: "CMD:SageWindowsCommand-R [Heur]"
199
264
  category: tool
200
265
  severity: warning
201
266
  confidence: 0.85
202
- pattern: "\\b[Rr]eg[Aa]sm\\b.*/[Uu]|\\b[Rr]eg[Ss]vcs\\b"
267
+ # {{CMD_POS}} + {{NOT_FILENAME}} on each alternative, same shape as
268
+ # CLT-CMD-009.
269
+ pattern: "{{CMD_POS}}[Rr]eg[Aa]sm(?:\\.exe)?{{NOT_FILENAME}}.*/[Uu]|{{CMD_POS}}[Rr]eg[Ss]vcs(?:\\.exe)?{{NOT_FILENAME}}"
203
270
  match_on: command
204
271
  title: "regasm/regsvcs .NET assembly execution (LOLBin)"
205
272
  expires_at: null
@@ -209,10 +276,13 @@
209
276
 
210
277
  # format drive
211
278
  - id: "CLT-WIN-CMD-019"
279
+ version: 1
280
+ detection_name: "CMD:SageWindowsCommand-S [Heur]"
212
281
  category: tool
213
282
  severity: critical
214
283
  confidence: 0.95
215
- pattern: "\\b[Ff][Oo][Rr][Mm][Aa][Tt]\\s+[A-Za-z]:"
284
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
285
+ pattern: "{{CMD_POS}}[Ff][Oo][Rr][Mm][Aa][Tt](?:\\.exe)?{{NOT_FILENAME}}\\s+[A-Za-z]:"
216
286
  match_on: command
217
287
  title: "Format drive command"
218
288
  expires_at: null
@@ -220,10 +290,13 @@
220
290
 
221
291
  # rd /s /q recursive delete
222
292
  - id: "CLT-WIN-CMD-020"
293
+ version: 1
294
+ detection_name: "CMD:SageWindowsCommand-T [Heur]"
223
295
  category: tool
224
296
  severity: critical
225
297
  confidence: 0.95
226
- pattern: "\\b(rd|rmdir)\\b\\s+/[Ss]\\s+/[Qq]\\s+[A-Za-z]:\\\\"
298
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
299
+ pattern: "{{CMD_POS}}(rd|rmdir)(?:\\.exe)?{{NOT_FILENAME}}\\s+/[Ss]\\s+/[Qq]\\s+[A-Za-z]:\\\\"
227
300
  match_on: command
228
301
  title: "Recursive forced deletion from drive root"
229
302
  expires_at: null
@@ -231,10 +304,13 @@
231
304
 
232
305
  # del /f /s /q force delete
233
306
  - id: "CLT-WIN-CMD-021"
307
+ version: 1
308
+ detection_name: "CMD:SageWindowsCommand-U [Heur]"
234
309
  category: tool
235
310
  severity: critical
236
311
  confidence: 0.95
237
- pattern: "\\b[Dd][Ee][Ll]\\b\\s+/[Ff].*\\s+/[Ss].*\\s+[A-Za-z]:\\\\"
312
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
313
+ pattern: "{{CMD_POS}}[Dd][Ee][Ll](?:\\.exe)?{{NOT_FILENAME}}\\s+/[Ff].*\\s+/[Ss].*\\s+[A-Za-z]:\\\\"
238
314
  match_on: command
239
315
  title: "Force delete all files from drive root"
240
316
  expires_at: null
@@ -242,10 +318,18 @@
242
318
 
243
319
  # diskpart
244
320
  - id: "CLT-WIN-CMD-022"
321
+ version: 1
322
+ detection_name: "CMD:SageWindowsCommand-V [Heur]"
245
323
  category: tool
246
324
  severity: critical
247
325
  confidence: 0.95
248
- pattern: "\\bdiskpart\\b"
326
+ # {{CMD_POS}}, same shape as CLT-CMD-009. No {{HAS_ARG}}: a bare `diskpart`
327
+ # invocation opens its interactive prompt, which is itself the dangerous
328
+ # case, so a bare mention must still fire. The `.exe` suffix is allowlisted
329
+ # ahead of {{NOT_FILENAME}}'s trailing-dot guard, since `diskpart.exe` is
330
+ # the real Windows invocation, not a filename.
331
+ pattern: "{{CMD_POS}}diskpart(?:\\.exe)?{{NOT_FILENAME}}"
332
+ case_insensitive: true
249
333
  match_on: command
250
334
  title: "diskpart disk partition manipulation"
251
335
  expires_at: null
@@ -255,10 +339,14 @@
255
339
 
256
340
  # PowerShell TCP reverse shell
257
341
  - id: "CLT-WIN-CMD-023"
342
+ version: 1
343
+ detection_name: "CMD:SageWindowsCommand-W [Heur]"
258
344
  category: tool
259
345
  severity: critical
260
346
  confidence: 0.90
261
- pattern: "[Nn]ew-[Oo]bject\\s+[Ss]ystem\\.[Nn]et\\.[Ss]ockets\\.[Tt][Cc][Pp][Cc]lient"
347
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-WIN-CMD-005. Had no
348
+ # boundary at all.
349
+ pattern: "{{CMD_POS}}[Nn]ew-[Oo]bject{{NOT_FILENAME}}\\s+[Ss]ystem\\.[Nn]et\\.[Ss]ockets\\.[Tt][Cc][Pp][Cc]lient"
262
350
  match_on: command
263
351
  title: "PowerShell TCP reverse shell via .NET socket"
264
352
  expires_at: null
@@ -266,10 +354,13 @@
266
354
 
267
355
  # PowerShell UDP reverse shell
268
356
  - id: "CLT-WIN-CMD-024"
357
+ version: 1
358
+ detection_name: "CMD:SageWindowsCommand-X [Heur]"
269
359
  category: tool
270
360
  severity: critical
271
361
  confidence: 0.90
272
- pattern: "[Nn]ew-[Oo]bject\\s+[Ss]ystem\\.[Nn]et\\.[Ss]ockets\\.[Uu][Dd][Pp][Cc]lient"
362
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-WIN-CMD-005.
363
+ pattern: "{{CMD_POS}}[Nn]ew-[Oo]bject{{NOT_FILENAME}}\\s+[Ss]ystem\\.[Nn]et\\.[Ss]ockets\\.[Uu][Dd][Pp][Cc]lient"
273
364
  match_on: command
274
365
  title: "PowerShell UDP reverse shell via .NET socket"
275
366
  expires_at: null
@@ -279,10 +370,13 @@
279
370
 
280
371
  # runas
281
372
  - id: "CLT-WIN-CMD-025"
373
+ version: 1
374
+ detection_name: "CMD:SageWindowsCommand-Y [Heur]"
282
375
  category: tool
283
376
  severity: warning
284
377
  confidence: 0.60
285
- pattern: "\\b[Rr][Uu][Nn][Aa][Ss]\\s+/user:"
378
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
379
+ pattern: "{{CMD_POS}}[Rr][Uu][Nn][Aa][Ss](?:\\.exe)?{{NOT_FILENAME}}\\s+/user:"
286
380
  match_on: command
287
381
  title: "runas with alternate user credentials"
288
382
  expires_at: null
@@ -290,10 +384,14 @@
290
384
 
291
385
  # Set-ExecutionPolicy Bypass/Unrestricted
292
386
  - id: "CLT-WIN-CMD-026"
387
+ version: 1
388
+ detection_name: "CMD:SageWindowsCommand-Z [Heur]"
293
389
  category: tool
294
390
  severity: warning
295
391
  confidence: 0.60
296
- pattern: "[Ss]et-[Ee]xecution[Pp]olicy\\s+([Bb]ypass|[Uu]nrestricted)"
392
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009. Had no
393
+ # boundary at all.
394
+ pattern: "{{CMD_POS}}[Ss]et-[Ee]xecution[Pp]olicy{{NOT_FILENAME}}\\s+([Bb]ypass|[Uu]nrestricted)"
297
395
  match_on: command
298
396
  title: "Disabling PowerShell execution policy"
299
397
  expires_at: null
@@ -301,10 +399,16 @@
301
399
 
302
400
  # fodhelper UAC bypass
303
401
  - id: "CLT-WIN-CMD-027"
402
+ version: 1
403
+ detection_name: "CMD:SageWindowsCommand-AA [Heur]"
304
404
  category: tool
305
405
  severity: warning
306
406
  confidence: 0.80
307
- pattern: "\\b[Ff]od[Hh]elper\\b"
407
+ # {{CMD_POS}} + {{NOT_FILENAME}} (with optional `.exe` suffix), same shape
408
+ # as CLT-MITRE-096. No {{HAS_ARG}}: a bare `fodhelper` invocation is
409
+ # itself the UAC-bypass technique (it triggers a hijacked registry key
410
+ # with no arguments needed), same reasoning as CLT-WIN-CMD-022 (diskpart).
411
+ pattern: "{{CMD_POS}}[Ff]od[Hh]elper(?:\\.exe)?{{NOT_FILENAME}}"
308
412
  match_on: command
309
413
  title: "fodhelper.exe UAC bypass"
310
414
  expires_at: null
@@ -314,10 +418,13 @@
314
418
 
315
419
  # Remove-Item -Recurse -Force
316
420
  - id: "CLT-WIN-CMD-028"
421
+ version: 1
422
+ detection_name: "CMD:SageWindowsCommand-AB [Heur]"
317
423
  category: tool
318
424
  severity: critical
319
425
  confidence: 0.90
320
- pattern: "\\bRemove-Item\\b(?=[^;&|#\\r\\n]*\\s-(?:Recurse|r)\\b)(?=[^;&|#\\r\\n]*\\s-(?:Force|f)\\b)[^;&|#\\r\\n]*?(?:[A-Za-z]:\\\\(?:Windows|ProgramData|Users\\\\Public|Program Files(?: \\(x86\\))?)(?=\\\\|\\s|[\"']|$)|(?:\\$env:(?:SystemRoot|ProgramData|windir)|\\$\\{env:(?:SystemRoot|ProgramData|windir)\\})(?=\\\\|\\s|[\"']|$))"
426
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
427
+ pattern: "{{CMD_POS}}Remove-Item{{NOT_FILENAME}}(?=[^;&|#\\r\\n]*\\s-(?:Recurse|r)\\b)(?=[^;&|#\\r\\n]*\\s-(?:Force|f)\\b)[^;&|#\\r\\n]*?(?:[A-Za-z]:\\\\(?:Windows|ProgramData|Users\\\\Public|Program Files(?: \\(x86\\))?)(?=\\\\|\\s|[\"']|$)|(?:\\$env:(?:SystemRoot|ProgramData|windir)|\\$\\{env:(?:SystemRoot|ProgramData|windir)\\})(?=\\\\|\\s|[\"']|$))"
321
428
  case_insensitive: true
322
429
  match_on: command
323
430
  title: "PowerShell recursive forced deletion (Remove-Item -Recurse -Force)"
@@ -326,10 +433,13 @@
326
433
 
327
434
  # Clear-RecycleBin -Force
328
435
  - id: "CLT-WIN-CMD-029"
436
+ version: 1
437
+ detection_name: "CMD:SageWindowsCommand-AC [Heur]"
329
438
  category: tool
330
439
  severity: warning
331
440
  confidence: 0.60
332
- pattern: "\\bClear-RecycleBin\\b.*-Force"
441
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
442
+ pattern: "{{CMD_POS}}Clear-RecycleBin{{NOT_FILENAME}}.*-Force"
333
443
  match_on: command
334
444
  title: "PowerShell destructive recycle bin cleanup"
335
445
  expires_at: null
@@ -339,10 +449,13 @@
339
449
 
340
450
  # ncat reverse shell
341
451
  - id: "CLT-WIN-CMD-030"
452
+ version: 1
453
+ detection_name: "CMD:SageWindowsCommand-AD [Heur]"
342
454
  category: tool
343
455
  severity: critical
344
456
  confidence: 0.90
345
- pattern: "\\bncat\\b.*\\s-e\\s+(cmd|powershell|cmd\\.exe|powershell\\.exe)"
457
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
458
+ pattern: "{{CMD_POS}}ncat(?:\\.exe)?{{NOT_FILENAME}}.*\\s-e\\s+(cmd|powershell|cmd\\.exe|powershell\\.exe)"
346
459
  match_on: command
347
460
  title: "Reverse shell via ncat -e cmd/powershell"
348
461
  expires_at: null
@@ -352,10 +465,13 @@
352
465
 
353
466
  # vssadmin delete shadows
354
467
  - id: "CLT-WIN-CMD-031"
468
+ version: 1
469
+ detection_name: "CMD:SageWindowsCommand-AE [Heur]"
355
470
  category: tool
356
471
  severity: critical
357
472
  confidence: 0.95
358
- pattern: "\\bvssadmin\\b.*\\bdelete\\s+shadows\\b"
473
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
474
+ pattern: "{{CMD_POS}}vssadmin(?:\\.exe)?{{NOT_FILENAME}}.*\\bdelete\\s+shadows\\b"
359
475
  case_insensitive: true
360
476
  match_on: command
361
477
  title: "Shadow copy deletion via vssadmin (ransomware indicator)"
@@ -364,10 +480,13 @@
364
480
 
365
481
  # wmic shadowcopy delete
366
482
  - id: "CLT-WIN-CMD-032"
483
+ version: 1
484
+ detection_name: "CMD:SageWindowsCommand-AF [Heur]"
367
485
  category: tool
368
486
  severity: critical
369
487
  confidence: 0.95
370
- pattern: "\\bwmic\\b.*\\bshadowcopy\\b.*\\bdelete\\b"
488
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
489
+ pattern: "{{CMD_POS}}wmic(?:\\.exe)?{{NOT_FILENAME}}.*\\bshadowcopy\\b.*\\bdelete\\b"
371
490
  match_on: command
372
491
  title: "Shadow copy deletion via wmic (ransomware indicator)"
373
492
  expires_at: null
@@ -375,10 +494,14 @@
375
494
 
376
495
  # bcdedit recovery disable
377
496
  - id: "CLT-WIN-CMD-033"
497
+ version: 1
498
+ detection_name: "CMD:SageWindowsCommand-AG [Heur]"
378
499
  category: tool
379
500
  severity: critical
380
501
  confidence: 0.95
381
- pattern: "\\bbcdedit\\b.*/set\\b.*\\b(recoveryenabled\\b.*\\b(No|no|NO|false|0)|bootems\\s+off|advancedoptions\\s+off|optionsedit\\s+off)\\b|\\breg\\b.*\\bdelete\\b.*\\bSYSTEM\\\\.*CurrentControlSet\\\\Control\\\\SafeBoot\\b|\\breg\\b.*\\badd\\b.*\\bSOFTWARE\\\\.*Microsoft\\\\Windows NT\\\\.*CurrentVersion\\\\Winlogon\\b.*/v.*Userinit"
502
+ # {{CMD_POS}} + {{NOT_FILENAME}} on each alternative's leading identifier,
503
+ # same shape as CLT-CMD-009.
504
+ pattern: "{{CMD_POS}}bcdedit(?:\\.exe)?{{NOT_FILENAME}}.*/set\\b.*\\b(recoveryenabled\\b.*\\b(No|no|NO|false|0)|bootems\\s+off|advancedoptions\\s+off|optionsedit\\s+off)\\b|{{CMD_POS}}reg(?:\\.exe)?{{NOT_FILENAME}}.*\\bdelete\\b.*\\bSYSTEM\\\\.*CurrentControlSet\\\\Control\\\\SafeBoot\\b|{{CMD_POS}}reg(?:\\.exe)?{{NOT_FILENAME}}.*\\badd\\b.*\\bSOFTWARE\\\\.*Microsoft\\\\Windows NT\\\\.*CurrentVersion\\\\Winlogon\\b.*/v.*Userinit"
382
505
  match_on: command
383
506
  title: "Recovery/boot disable via bcdedit, SafeBoot reg delete, or Winlogon Userinit (ransomware indicator)"
384
507
  expires_at: null
@@ -386,10 +509,13 @@
386
509
 
387
510
  # PowerShell WMI/CIM shadow copy deletion
388
511
  - id: "CLT-WIN-CMD-034"
512
+ version: 1
513
+ detection_name: "CMD:SageWindowsCommand-AH [Heur]"
389
514
  category: tool
390
515
  severity: critical
391
516
  confidence: 0.95
392
- pattern: "\\b(Get-WmiObject|Get-CimInstance)\\b.*\\bWin32_ShadowCopy\\b.*\\b(Remove-WmiObject|Remove-CimInstance|Delete)\\b"
517
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
518
+ pattern: "{{CMD_POS}}(Get-WmiObject|Get-CimInstance){{NOT_FILENAME}}.*\\bWin32_ShadowCopy\\b.*\\b(Remove-WmiObject|Remove-CimInstance|Delete)\\b"
393
519
  match_on: command
394
520
  title: "PowerShell shadow copy deletion (ransomware indicator)"
395
521
  expires_at: null
@@ -399,10 +525,13 @@
399
525
 
400
526
  # wevtutil event log clearing
401
527
  - id: "CLT-WIN-CMD-035"
528
+ version: 1
529
+ detection_name: "CMD:SageWindowsCommand-AI [Heur]"
402
530
  category: tool
403
531
  severity: critical
404
532
  confidence: 0.95
405
- pattern: "\\bwevtutil\\b.*\\b(cl|clear-log)\\b"
533
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
534
+ pattern: "{{CMD_POS}}wevtutil(?:\\.exe)?{{NOT_FILENAME}}.*\\b(cl|clear-log)\\b"
406
535
  match_on: command
407
536
  title: "Windows event log clearing via wevtutil (anti-forensics)"
408
537
  expires_at: null
@@ -410,10 +539,18 @@
410
539
 
411
540
  # PowerShell event log clearing
412
541
  - id: "CLT-WIN-CMD-036"
542
+ version: 1
543
+ detection_name: "CMD:SageWindowsCommand-AJ [Heur]"
413
544
  category: tool
414
545
  severity: critical
415
546
  confidence: 0.95
416
- pattern: "\\b(Clear-EventLog|Remove-EventLog)\\b"
547
+ # A cmdlet occupies command position the same way a binary does — the path
548
+ # prefix {{CMD_POS}} allows is optional, not required, so lacking one isn't
549
+ # a reason to skip it. {{CMD_POS}} also closes the quoted-mention and
550
+ # filename-mention gaps that the symmetric guard alone (see
551
+ # CLT-WIN-PERSIST-008) can't.
552
+ pattern: "{{CMD_POS}}(Clear-EventLog|Remove-EventLog){{NOT_FILENAME}}"
553
+ case_insensitive: true
417
554
  match_on: command
418
555
  title: "PowerShell event log clearing (anti-forensics)"
419
556
  expires_at: null
@@ -421,10 +558,13 @@
421
558
 
422
559
  # Set-MpPreference Defender disable
423
560
  - id: "CLT-WIN-CMD-037"
561
+ version: 1
562
+ detection_name: "CMD:SageWindowsCommand-AK [Heur]"
424
563
  category: tool
425
564
  severity: critical
426
565
  confidence: 0.95
427
- pattern: "\\b(Set|Add)-MpPreference\\b.*(-Disable|-Exclusion)"
566
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
567
+ pattern: "{{CMD_POS}}(Set|Add)-MpPreference{{NOT_FILENAME}}.*(-Disable|-Exclusion)"
428
568
  match_on: command
429
569
  title: "Windows Defender settings modification via Set/Add-MpPreference"
430
570
  expires_at: null
@@ -432,10 +572,16 @@
432
572
 
433
573
  # Security service tampering
434
574
  - id: "CLT-WIN-CMD-038"
575
+ version: 1
576
+ detection_name: "CMD:SageWindowsCommand-AL [Heur]"
435
577
  category: tool
436
578
  severity: critical
437
579
  confidence: 0.90
438
- pattern: "\\b(sc\\s+(stop|config)|net\\s+stop|Stop-Service)\\b.*\\b(WinDefend|MpsSvc|wscsvc|SecurityHealthService)\\b"
580
+ # {{CMD_POS}} + {{NOT_FILENAME}} on each alternative, same shape as
581
+ # CLT-CMD-009. The whole alternation is wrapped in a non-capturing group so
582
+ # the trailing service-name check applies to all three branches, not just
583
+ # the last.
584
+ pattern: "(?:{{CMD_POS}}sc(?:\\.exe)?{{NOT_FILENAME}}\\s+(stop|config)|{{CMD_POS}}net(?:\\.exe)?{{NOT_FILENAME}}\\s+stop|{{CMD_POS}}Stop-Service{{NOT_FILENAME}}).*\\b(WinDefend|MpsSvc|wscsvc|SecurityHealthService)\\b"
439
585
  match_on: command
440
586
  title: "Security service tampering (WinDefend/firewall service stop/disable)"
441
587
  expires_at: null
@@ -443,10 +589,13 @@
443
589
 
444
590
  # netsh firewall disable
445
591
  - id: "CLT-WIN-CMD-039"
592
+ version: 1
593
+ detection_name: "CMD:SageWindowsCommand-AM [Heur]"
446
594
  category: tool
447
595
  severity: critical
448
596
  confidence: 0.90
449
- pattern: "\\bnetsh\\b.*\\badvfirewall\\b.*\\bstate\\s+off\\b"
597
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
598
+ pattern: "{{CMD_POS}}netsh(?:\\.exe)?{{NOT_FILENAME}}.*\\badvfirewall\\b.*\\bstate\\s+off\\b"
450
599
  match_on: command
451
600
  title: "Windows Firewall disabling via netsh"
452
601
  expires_at: null
@@ -456,10 +605,14 @@
456
605
 
457
606
  # Password-protected archive creation
458
607
  - id: "CLT-WIN-CMD-040"
608
+ version: 1
609
+ detection_name: "CMD:SageWindowsCommand-AN [Heur]"
459
610
  category: tool
460
611
  severity: warning
461
612
  confidence: 0.60
462
- pattern: "\\b(rar|winrar)(\\.exe)?\\b.*\\s-h?p|\\b(7z|7za)(\\.exe)?\\b.*\\s-p|\\bzip\\b.*\\s(-P\\s|--password\\b)"
613
+ # {{CMD_POS}} + {{NOT_FILENAME}} on each alternative, same shape as
614
+ # CLT-CMD-009. The `.exe` suffix stays optional ahead of {{NOT_FILENAME}}.
615
+ pattern: "{{CMD_POS}}(rar|winrar)(?:\\.exe)?{{NOT_FILENAME}}.*\\s-h?p|{{CMD_POS}}(7z|7za)(?:\\.exe)?{{NOT_FILENAME}}.*\\s-p|{{CMD_POS}}zip(?:\\.exe)?{{NOT_FILENAME}}.*\\s(-P\\s|--password\\b)"
463
616
  match_on: command
464
617
  title: "Password-protected archive creation (potential data exfiltration)"
465
618
  expires_at: null
@@ -467,10 +620,13 @@
467
620
 
468
621
  # Bulk document archiving with wildcards
469
622
  - id: "CLT-WIN-CMD-041"
623
+ version: 1
624
+ detection_name: "CMD:SageWindowsCommand-AO [Heur]"
470
625
  category: tool
471
626
  severity: warning
472
627
  confidence: 0.60
473
- pattern: "\\b(rar|winrar|7z|7za|zip|tar)(\\.exe)?\\b.*\\*\\.(docx?|xlsx?|pptx?|pdf|csv)\\b"
628
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-WIN-CMD-040.
629
+ pattern: "{{CMD_POS}}(rar|winrar|7z|7za|zip|tar)(?:\\.exe)?{{NOT_FILENAME}}.*\\*\\.(docx?|xlsx?|pptx?|pdf|csv)\\b"
474
630
  match_on: command
475
631
  title: "Bulk document archiving with wildcards (data exfiltration indicator)"
476
632
  expires_at: null
@@ -480,6 +636,8 @@
480
636
 
481
637
  # AutoIt3 /AutoIt3ExecuteScript flag — prevalent malware delivery mechanism
482
638
  - id: "CLT-WIN-CMD-042"
639
+ version: 1
640
+ detection_name: "CMD:SageWindowsCommand-AP [Heur]"
483
641
  category: tool
484
642
  severity: critical
485
643
  confidence: 0.95
@@ -494,10 +652,14 @@
494
652
 
495
653
  # wscript/cscript executing scripts from C:\Users\Public (world-writable staging)
496
654
  - id: "CLT-WIN-CMD-043"
655
+ version: 1
656
+ detection_name: "CMD:SageWindowsCommand-AQ [Heur]"
497
657
  category: tool
498
658
  severity: warning
499
659
  confidence: 0.60
500
- pattern: "(wscript|cscript)(\\.exe)?\\b.*\\\\Users\\\\Public\\\\"
660
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-WIN-OBFUS-009. Had no
661
+ # leading boundary at all.
662
+ pattern: "{{CMD_POS}}(wscript|cscript)(?:\\.exe)?{{NOT_FILENAME}}.*\\\\Users\\\\Public\\\\"
501
663
  case_insensitive: true
502
664
  match_on: command
503
665
  title: "Script execution from C:\\Users\\Public (suspicious staging location)"
@@ -508,10 +670,14 @@
508
670
 
509
671
  # regsvr32 /i: with remote URL (Squiblydoo — shellcode or scrobj.dll variant)
510
672
  - id: "CLT-WIN-CMD-044"
673
+ version: 1
674
+ detection_name: "CMD:SageWindowsCommand-AR [Heur]"
511
675
  category: tool
512
676
  severity: critical
513
677
  confidence: 0.95
514
- pattern: "regsvr32(\\.exe)?\\b.*/[Ii]:[^\\s]*https?://"
678
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-WIN-CMD-043. Had no
679
+ # leading boundary at all.
680
+ pattern: "{{CMD_POS}}regsvr32(?:\\.exe)?{{NOT_FILENAME}}.*/[Ii]:[^\\s]*https?://"
515
681
  case_insensitive: true
516
682
  match_on: command
517
683
  title: "regsvr32 /i: with remote URL (Squiblydoo attack)"
@@ -520,10 +686,16 @@
520
686
 
521
687
  # cmdl32.exe Connection Manager Profile Installer abuse
522
688
  - id: "CLT-WIN-CMD-045"
689
+ version: 1
690
+ detection_name: "CMD:SageWindowsCommand-AS [Heur]"
523
691
  category: tool
524
692
  severity: warning
525
693
  confidence: 0.60
526
- pattern: "\\bcmdl32(\\.exe)?\\b"
694
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009. Known
695
+ # casualty, accepted: a bare fully-quoted invocation with no wrapper
696
+ # (`"C:\...\cmdl32.exe" ...`) no longer matches, same gap CLT-MITRE-096
697
+ # (tscon) already has.
698
+ pattern: "{{CMD_POS}}cmdl32(?:\\.exe)?{{NOT_FILENAME}}"
527
699
  case_insensitive: true
528
700
  match_on: command
529
701
  title: "cmdl32.exe Connection Manager abuse (LOLBin)"
@@ -534,10 +706,13 @@
534
706
 
535
707
  # curl/wget download to file then start (single & in cmd.exe)
536
708
  - id: "CLT-WIN-CMD-046"
709
+ version: 1
710
+ detection_name: "CMD:SageWindowsCommand-AT [Heur]"
537
711
  category: tool
538
712
  severity: critical
539
713
  confidence: 0.90
540
- pattern: "\\b(curl|wget)\\b[^&]*(--(output|o\\b)|-o\\b)[^&]*&\\s*(start\\b|cmd)"
714
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009.
715
+ pattern: "{{CMD_POS}}(curl|wget)(?:\\.exe)?{{NOT_FILENAME}}[^&]*(--(output|o\\b)|-o\\b)[^&]*&\\s*(start\\b|cmd)"
541
716
  case_insensitive: true
542
717
  match_on: command
543
718
  title: "Download file then execute via cmd start (download-execute chain)"
@@ -546,10 +721,14 @@
546
721
 
547
722
  # Shadow copy resize + VSS/SystemRestore disable + wbadmin backup deletion (ex CLT-TECH-005)
548
723
  - id: "CLT-WIN-CMD-047"
724
+ version: 1
725
+ detection_name: "CMD:SageWindowsCommand-AU [Heur]"
549
726
  category: tool
550
727
  severity: critical
551
728
  confidence: 0.90
552
- pattern: "(vssadmin.*resize.*shadowstorage|net.*stop.*swprv|reg.*add.*HKLM.*SOFTWARE.*Microsoft.*Windows NT.*CurrentVersion.*SystemRestore.*/v.*DisableSR.*/t.*REG_DWORD.*/d.*1.*/f|reg.*add.*HKLM.*SYSTEM.*CurrentControlSet.*services.*VSS.*/v.*Start.*/t.*REG_DWORD.*/d.*4.*/f|wbadmin.*delete.*catalog|wbadmin.*delete.*systemstatebackup)"
729
+ # {{CMD_POS}} + {{NOT_FILENAME}} on each alternative's leading identifier,
730
+ # same shape as CLT-CMD-009. Had no boundary at all.
731
+ pattern: "{{CMD_POS}}vssadmin(?:\\.exe)?{{NOT_FILENAME}}.*resize.*shadowstorage|{{CMD_POS}}net(?:\\.exe)?{{NOT_FILENAME}}.*stop.*swprv|{{CMD_POS}}reg(?:\\.exe)?{{NOT_FILENAME}}.*add.*HKLM.*SOFTWARE.*Microsoft.*Windows NT.*CurrentVersion.*SystemRestore.*/v.*DisableSR.*/t.*REG_DWORD.*/d.*1.*/f|{{CMD_POS}}reg(?:\\.exe)?{{NOT_FILENAME}}.*add.*HKLM.*SYSTEM.*CurrentControlSet.*services.*VSS.*/v.*Start.*/t.*REG_DWORD.*/d.*4.*/f|{{CMD_POS}}wbadmin(?:\\.exe)?{{NOT_FILENAME}}.*delete.*catalog|{{CMD_POS}}wbadmin(?:\\.exe)?{{NOT_FILENAME}}.*delete.*systemstatebackup"
553
732
  case_insensitive: true
554
733
  match_on: command
555
734
  title: "Shadow copy/VSS/SystemRestore disable or wbadmin backup deletion"
@@ -558,10 +737,14 @@
558
737
 
559
738
  # Legacy firewall disable via netsh opmode (ex CLT-TECH-007, MpsSvc parts covered by CLT-WIN-CMD-038)
560
739
  - id: "CLT-WIN-CMD-048"
740
+ version: 1
741
+ detection_name: "CMD:SageWindowsCommand-AV [Heur]"
561
742
  category: tool
562
743
  severity: warning
563
744
  confidence: 0.60
564
- pattern: "netsh\\s+firewall\\s+set\\s+opmode\\s+mode[= ]+DISABLE"
745
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009. Had no
746
+ # boundary at all.
747
+ pattern: "{{CMD_POS}}netsh(?:\\.exe)?{{NOT_FILENAME}}\\s+firewall\\s+set\\s+opmode\\s+mode[= ]+DISABLE"
565
748
  case_insensitive: true
566
749
  match_on: command
567
750
  title: "Legacy firewall disable via netsh opmode (pre-Vista)"
@@ -570,10 +753,14 @@
570
753
 
571
754
  # Firewall exclusion: add allowed program (ex CLT-TECH-008)
572
755
  - id: "CLT-WIN-CMD-049"
756
+ version: 1
757
+ detection_name: "CMD:SageWindowsCommand-AW [Heur]"
573
758
  category: tool
574
759
  severity: warning
575
760
  confidence: 0.60
576
- pattern: "(netsh\\s+firewall.+add.+allowedprogram.+ENABLE|netsh.+advfirewall.+firewall.+add.+rule.+name.+program|netsh\\s+advfirewall\\s+firewall.+allow.+program.+enable[= ]+yes)"
761
+ # {{CMD_POS}} + {{NOT_FILENAME}} on each alternative, same shape as
762
+ # CLT-WIN-CMD-048.
763
+ pattern: "{{CMD_POS}}netsh(?:\\.exe)?{{NOT_FILENAME}}\\s+firewall.+add.+allowedprogram.+ENABLE|{{CMD_POS}}netsh(?:\\.exe)?{{NOT_FILENAME}}.+advfirewall.+firewall.+add.+rule.+name.+program|{{CMD_POS}}netsh(?:\\.exe)?{{NOT_FILENAME}}\\s+advfirewall\\s+firewall.+allow.+program.+enable[= ]+yes"
577
764
  case_insensitive: true
578
765
  match_on: command
579
766
  title: "Excluding program from firewall detection via netsh"
@@ -582,10 +769,13 @@
582
769
 
583
770
  # AppLocker bypass via regsvr32 /i:http (ex CLT-TECH-006)
584
771
  - id: "CLT-WIN-CMD-050"
772
+ version: 1
773
+ detection_name: "CMD:SageWindowsCommand-AX [Heur]"
585
774
  category: tool
586
775
  severity: warning
587
776
  confidence: 0.60
588
- pattern: "regsvr32.+i:\\s*http"
777
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-WIN-CMD-044.
778
+ pattern: "{{CMD_POS}}regsvr32(?:\\.exe)?{{NOT_FILENAME}}.+i:\\s*http"
589
779
  case_insensitive: true
590
780
  match_on: command
591
781
  title: "AppLocker bypass via regsvr32 /i:http"
@@ -594,10 +784,18 @@
594
784
 
595
785
  # Mavinject DLL injection (ex CLT-TECH-009)
596
786
  - id: "CLT-WIN-CMD-051"
787
+ version: 1
788
+ detection_name: "CMD:SageWindowsCommand-AY [Heur]"
597
789
  category: tool
598
790
  severity: critical
599
791
  confidence: 0.90
600
- pattern: "(\\\\|/)Mavinject(64|32)\\.exe"
792
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009. The old
793
+ # mandatory leading slash was a path-mention check, not real command
794
+ # position -- it matched `cat /tools/Mavinject32.exe-notes.md` and missed
795
+ # a bare `Mavinject64.exe` invocation with no path prefix at all.
796
+ # {{CMD_POS}}'s path prefix is optional, so this both closes the mention
797
+ # false positive and admits the bare invocation.
798
+ pattern: "{{CMD_POS}}Mavinject(64|32)\\.exe{{NOT_FILENAME}}"
601
799
  case_insensitive: true
602
800
  match_on: command
603
801
  title: "Mavinject DLL injection (LOLBin)"
@@ -606,10 +804,13 @@
606
804
 
607
805
  # PyDev inject_dll injection (ex CLT-TECH-010)
608
806
  - id: "CLT-WIN-CMD-052"
807
+ version: 1
808
+ detection_name: "CMD:SageWindowsCommand-AZ [Heur]"
609
809
  category: tool
610
810
  severity: critical
611
811
  confidence: 0.90
612
- pattern: "(\\\\|/)inject_dll_(x86|amd64)\\.exe"
812
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-WIN-CMD-051.
813
+ pattern: "{{CMD_POS}}inject_dll_(x86|amd64)\\.exe{{NOT_FILENAME}}"
613
814
  case_insensitive: true
614
815
  match_on: command
615
816
  title: "PyDev inject_dll injection (LOLBin)"
@@ -618,10 +819,14 @@
618
819
 
619
820
  # PowerShdll execution (ex CLT-TECH-028)
620
821
  - id: "CLT-WIN-CMD-053"
822
+ version: 1
823
+ detection_name: "CMD:SageWindowsCommand-BA [Heur]"
621
824
  category: tool
622
825
  severity: warning
623
826
  confidence: 0.60
624
- pattern: "(rundll32\\.exe PowerShdll\\.dll,main|POWERSHDLL\\.(DLL|EXE))"
827
+ # {{CMD_POS}} + {{NOT_FILENAME}} on each alternative, same shape as
828
+ # CLT-CMD-009.
829
+ pattern: "{{CMD_POS}}rundll32\\.exe{{NOT_FILENAME}} PowerShdll\\.dll,main|{{CMD_POS}}POWERSHDLL\\.(DLL|EXE){{NOT_FILENAME}}"
625
830
  case_insensitive: true
626
831
  match_on: command
627
832
  title: "PowerShdll execution (LOLBin)"
@@ -630,10 +835,14 @@
630
835
 
631
836
  # SyncAppvPublishingServer execution (ex CLT-TECH-030)
632
837
  - id: "CLT-WIN-CMD-054"
838
+ version: 1
839
+ detection_name: "CMD:SageWindowsCommand-BB [Heur]"
633
840
  category: tool
634
841
  severity: warning
635
842
  confidence: 0.60
636
- pattern: "SyncAppvPublishingServer\\.vbs \".*(iwr|iex)"
843
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009. Had no
844
+ # boundary at all.
845
+ pattern: "{{CMD_POS}}SyncAppvPublishingServer\\.vbs{{NOT_FILENAME}} \".*(iwr|iex)"
637
846
  case_insensitive: true
638
847
  match_on: command
639
848
  title: "Execution via SyncAppvPublishingServer (LOLBin)"
@@ -642,10 +851,15 @@
642
851
 
643
852
  # sdclt/CompMgmtLauncher UAC bypass (ex CLT-TECH-033)
644
853
  - id: "CLT-WIN-CMD-055"
854
+ version: 1
855
+ detection_name: "CMD:SageWindowsCommand-BC [Heur]"
645
856
  category: tool
646
857
  severity: critical
647
858
  confidence: 0.90
648
- pattern: "(sdclt\\.exe|CompMgmtLauncher\\.exe)"
859
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-CMD-009. `.exe` is
860
+ # kept optional (widening slightly from the old mandatory suffix) for
861
+ # consistency with the rest of the corpus.
862
+ pattern: "{{CMD_POS}}(sdclt|CompMgmtLauncher)(?:\\.exe)?{{NOT_FILENAME}}"
649
863
  case_insensitive: true
650
864
  match_on: command
651
865
  title: "UAC bypass via sdclt or CompMgmtLauncher"
@@ -654,10 +868,14 @@
654
868
 
655
869
  # PowerShell fileless execution via iex $env (ex CLT-TECH-017)
656
870
  - id: "CLT-WIN-CMD-056"
871
+ version: 1
872
+ detection_name: "CMD:SageWindowsCommand-BD [Heur]"
657
873
  category: tool
658
874
  severity: warning
659
875
  confidence: 0.60
660
- pattern: "powershell.*iex.*\\$env"
876
+ # {{CMD_POS}} + {{NOT_FILENAME}} (with optional `.exe` suffix), same shape
877
+ # as CLT-MITRE-096. Had no boundary at all.
878
+ pattern: "{{CMD_POS}}powershell(?:\\.exe)?{{NOT_FILENAME}}.*iex.*\\$env"
661
879
  case_insensitive: true
662
880
  match_on: command
663
881
  title: "PowerShell fileless execution via iex $env"
@@ -666,10 +884,13 @@
666
884
 
667
885
  # PowerShell version downgrade (ex CLT-TECH-018)
668
886
  - id: "CLT-WIN-CMD-057"
887
+ version: 1
888
+ detection_name: "CMD:SageWindowsCommand-BE [Heur]"
669
889
  category: tool
670
890
  severity: warning
671
891
  confidence: 0.60
672
- pattern: "powershell.*-Version"
892
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-WIN-CMD-056.
893
+ pattern: "{{CMD_POS}}powershell(?:\\.exe)?{{NOT_FILENAME}}.*-Version"
673
894
  case_insensitive: true
674
895
  match_on: command
675
896
  title: "PowerShell version downgrade attack"
@@ -678,10 +899,14 @@
678
899
 
679
900
  # PowerShell download cradle iex+downloadstring (ex CLT-TECH-023)
680
901
  - id: "CLT-WIN-CMD-058"
902
+ version: 1
903
+ detection_name: "CMD:SageWindowsCommand-BF [Heur]"
681
904
  category: tool
682
905
  severity: critical
683
906
  confidence: 0.90
684
- pattern: "(powershell.*(iex|invoke-expression).*downloadstring|powershell.*Start-BitsTransfer.*(iex|invoke-expression)|powershell.*xmlhttp.*send.*(iex|invoke-expression))"
907
+ # {{CMD_POS}} + {{NOT_FILENAME}} on each alternative, same shape as
908
+ # CLT-WIN-CMD-056.
909
+ pattern: "{{CMD_POS}}powershell(?:\\.exe)?{{NOT_FILENAME}}.*(iex|invoke-expression).*downloadstring|{{CMD_POS}}powershell(?:\\.exe)?{{NOT_FILENAME}}.*Start-BitsTransfer.*(iex|invoke-expression)|{{CMD_POS}}powershell(?:\\.exe)?{{NOT_FILENAME}}.*xmlhttp.*send.*(iex|invoke-expression)"
685
910
  case_insensitive: true
686
911
  match_on: command
687
912
  title: "PowerShell download cradle (iex+downloadstring)"
@@ -690,10 +915,13 @@
690
915
 
691
916
  # PowerShell Reflection.Assembly Load (ex CLT-TECH-024)
692
917
  - id: "CLT-WIN-CMD-059"
918
+ version: 1
919
+ detection_name: "CMD:SageWindowsCommand-BG [Heur]"
693
920
  category: tool
694
921
  severity: warning
695
922
  confidence: 0.60
696
- pattern: "powershell.+\\[Reflection\\.Assembly\\]::Load"
923
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-WIN-CMD-056.
924
+ pattern: "{{CMD_POS}}powershell(?:\\.exe)?{{NOT_FILENAME}}.+\\[Reflection\\.Assembly\\]::Load"
697
925
  case_insensitive: true
698
926
  match_on: command
699
927
  title: "PowerShell Reflection.Assembly Load"
@@ -702,10 +930,13 @@
702
930
 
703
931
  # PowerShell certificate validation bypass (ex CLT-TECH-025)
704
932
  - id: "CLT-WIN-CMD-060"
933
+ version: 1
934
+ detection_name: "CMD:SageWindowsCommand-BH [Heur]"
705
935
  category: tool
706
936
  severity: warning
707
937
  confidence: 0.60
708
- pattern: "powershell.+ServerCertificateValidationCallback\\s*=\\s*\\{\\s*\\$true\\s*\\}"
938
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-WIN-CMD-056.
939
+ pattern: "{{CMD_POS}}powershell(?:\\.exe)?{{NOT_FILENAME}}.+ServerCertificateValidationCallback\\s*=\\s*\\{\\s*\\$true\\s*\\}"
709
940
  case_insensitive: true
710
941
  match_on: command
711
942
  title: "PowerShell certificate validation bypass"
@@ -714,10 +945,13 @@
714
945
 
715
946
  # PowerShell GetTypeFromCLSID (ex CLT-TECH-029)
716
947
  - id: "CLT-WIN-CMD-061"
948
+ version: 1
949
+ detection_name: "CMD:SageWindowsCommand-BI [Heur]"
717
950
  category: tool
718
951
  severity: warning
719
952
  confidence: 0.60
720
- pattern: "powershell.+GetTypeFromCLSID"
953
+ # {{CMD_POS}} + {{NOT_FILENAME}}, same shape as CLT-WIN-CMD-056.
954
+ pattern: "{{CMD_POS}}powershell(?:\\.exe)?{{NOT_FILENAME}}.+GetTypeFromCLSID"
721
955
  case_insensitive: true
722
956
  match_on: command
723
957
  title: "PowerShell GetTypeFromCLSID usage"