Detection rules › Splunk

DLL Concatenation (PowerShell)

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

Threat actors were observed using Impacket to concatenate the malicious proxy tool Stowaway (msoe.dll) with all DLLs starting with 'd' from the system32 directory into a single DLL (appmgmt.dll) to pad and obfuscate the malicious DLL, thereby facilitating its deployment and evasion. This use case detects copy commands followed by either *.dll or multiple .dll references, indicating possible attempts to concatenate multiple DLLs into a single file. NOTE: For commands using 'copy' or 'type', they must be executed in a way that creates a new process, e.g. with cmd /c or powershell -c, as they are built-in commands that run within the current cmd session and do not create new processes on their own.

MITRE ATT&CK coverage

References

Event coverage

Rule body yaml

id: '33834.59907'
title: DLL Concatenation
description: 'Threat actors were observed using Impacket to concatenate the malicious
  proxy tool Stowaway (msoe.dll) with all DLLs starting with ''d'' from the system32
  directory into a single DLL (appmgmt.dll) to pad and obfuscate the malicious DLL,
  thereby facilitating its deployment and evasion. This use case detects copy commands
  followed by either *.dll or multiple .dll references, indicating possible attempts
  to concatenate multiple DLLs into a single file. NOTE: For commands using ''copy''
  or ''type'', they must be executed in a way that creates a new process, e.g. with
  cmd /c or powershell -c, as they are built-in commands that run within the current
  cmd session and do not create new processes on their own.'
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_powershell` (TERM(EventCode=4103) OR
  "<EventID>4103<") OR (TERM(EventCode=4104) OR "<EventID>4104<") (TERM(copy) OR TERM(robocopy)
  OR TERM(xcopy) OR ((TERM(type) OR TERM(Get-Content) OR "gc" OR "cat" OR TERM(more))
  ">")) ".dll" | regex process="(?i)(copy|more|Get-Content|type|cat|gc)\s+.*?((\/b\s+\S+\.dll\s+\+\s*\S+\.dll)|(\*\.dll\s+\S+)|(\.dll.*\.dll))"
  | table _time, host, user, process, signature_id | bin span=1s | stats values(*)
  as * by _time, host '
techniques:
- defense-evasion:masquerading
- defense-evasion:obfuscated files or information:binary padding
technique_id:
- T1036
- T1027.001
data_category:
- PowerShell logs
references:
- https://attack.mitre.org/techniques/T1027/001/
- https://news.sophos.com/en-us/2024/06/05/operation-crimson-palace-a-technical-deep-dive/

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<") (TERM(copy) OR TERM(robocopy) OR TERM(xcopy) OR ((TERM(type) OR TERM(Get-Content) OR "gc" OR "cat" OR TERM(more)) ">")) ".dll"

Stage 2: regex

| regex process="(?i)(copy|more|Get-Content|type|cat|gc)\s+.*?((\/b\s+\S+\.dll\s+\+\s*\S+\.dll)|(\*\.dll\s+\S+)|(\.dll.*\.dll))"

Stage 3: table

| table _time, host, user, process, signature_id

Stage 4: bucket

| bin span=1s

Stage 5: stats

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

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.

FieldKindValues
EventCodeeq
  • 4103 corpus 105 (splunk 105)
  • 4104 corpus 268 (splunk 268)
processregex_match
  • "(?i)(copy|more|Get-Content|type|cat|gc)\s+.*?((\/b\s+\S+.dll\s++\s*\S+.dll)|(*.dll\s+\S+)|(.dll.*.dll))" corpus 3 (splunk 3)

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.

StageTerm
1TERM
1"<EventID>4103<"
1TERM
1"<EventID>4104<"
1TERM
1copy
1TERM
1robocopy
1TERM
1xcopy
1TERM
1type
1"Get-Content"
1"gc"
1"cat"
1TERM
1more
1">"
1".dll"