Response playbooks, investigation guides, and Atomic Red Team tests are Pro-only. Upgrade to unlock the full detection package for T1027.013.

Upgrade to Pro
T1027.013 Elastic Security · Elastic

Detect Encrypted/Encoded File in Elastic Security

This detection identifies adversary use of encrypted or encoded files to conceal malicious payloads, configurations, or command-and-control artifacts from static analysis and signature-based detection. Adversaries commonly apply Base64 encoding, XOR ciphers, AES/RC4 encryption, or layered encoding schemes to files dropped on victim hosts, phishing attachments (password-protected documents, self-extracting archives), or scripts that decode and execute payloads at runtime. Detection focuses on processes decoding or decrypting file content, suspicious file entropy indicators surfaced via tooling, script interpreters reading encoded blobs, and the creation of high-entropy files in user-writable directories.

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/

Elastic Detection Query

Elastic Security (Elastic)
eql
sequence by host.name, user.name with maxspan=2m
  [process where event.type == "start" and
   process.name : ("certutil.exe", "powershell.exe", "pwsh.exe", "python.exe", "python3", "wscript.exe", "cscript.exe", "mshta.exe") and
   process.args : ("-decode", "-decodehex", "-EncodedCommand", "-enc", "FromBase64String", "base64", "openssl") and
   process.command_line : ("*-decode*", "*-decodehex*", "*FromBase64String*", "*-EncodedCommand*", "*openssl enc*", "*base64 -d*")]
  [file where event.type in ("creation", "change") and
   file.path : ("C:\\Users\\*\\AppData\\*", "C:\\ProgramData\\*", "C:\\Windows\\Temp\\*", "/tmp/*", "/var/tmp/*") and
   not file.extension : ("log", "txt", "xml", "json")]
high severity medium confidence

Detects a sequence where a decoding/decryption-capable process executes with encoding-related arguments, followed within 2 minutes by file creation or modification in writable temporary directories — a pattern consistent with a payload being decoded to disk for execution.

Data Sources

Elastic AgentWinlogbeatAuditbeat

Required Tables

processfile

False Positives & Tuning

  • Software installers that unpack Base64-encoded payloads to temp directories during installation
  • Legitimate developer scripts decoding certificates or configuration files
  • Backup agents that compress and decode data to temporary paths

Other platforms for T1027.013


Testing Methodology

Validate this detection against 3 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 1certutil Base64 Decode to Disk

    Expected signal: DeviceProcessEvents: certutil.exe with -decode argument; Sysmon Event ID 1 with CommandLine containing '-decode'; Sysmon Event ID 11 showing decoded_payload.bin creation in C:\Windows\Temp

  2. Test 2PowerShell In-Memory Base64 Payload Decode

    Expected signal: DeviceProcessEvents: powershell.exe with FromBase64String in command line; PowerShell Script Block Log Event ID 4104 containing FromBase64String and [Convert]::FromBase64; Sysmon Event ID 11 for decoded_ps_payload.bin creation

  3. Test 3OpenSSL AES Decrypt File on Linux

    Expected signal: Linux auditd execve syscall records for base64 and openssl processes; Syslog entries for process execution; Elastic Auditbeat process events showing openssl enc -d with -aes-256-cbc arguments; file creation event for decrypted_payload.bin in /tmp

Unlock playbooks & atomic tests with Pro

Get the full detection package for T1027.013 — response playbook and atomic red team tests, plus investigation guidance and hunting queries.

df00tech Pro — £29/user/month

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections