Detect Data Encoding in CrowdStrike LogScale
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/
LogScale Detection Query
// T1132 Data Encoding — C2 Traffic Obfuscation Detection
// Covers certutil LOLBin, scripting encode+network, PowerShell Base64+net, curl/wget encoded args
#event_simpleName=ProcessRollup2
| eval cmdline = lower(CommandLine)
| eval img = lower(FileName)
// Branch 1: certutil used for encoding or decoding
| eval certutil_encoding = if(
img = "certutil.exe"
AND (cmdline = "*-encode*" OR cmdline = "*-decode*" OR cmdline = "*-urlcache*"),
1, 0)
// Branch 2: scripting interpreter combining encoding + network
| eval script_encode_net = if(
(img = "*python*.exe" OR img = "perl.exe" OR img = "php.exe"
OR img = "ruby.exe" OR img = "node.exe" OR img = "nodejs")
AND (cmdline = "*base64*" OR cmdline = "*b64encode*" OR cmdline = "*b64decode*"
OR cmdline = "*binascii*" OR cmdline = "*hexlify*" OR cmdline = "*unhexlify*"
OR cmdline = "*gzip*" OR cmdline = "*zlib*" OR cmdline = "*btoa*" OR cmdline = "*atob*")
AND (cmdline = "*http://*" OR cmdline = "*https://*" OR cmdline = "*socket*"
OR cmdline = "*urllib*" OR cmdline = "*requests.*" OR cmdline = "*connect(*"),
1, 0)
// Branch 3: PowerShell Base64 conversion with network class invocation
| eval ps_encode_net = if(
(img = "powershell.exe" OR img = "pwsh.exe")
AND (cmdline = "*frombase64string*" OR cmdline = "*tobase64string*"
OR cmdline = "*[convert]:*" OR cmdline = "*system.convert*")
AND (cmdline = "*net.webclient*" OR cmdline = "*invoke-webrequest*"
OR cmdline = "*invoke-restmethod*" OR cmdline = "*tcpclient*"
OR cmdline = "*udpclient*" OR cmdline = "*downloadstring*" OR cmdline = "*uploadstring*"),
1, 0)
// Branch 4: curl or wget carrying long encoded argument strings
| eval encoded_net_util = if(
(img = "curl.exe" OR img = "wget.exe" OR img = "curl" OR img = "wget")
AND len(CommandLine) > 120,
1, 0)
| eval total_score = certutil_encoding + script_encode_net + ps_encode_net + encoded_net_util
| where total_score > 0
| table timestamp, ComputerName, UserName, FileName, CommandLine,
ParentBaseFileName, ParentCommandLine,
certutil_encoding, script_encode_net, ps_encode_net, encoded_net_util, total_score
| sort timestamp desc CrowdStrike LogScale (Falcon) detection for T1132 Data Encoding C2 obfuscation. Queries ProcessRollup2 events to identify four attack patterns: certutil encoding/decoding operations, scripting interpreters pairing encoding functions with network calls, PowerShell Base64 conversion combined with networking classes, and curl/wget processes with unusually large command-line arguments indicative of embedded encoded payloads.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate software deployment pipelines using PowerShell with Invoke-WebRequest and Base64-encoded configuration strings for automated provisioning tasks
- Security researchers or red team operators on authorized engagements running encoding tests or proof-of-concept scripts in isolated environments
- Package managers and language runtime installers (pip, npm, gem) that use curl or wget with long URLs containing encoded checksums or authentication tokens
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.