Detection rules › Splunk

Expand.exe Execution (PowerShell)

Group by
_time, host
Source
github.com/anvilogic-forge/armory

expand.exe is a legitimate Windows utility used to extract files from compressed .cab archives. Threat actors have been observed abusing expand.exe to unpack malicious payloads hidden within .cab files on compromised systems. This use case detects expand.exe executions with .cab file extensions or references to suspicious path locations. Allowlisting expected processes with full file paths and command lines where possible is recommended for best fidelity

MITRE ATT&CK coverage

References

Telemetry coverage

Rule body

id: '35367.62270'
title: Expand.exe Execution
description: expand.exe is a legitimate Windows utility used to extract files from
  compressed .cab archives. Threat actors have been observed abusing expand.exe to
  unpack malicious payloads hidden within .cab files on compromised systems. This
  use case detects expand.exe executions with .cab file extensions or references to
  suspicious path locations. Allowlisting expected processes with full file paths
  and command lines where possible is recommended for best fidelity. Living Off the
  Land Binary and Scripts (LOLBAS) (LOLBIN)
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_powershell` (TERM(EventCode=4103) OR
  "<EventID>4103<" OR TERM(EventCode=4104) OR "<EventID>4104<") "expand.exe" (".cab"
  OR "/F:" OR "-F:" OR "\\ProgramData" OR "\\Public" OR "\\AppData\\Local\\Temp\\"
  OR "\\AppData\\Roaming\\Temp\\") | where match(process, "(?i)\.cab|(-|\/)F:|\x5cAppData\x5c|(Local|Roaming)\x5cTemp\x5c")
  and not match(process, "(?i):\x5cProgramData\x5cDell\x5cUpdateService\x5cTemp\x5c")
  | table _time, host, user, process, process_name, parent_process_path, parent_process_name
  | bin span=1s | stats values(*) as * by _time, host '
techniques:
- command-and-control:ingress tool transfer
- defense-evasion:hide artifacts:ntfs file attributes
technique_id:
- T1105
- T1564.004
data_category:
- PowerShell logs
references:
- https://lolbas-project.github.io/lolbas/Binaries/Expand/
- https://github.com/SigmaHQ/sigma/blob/c04bef2fbbe8beff6c7620d5d7ea6872dbe7acba/rules/windows/process_creation/proc_creation_win_expand_cabinet_files.yml
- https://www.threatdown.com/blog/new-variant-of-konni-malware-used-in-campaign-targetting-russia/
- https://www.sygnia.co/blog/ghost-emperor-demodex-rootkit/

Stages and Predicates

Stage 1: search

`get_endpoint_data` `get_endpoint_data_powershell` (TERM(EventCode=4103) OR "<EventID>4103<" OR TERM(EventCode=4104) OR "<EventID>4104<") "expand.exe" (".cab" OR "/F:" OR "-F:" OR "\\ProgramData" OR "\\Public" OR "\\AppData\\Local\\Temp\\" OR "\\AppData\\Roaming\\Temp\\")

Stage 2: where

| where match(process, "(?i)\.cab|(-|\/)F:|\x5cAppData\x5c|(Local|Roaming)\x5cTemp\x5c") and not match(process, "(?i):\x5cProgramData\x5cDell\x5cUpdateService\x5cTemp\x5c")

Stage 3: table

| table _time, host, user, process, process_name, parent_process_path, parent_process_name

Stage 4: bucket

| bin span=1s

Stage 5: stats

| stats values(*) as * by _time, host

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
processregex_match"(?i):\x5cProgramData\x5cDell\x5cUpdateService\x5cTemp\x5c"excludes:process

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
EventCodeeq
  • 4103 corpus 105 (splunk 105)
  • 4104 corpus 269 (splunk 269)
field:"EventID" kind:eq
processregex_match
    • "(?i).cab
    • (-|\/)F:
    • \x5cAppData\x5c
    • (Local|Roaming)\x5cTemp\x5c"
    corpus 3 (splunk 3)
field:"CommandLine" kind:regex_match

Search terms

These SPL tokens match against raw event text.

StageTerm
1"<EventID>4103<"
1"<EventID>4104<"
1"expand.exe"
1".cab"
1"/F:"
1"-F:"
1"\\ProgramData"
1"\\Public"
1"\\AppData\\Local\\Temp\\"
1"\\AppData\\Roaming\\Temp\\"