Detection rules › Splunk
High Entropy Powershell (PowerShell)
There are many tools that assist in obfuscating powershell executions such as Base64 encoding. Other methods include using tools like Chimera, which is a PowerShell obfuscation script designed to bypass AMSI and antivirus solutions. It digests malicious PS1's known to trigger AV and uses string substitution and variable concatenation to evade common detection signatures. This use case uses Splunks URL Toolbox to find high entropy powershell commands
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | T1059.001 Command and Scripting Interpreter: PowerShell |
References
Event coverage
| Provider | Event | Title |
|---|---|---|
| PowerShell | Event ID 4104 | Creating Scriptblock text (MessageNumber of MessageTotal). |
Rule body yaml
id: '6029.6450'
title: High Entropy Powershell
description: 'There are many tools that assist in obfuscating powershell executions
such as Base64 encoding. Other methods include using tools like Chimera, which is
a PowerShell obfuscation script designed to bypass AMSI and antivirus solutions.
It digests malicious PS1''s known to trigger AV and uses string substitution and
variable concatenation to evade common detection signatures. This use case uses
Splunks URL Toolbox to find high entropy powershell commands. -- Software Association:
BianLian'
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_powershell` TERM(EventCode=4104) |
eval process_path=Path |`ut_shannon(process)` | table _time, host, user process,
process_*, signature_id, ut_* | bin span=1s | stats values(*) as * by _time, host
|eventstats avg(ut_shannon) as avg_ut by host, process_path, _time|where avg_ut
> 5 '
techniques:
- execution:command and scripting interpreter:powershell
technique_id:
- T1059.001
data_category:
- Process command-line parameters
- PowerShell logs
references:
- https://github.com/tokyoneon/Chimera
Stages and Predicates
Stage 1: search
`get_endpoint_data` `get_endpoint_data_powershell` TERM(EventCode=4104)
Stage 2: eval
| eval process_path=Path
Stage 3: search
| `ut_shannon(process)`
Stage 4: table
| table _time, host, user process, process_*, signature_id, ut_*
Stage 5: bucket
| bin span=1s
Stage 6: stats
| stats values(*) as * by _time, host
Stage 7: eventstats
| eventstats avg(ut_shannon) as avg_ut by host, process_path, _time
Stage 8: where
| where avg_ut > 5
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 | TERM |