Detection rules › Splunk
Wscript_Cscript Execution (PowerShell)
Monitor the execution of wscript or cscript processes as these are commonly utilized by threat actors to run malicious VBScript or JScript code
MITRE ATT&CK coverage
References
Event coverage
| Provider | Event | Title |
|---|---|---|
| PowerShell | Event ID 4104 | Creating Scriptblock text (MessageNumber of MessageTotal). |
Rule body yaml
id: '1029.1032'
title: Wscript_Cscript Execution
description: 'Monitor the execution of wscript or cscript processes as these are commonly
utilized by threat actors to run malicious VBScript or JScript code Threat Actor
Association: Actinium/Gamaredon/Primitive Bear, Andariel, Antlion, APT10/menuPass,
APT28/Fancy Bear, APT29/Nobelium/Cozy Bear, APT31, APT33, APT35, APT37/Chinotto,
APT43, Blind Eagle/APT-C-36, Carbanak, Evilnum, FIN7, Gamaredon Group/Shuckworm,
Kimsuky, Mustang Panda (aka. Stately Taurus//Earth Preta/BRONZE PRESIDENT/TA416/RedDelta),
NewsPenguin, Prophet Spider, TA2541, TA428, TA551, UAC-0057 (GhostWriter), WIRTE,
Witchetty Software Association: Agent Tesla, Astaroth, Avaddon, Black Basta, BazarLoader,
Cring, DarkGate, MirrorBlast, NanoCore, PoetRAT, QakBot, RATDispenser, SquirrelWaffle,
Trickbot, Remcos RAT, WhisperGate, Zloader Atomics T1105 Test #11 Atomics T1059.005
Test #1 Atomics T1082 Test #9 Atomics T1547.001 Test #5 -- #TrendingThreat #Russia
#Ukraine'
logic_format: Splunk
logic: ' `get_endpoint_data` `get_endpoint_data_powershell` EventCode=4104 ("cscript.exe"
OR "WScript.exe") AND (("shell" OR "/cmd") OR ("persist" OR "wait")) OR "cmd.exe"
OR "net.exe" OR "/c net use" OR "/user:" OR "del" | table _time, host, user dvc,
dvc_nt_host, event_id, eventtype, host, index, parameters, process, process_id,
process_name, process_path, shell, signature_id, source, sourcetype, tag, user,
user_id | bin span=60s | stats values(*) as * by _time, host | where (( like(process,"%cscript.exe%")
OR like(process,"%WScript.exe%")) AND ((like(process,"%shell%") OR like(process,"%/cmd%"))
OR (like(process,"%persist%") OR like(process,"%wait%")))) OR (like(process,"%cmd.exe%")
AND like(process,"%net.exe%") AND like(process,"%/c net use%") AND like(process,"%/user:%")
AND like(process,"%del%")) '
techniques:
- execution:command and scripting interpreter:visual basic
- execution:command and scripting interpreter:javascript
technique_id:
- T1059.007
- T1059.005
data_category:
- PowerShell logs
references:
- https://secure.anvilogic.com/use_cases?id=AVL_UC1029
Stages and Predicates
Stage 1: search
`get_endpoint_data` `get_endpoint_data_powershell` EventCode=4104 ("cscript.exe" OR "WScript.exe") AND (("shell" OR "/cmd") OR ("persist" OR "wait")) OR "cmd.exe" OR "net.exe" OR "/c net use" OR "/user:" OR "del"
Stage 2: table
| table _time, host, user dvc, dvc_nt_host, event_id, eventtype, host, index, parameters, process, process_id, process_name, process_path, shell, signature_id, source, sourcetype, tag, user, user_id
Stage 3: bucket
| bin span=60s
Stage 4: stats
| stats values(*) as * by _time, host
Stage 5: where
| where (( like(process,"%cscript.exe%") OR like(process,"%WScript.exe%")) AND ((like(process,"%shell%") OR like(process,"%/cmd%")) OR (like(process,"%persist%") OR like(process,"%wait%")))) OR (like(process,"%cmd.exe%") AND like(process,"%net.exe%") AND like(process,"%/c net use%") AND like(process,"%/user:%") AND like(process,"%del%"))
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.
Search terms
Bare-string tokens in the SPL search body. Splunk matches each token against _raw (the untyped raw event text) anywhere it appears, not against a specific field. These don't surface in the Indicators table because they aren't predicates on a known field.
| Stage | Term |
|---|---|
| 1 | "cscript.exe" |
| 1 | "WScript.exe" |
| 1 | "shell" |
| 1 | "/cmd" |
| 1 | "persist" |
| 1 | "wait" |
| 1 | "cmd.exe" |
| 1 | "net.exe" |
| 1 | "/c net use" |
| 1 | "/user:" |
| 1 | "del" |