Detect Embedded Payloads in Splunk
Adversaries may embed payloads within other files to conceal malicious content from defenses. Otherwise seemingly benign files (such as scripts and executables) may be abused to carry and obfuscate malicious payloads and content. Adversaries have been observed embedding payloads as PE overlays, within resource sections of legitimate binaries, inside LNK file ExtraData fields, within Office VBA macros, and nested inside other file types. Notable examples include Emotet embedding executables in dropper binaries, DEADEYE embedding payloads in compiled binaries, Lazarus Group distributing malicious payloads in PNG files, Pikabot loading encrypted chunked PE sections, and Uroburos storing executable payloads in encrypted Queue files.
MITRE ATT&CK
- Tactic
- Defense Evasion
- Technique
- T1027 Obfuscated Files or Information
- Sub-technique
- T1027.009 Embedded Payloads
- Canonical reference
- https://attack.mitre.org/techniques/T1027/009/
SPL Detection Query
index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=11
(TargetFilename="*.exe" OR TargetFilename="*.dll" OR TargetFilename="*.bin" OR TargetFilename="*.shellcode")
(Image="*\\WINWORD.EXE" OR Image="*\\EXCEL.EXE" OR Image="*\\POWERPNT.EXE"
OR Image="*\\AcroRd32.exe" OR Image="*\\FoxitPDFReader.exe"
OR Image="*\\wscript.exe" OR Image="*\\cscript.exe" OR Image="*\\mshta.exe")
| eval IsOfficeExtract=if(match(Image, "(WINWORD|EXCEL|POWERPNT|AcroRd)"), 1, 0)
| eval IsScriptExtract=if(match(Image, "(wscript|cscript|mshta)"), 1, 0)
| table _time, host, User, TargetFilename, Image, IsOfficeExtract, IsScriptExtract
| sort - _time
| append [
search index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
(Image="*\\certutil.exe")
(CommandLine="*-decode*" OR CommandLine="*-urlcache*")
| table _time, host, User, Image, CommandLine
] Detects embedded payload drops by document readers and scripting engines (Sysmon Event ID 11) plus certutil decode operations. Office apps dropping PE files are a strong embedded payload indicator — legitimate Office processing never writes .exe or .dll files. The appended certutil search catches the common pattern of certutil being used to decode Base64-encoded embedded payloads.
Data Sources
Required Sourcetypes
False Positives & Tuning
- certutil -decode used by IT for legitimate certificate file conversion operations
- Office add-ins that legitimately extract DLL components during first-run setup
- PDF forms that extract helper executables for PDF form processing
- Scripting engines extracting legitimate resource files as part of software installation
Other platforms for T1027.009
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Extract Embedded Payload from PE Overlay with certutil
Expected signal: Sysmon Event ID 1: certutil.exe with -encode and then -decode arguments. Sysmon Event ID 11: encoded_payload.txt and extracted_payload.exe created in %TEMP%. The -decode operation creates an executable from a text file.
- Test 2Office Macro Dropping Embedded Executable
Expected signal: Sysmon Event ID 1: PowerShell spawning Word COM object. Word process creating a document with VBA code. File creation of macro_test.doc.
- Test 3Embed Payload in PE Resources Section
Expected signal: PowerShell process creation demonstrating the concept. Binary data file creation in %TEMP%.
- Test 4Extract Payload from LNK ExtraData Field
Expected signal: Sysmon Event ID 11: embedded_lnk.lnk created in %TEMP%. Sysmon Event ID 1: cmd.exe spawned from LNK execution with arguments. Sysmon Event ID 11: lnk_output.txt created.
References (5)
- https://attack.mitre.org/techniques/T1027/009/
- https://github.com/peewpw/Invoke-PSImage
- https://www.cisa.gov/uscert/ncas/analysis-reports/ar20-303a
- https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-shllink/c41e062d-f764-4f13-bd4f-ea812ab9a4d1
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1027.009/T1027.009.md
Unlock Pro Content
Get the full detection package for T1027.009 including response playbook, investigation guide, and atomic red team tests.