Detect Standard Encoding in Elastic Security
Adversaries may encode data with a standard data encoding system to make the content of command and control traffic more difficult to detect. Command and control (C2) information can be encoded using a standard data encoding system that adheres to existing protocol specifications. Common data encoding schemes include ASCII, Unicode, hexadecimal, Base64, and MIME. Some data encoding systems may also result in data compression, such as gzip. Malware families including SideTwist, Fysbis, Latrodectus, SeaDuke, Chaes, and Flagpro have all used Base64-encoded C2 traffic, making this one of the most prevalent C2 obfuscation techniques observed in the wild.
MITRE ATT&CK
- Tactic
- Command and Control
- Technique
- T1132 Data Encoding
- Sub-technique
- T1132.001 Standard Encoding
- Canonical reference
- https://attack.mitre.org/techniques/T1132/001/
Elastic Detection Query
process where event.type == "start" and
(
(
process.name : "certutil.exe" and
process.args : ("-decode", "/decode", "-encode", "/encode", "-urlcache", "/urlcache")
) or
(
process.name : ("powershell.exe", "pwsh.exe") and
(
process.command_line : ("*-EncodedCommand*", "*-enc *", "*-ec *") or
process.command_line : ("*FromBase64String*", "*-encodedcommand*")
)
) or
process.command_line : (
"*[Convert]::FromBase64String*",
"*[Convert]::ToBase64String*",
"*FromBase64String*",
"*ToBase64String*",
"*base64 -d *",
"*base64 --decode*"
)
) Detects T1132.001 Standard Encoding C2 using Elastic Common Schema process launch events. Covers three branches: certutil LOLBin abuse (-decode/-encode/-urlcache), PowerShell encoded command execution (-EncodedCommand/-enc/-ec), and explicit .NET Base64 conversion calls (FromBase64String/ToBase64String). The EQL `:` operator performs case-insensitive wildcard matching against process.command_line.
Data Sources
Required Tables
False Positives & Tuning
- IT administrators using certutil.exe for legitimate PKI operations including certificate encoding, MIME conversion, or PKCS#7 file handling during certificate lifecycle management tasks
- Enterprise management platforms (SCCM, Intune, Ansible WinRM) deploying PowerShell scripts via -EncodedCommand to safely transmit multi-line scripts over WMI or scheduled task XML without shell escaping issues
- Software build pipelines and CI/CD agents embedding Base64-encoded configuration tokens or license keys in process command lines during artifact packaging or application deployment workflows
Other platforms for T1132.001
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 1PowerShell Base64 Encode and Decode Round-Trip
Expected signal: Sysmon Event ID 1: Process Create with CommandLine containing 'ToBase64String', 'FromBase64String', and 'IEX'. PowerShell ScriptBlock Log Event ID 4104 will capture the decoded content 'hostname; whoami'. Security Event ID 4688 (if command line auditing enabled) with full command line.
- Test 2certutil Base64 Decode to File
Expected signal: Sysmon Event ID 1: Process Create with Image=certutil.exe, CommandLine containing '-decode' and file paths. Sysmon Event ID 11: File Create events for both %TEMP%\encoded.b64 and %TEMP%\decoded.txt. Security Event ID 4688 with certutil command line (if auditing enabled).
- Test 3Base64 Encoded C2 Beacon Simulation via PowerShell
Expected signal: Sysmon Event ID 1: Process Create with CommandLine containing 'ToBase64String', 'Net.WebClient', and 'UploadString'. Sysmon Event ID 3: Network Connection attempt to 127.0.0.1:8888 (will fail — no listener). PowerShell ScriptBlock Log Event ID 4104 capturing the full encoding + upload script.
- Test 4Linux Base64 C2 Exfil Simulation via curl
Expected signal: Linux auditd or Sysmon for Linux: process creation events for 'base64' and 'curl' with command line arguments. Syslog: process execution entries. Network: outbound connection attempt to 127.0.0.1:9999 from curl.
References (9)
- https://attack.mitre.org/techniques/T1132/001/
- https://en.wikipedia.org/wiki/Binary-to-text_encoding
- https://en.wikipedia.org/wiki/Base64
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-deviceprocessevents-table
- https://learn.microsoft.com/en-us/sysinternals/downloads/sysmon
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1132.001/T1132.001.md
- https://research.checkpoint.com/2021/irans-apt34-returns-with-an-updated-arsenal/
- https://www.elastic.co/security-labs/spring-cleaning-with-latrodectus
- https://www.zscaler.com/blogs/security-research/lyceum-net-dns-backdoor
Unlock Pro Content
Get the full detection package for T1132.001 including response playbook, investigation guide, and atomic red team tests.