Detection rules › Splunk
Certutil File Download (PowerShell)
There are attack scenarios in which attackers download different tools or scripts in order to take full control over certain machines. For example, an attacker gets a reverse shell on the target but is a low privileged shell. In this situation, the attacker can download different exploits on the target for privilege escalation using tools such as wget
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Stealth | T1027 Obfuscated Files or Information |
| Command & Control | T1105 Ingress Tool Transfer |
References
Event coverage
| Provider | Event | Title |
|---|---|---|
| PowerShell | Event ID 4103 | Payload Context: ContextInfo User Data: UserData. |
| PowerShell | Event ID 4104 | Creating Scriptblock text (MessageNumber of MessageTotal). |
Rule body yaml
id: '5327.5411'
title: Certutil File Download
description: 'There are attack scenarios in which attackers download different tools
or scripts in order to take full control over certain machines. For example, an
attacker gets a reverse shell on the target but is a low privileged shell. In this
situation, the attacker can download different exploits on the target for privilege
escalation using tools such as wget. -- Threat Actor Association: APT41, DarkSide,
BlackMatter, APT31, Flax Typhoon, Wizard Spider - Software Association: ALPHV/BlackCat,
Babuk, Bazar, Conti -- Atomics T1027 Test #8'
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_powershell` ((TERM(certutil) AND TERM(--urlcache))
OR TERM(--urlcache) ) AND (EventCode=4104 OR EventCode=4103) | rex field=process
mode=sed max_match=0 "s/(?mi)^(Path.+)|^(ScriptBlock ID.+)|^(Creating Scriptblock.+)//g"|
rex field=process mode=sed "s/([\n\r]+)|(\s\s+)//g"| rex field=process (?<ip>"(\d{1,3}\.){3}\d{1,3}\:\d{1,5})"|
rex field=process (?<website>"(?i)(http|sftp|ftp|https)\:\/{2}[A-Za-z0-9\.\/~\-\_]+")|
rex field=process (?<download_tool>"(?i)certutil") | table _time, host, user, ip,
download_tool, process, website, signature_id | bin span=1s | stats values(*) as
* by _time, host '
techniques:
- command-and-control:ingress tool transfer
- defense-evasion:obfuscated files or information
technique_id:
- T1105
- T1027
data_category:
- PowerShell logs
- Process command-line parameters
references:
- https://www.ired.team/offensive-security/defense-evasion/downloading-file-with-certutil
Stages and Predicates
Stage 1: search
search (EventCode=4103 OR EventCode=4104) source="*" source IN ("WinEventLog:Microsoft-Windows-PowerShell/Operational", "WinEventLog:Windows", "XmlWinEventLog:Microsoft-Windows-PowerShell/Operational")
Stage 2: eval
eval _rex_sed_skipped = (...)
Stage 3: eval
eval _rex_sed_skipped = (...)
Stage 4: eval
eval _rex_skipped = (...)
Stage 5: rex
rex field=process ... -> website
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.
| Field | Kind | Values |
|---|---|---|
EventCode | eq |
|
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 |
| 1 | certutil |
| 1 | "--urlcache" |
| 1 | "--urlcache" |