Detection rules › Splunk
DLL Concatenation (PowerShell)
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
| Tactic | Techniques |
|---|---|
| Stealth | T1027.001 Obfuscated Files or Information: Binary Padding, T1036 Masquerading |
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: '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.
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 | "<EventID>4103<" |
| 1 | TERM |
| 1 | "<EventID>4104<" |
| 1 | TERM |
| 1 | copy |
| 1 | TERM |
| 1 | robocopy |
| 1 | TERM |
| 1 | xcopy |
| 1 | TERM |
| 1 | type |
| 1 | "Get-Content" |
| 1 | "gc" |
| 1 | "cat" |
| 1 | TERM |
| 1 | more |
| 1 | ">" |
| 1 | ".dll" |