Detect Data Encoding in Sumo Logic CSE
Adversaries may encode data 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. Use of data encoding may adhere to existing protocol specifications and includes use of ASCII, Unicode, Base64, MIME, or other binary-to-text and character encoding systems. Some data encoding systems may also result in data compression, such as gzip. Real-world examples include BADNEWS converting encrypted C2 data to hexadecimal then Base64 before transmission, Ursnif embedding Base64-encoded data in HTTP URLs, H1N1 using an altered Base64 scheme for C2 traffic, and Linux Rabbit sending encoded payloads as URL parameters.
MITRE ATT&CK
- Tactic
- Command and Control
- Technique
- T1132 Data Encoding
- Canonical reference
- https://attack.mitre.org/techniques/T1132/
Sumo Detection Query
_sourceCategory=windows/sysmon OR _sourceCategory=endpoint/process
| json auto
| where EventCode = "1" OR event_type = "process"
| fields _messageTime, Computer, User, Image, CommandLine, ParentImage, ParentCommandLine
| eval cmdline = toLowerCase(CommandLine)
| eval img = toLowerCase(Image)
// Branch 1: certutil encoding/decoding
| eval certutil_encoding = if(
img matches "*certutil.exe*"
AND (cmdline matches "*-encode*" OR cmdline matches "*-decode*" OR cmdline matches "*-urlcache*"),
1, 0)
// Branch 2: scripting interpreter with encoding + network primitives
| eval script_encode_net = if(
(img matches "*python*.exe*" OR img matches "*perl.exe*" OR img matches "*php.exe*"
OR img matches "*ruby.exe*" OR img matches "*node.exe*" OR img matches "*nodejs*")
AND (cmdline matches "*base64*" OR cmdline matches "*b64encode*" OR cmdline matches "*b64decode*"
OR cmdline matches "*binascii*" OR cmdline matches "*hexlify*" OR cmdline matches "*unhexlify*"
OR cmdline matches "*zlib*" OR cmdline matches "*gzip*" OR cmdline matches "*btoa*" OR cmdline matches "*atob*")
AND (cmdline matches "*http://*" OR cmdline matches "*https://*" OR cmdline matches "*socket*"
OR cmdline matches "*urllib*" OR cmdline matches "*requests.*" OR cmdline matches "*connect(*"),
1, 0)
// Branch 3: PowerShell Base64 + network class combo
| eval ps_encode_net = if(
(img matches "*powershell.exe*" OR img matches "*pwsh.exe*")
AND (cmdline matches "*frombase64string*" OR cmdline matches "*tobase64string*"
OR cmdline matches "*[convert]:*" OR cmdline matches "*system.convert*")
AND (cmdline matches "*net.webclient*" OR cmdline matches "*invoke-webrequest*"
OR cmdline matches "*invoke-restmethod*" OR cmdline matches "*tcpclient*"
OR cmdline matches "*udpclient*" OR cmdline matches "*uploadstring*" OR cmdline matches "*downloadstring*"),
1, 0)
// Branch 4: curl/wget with long encoded argument strings
| eval encoded_net_util = if(
(img matches "*curl.exe*" OR img matches "*wget.exe*" OR img matches "*/curl" OR img matches "*/wget")
AND (length(CommandLine) > 120)
AND (cmdline matches "*=*"),
1, 0)
| eval total_score = certutil_encoding + script_encode_net + ps_encode_net + encoded_net_util
| where total_score > 0
| fields _messageTime, Computer, User, Image, CommandLine, ParentImage, ParentCommandLine,
certutil_encoding, script_encode_net, ps_encode_net, encoded_net_util, total_score
| sort by _messageTime desc Detects T1132 Data Encoding patterns used for C2 obfuscation. Uses Sumo Logic CSE process event normalization to identify certutil LOLBin encoding operations, scripting interpreters pairing encoding libraries with network calls, PowerShell Base64 conversion with networking classes, and curl/wget with suspiciously large encoded command-line arguments.
Data Sources
Required Tables
False Positives & Tuning
- CI/CD pipeline agents (Jenkins, GitLab Runner) that use Python or Node.js to encode build artifacts and upload to artifact registries over HTTPS
- System administrators using PowerShell with Invoke-WebRequest and Base64-encoded credentials for automation against REST APIs
- Software deployment tools that invoke curl with large encoded payloads for configuration management (Ansible, Chef, Puppet)
Other platforms for T1132
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 1certutil Base64 Encode Reconnaissance Output and Transmit via curl
Expected signal: Sysmon Event ID 1: Process Create for certutil.exe with CommandLine containing '-encode %TEMP%\recon_out.txt'. Sysmon Event ID 11: File Create for %TEMP%\recon_encoded.b64. Sysmon Event ID 1: Subsequent Process Create for curl.exe with CommandLine containing '--data-binary @' and the encoded temp file. Sysmon Event ID 3: Network Connection from curl.exe to 127.0.0.1:8080 (connection refused, but event fires).
- Test 2Python Base64-Encoded System Fingerprint Beacon
Expected signal: Sysmon Event ID 1: Process Create for python.exe (or python3.exe) with CommandLine containing 'base64', 'urllib.request', 'socket', and 'os'. Sysmon Event ID 3: Network Connection attempt from python.exe to 127.0.0.1:8080.
- Test 3PowerShell ToBase64String with WebClient POST
Expected signal: Sysmon Event ID 1: Process Create for powershell.exe with CommandLine containing 'ToBase64String', '[System.Convert]::', 'Net.WebClient', and 'UploadString'. Sysmon Event ID 3: Network Connection attempt from powershell.exe to 127.0.0.1:8080. PowerShell ScriptBlock Log Event ID 4104 in Microsoft-Windows-PowerShell/Operational captures the full script including the ToBase64String call.
- Test 4Hex-Encoded C2 Data via Python binascii and subprocess curl
Expected signal: Sysmon Event ID 1: Process Create for python.exe with CommandLine containing 'binascii', 'hexlify', and 'subprocess'. Sysmon Event ID 1: Child Process Create for curl.exe with CommandLine containing 'http://127.0.0.1:8080/q?d=' followed by a hex-encoded string of 40+ characters. Sysmon Event ID 3: Network Connection attempt from curl.exe to 127.0.0.1:8080.
References (12)
- https://attack.mitre.org/techniques/T1132/
- https://attack.mitre.org/techniques/T1132/001/
- https://attack.mitre.org/techniques/T1132/002/
- https://en.wikipedia.org/wiki/Binary-to-text_encoding
- https://en.wikipedia.org/wiki/Character_encoding
- https://arxiv.org/ftp/arxiv/papers/1408/1408.1136.pdf
- https://www.proofpoint.com/us/threat-insight/post/ursnif-variant-dreambot-adds-tor-functionality
- https://www.anomali.com/blog/pulling-linux-rabbit-rabbot-malware-out-of-a-hat
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1132/T1132.md
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicenetworkevents-table
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-deviceprocessevents-table
- https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/CommonStatsFunctions
Unlock Pro Content
Get the full detection package for T1132 including response playbook, investigation guide, and atomic red team tests.