T1027.013 Splunk · SPL

Detect Encrypted/Encoded File in Splunk

Adversaries encrypt or encode files to conceal malicious content and evade static signature detection. Techniques include XOR (single-byte and multi-byte), RC4, AES, 3DES, Base64, and custom encoding schemes applied to malware payloads, configuration files, C2 communication blobs, and dropped files. The full content or only specific values (such as C2 addresses or strings) may be obfuscated, sometimes in multiple redundant layers. Common delivery vectors include password-protected ZIP/Word documents and self-extracting (SFX) archives. Threat actors ranging from APT28 and Inception Group to ransomware families like Qilin and RansomHub consistently use encrypted/encoded files to defeat antivirus and EDR static analysis.

MITRE ATT&CK

Tactic
Defense Evasion
Technique
T1027 Obfuscated Files or Information
Sub-technique
T1027.013 Encrypted/Encoded File
Canonical reference
https://attack.mitre.org/techniques/T1027/013/

SPL Detection Query

Splunk (SPL)
spl
index=windows (sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" OR sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" OR sourcetype="WinEventLog:Security")
| eval EventCode=coalesce(EventCode, event_id)
| search EventCode IN (1, 4688, 11)
| eval detection_type=case(
    EventCode IN (1, 4688) AND match(lower(Image), "certutil\.exe") AND match(lower(CommandLine), "-(decode|decodehex)"), "certutil_decode",
    EventCode IN (1, 4688) AND match(lower(Image), "powershell\.exe") AND match(CommandLine, "(?i)(FromBase64String|\\[Convert\\]).*(?i)(iex|Invoke-Expression|&\(|\.Invoke)"), "powershell_b64_decode_exec",
    EventCode IN (1, 4688) AND match(lower(Image), "powershell\.exe") AND match(CommandLine, "(?i)-bxor|bxor"), "powershell_xor_decode",
    EventCode IN (1, 4688) AND match(lower(Image), "(7z|7za|winrar|wrar)\.exe") AND match(CommandLine, "-p\S+"), "password_protected_archive",
    EventCode IN (1, 4688) AND match(lower(Image), "(mshta|wscript|cscript)\.exe") AND match(CommandLine, "(?i)(Base64|FromBase64|bxor)"), "scripting_engine_encoded_exec",
    EventCode=11 AND match(lower(TargetFilename), "\\(temp|appdata).*\.(bin|dat|enc|tmp)") AND match(lower(Image), "(powershell|cmd|wscript|cscript|mshta)\.exe"), "suspicious_encoded_file_drop",
    true(), null()
)
| search detection_type=*
| eval risk_score=case(
    detection_type="powershell_b64_decode_exec", 85,
    detection_type="powershell_xor_decode", 80,
    detection_type="certutil_decode", 75,
    detection_type="scripting_engine_encoded_exec", 75,
    detection_type="password_protected_archive", 55,
    detection_type="suspicious_encoded_file_drop", 60,
    true(), 50
)
| table _time, Computer, detection_type, risk_score, Image, CommandLine, TargetFilename, ParentImage
| sort -risk_score
medium severity medium confidence

Covers the most common runtime decryption/decoding patterns seen in commodity malware and APT toolkits. Password-protected archive detection (risk 55) has higher FP potential from legitimate compressed file use. PowerShell Base64 decode+execute (risk 85) is high confidence — very few legitimate use cases combine [Convert]::FromBase64String with Invoke-Expression.

Download portable Sigma rule (.yml)

Other platforms for T1027.013


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.

  1. Test 1Base64 Encode, Drop, and Decode with certutil

    Expected signal: Sysmon EventCode 1 (ProcessCreate) for certutil.exe with '-decode' in CommandLine. EventCode 11 for both the .b64 source file and decoded output file creation in %TEMP%.

  2. Test 2PowerShell XOR Decryption Simulating Single-Byte XOR Malware

    Expected signal: Sysmon EventCode 1 (ProcessCreate) for powershell.exe. PowerShell Script Block Logging EventCode 4104 will capture the deobfuscated script including the -bxor operator and Invoke-Expression call.

  3. Test 3Password-Protected ZIP Delivery and Extraction

    Expected signal: Sysmon EventCode 1 for 7z.exe invocations with '-p' flag in CommandLine. EventCode 11 for .zip creation and extracted file creation in %TEMP%.

  4. Test 4Base64 Blob Decode and Execute via PowerShell

    Expected signal: Sysmon EventCode 1 for powershell.exe. PowerShell Script Block Logging EventCode 4104 will capture both the FromBase64String call and the decoded Invoke-Expression content — this is the primary high-value telemetry source.

Unlock Pro Content

Get the full detection package for T1027.013 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections