Skip to main content
T1132Command and Controlmedium difficulty

Data Encoding

Data Encoding (T1132) is how malware disguises command and control traffic as normal web or DNS activity: base64, hex, or custom schemes hide beacon URLs, exfiltrated hostnames, and C2 commands inside HTTP headers and DNS queries. Detecting it means spotting the encoding artifacts, not decrypting anything, since the traffic usually isn't even encrypted underneath.

Practice detecting Data Encoding on realistic SIEM, XDR alerts in SOCSimulator Operations.

SIEMXDR

What is Data Encoding?

Data Encoding is documented as technique T1132 in MITRE ATT&CK® v19.1 under the Command and Control tactic. Detection requires visibility into SIEM, XDR telemetry.

Standard encoding leans on formats every network stack already understands: base64, hex, MIME, sometimes plain ASCII substitution. BADNEWS is the textbook case: it encrypts its C2 payload, converts the ciphertext to hexadecimal, then base64-encodes that hex string before it ever touches the wire. The result rides inside something mundane, an HTTP header, a User-Agent string, a cookie value, or a DNS query label, so a packet capture shows what looks like a normal web request rather than an obvious blob of ciphertext. YamaBot, attributed to Lazarus, base64-encodes its entire User-Agent string and stores RC4-encrypted, base64-encoded tasking inside a cookie named captcha_session, betting that analysts skim past cookie values the way they skim past User-Agent strings.

Non-standard encoding drops the shared alphabet and substitutes a scheme only the malware and its operator know, XOR against a hardcoded key before base64, a custom character-substitution table, or a passkey-gated format like Velvet Ant's, where commands only decode correctly if the responding implant already holds the right key. This buys resistance to generic decoders and signature matching built around known encodings, at the cost of needing the malware's own code (or a reverse engineer) to unwrap it.

Either way, encoding is a wrapper, not a lock. Base64 and hex are trivially reversible by anyone who notices the pattern, which is why detection here targets encoding artifacts (fixed prefixes, padding characters, alphabet composition, length) rather than trying to break anything cryptographic. The traffic frequently is not encrypted at the encoding layer at all, TLS handles confidentiality in transit and the encoding exists purely to make the payload look like ordinary text to a human or a naive content filter.

Where Data Encoding fits in an attack

Data encoding is not a single event in an intrusion, it is the transport layer for every check-in an implant makes for as long as it survives on the host. It shows up once initial access, execution, and persistence are already in place: the implant is live and now needs to talk home without tripping a proxy content filter or a signature that expects readable text. That puts it downstream of the initial foothold and running continuously alongside whatever the operator does next, credential access, lateral movement, staged exfiltration, rather than as a discrete step you catch once and move past.

POLONIUM's RunningRAT tool base64-encoded the compromised host's own IP address and username into outbound web request parameters, effectively phoning home its own inventory data disguised as query-string noise, a technique Microsoft's Sentinel team built a dedicated community analytic around. YamaBot layers RC4 encryption inside base64 encoding for both its User-Agent and its cookie-based tasking channel, a combination JPCERT/CC documented in Lazarus intrusions. What follows encoding in the chain is whatever the C2 channel was built to support, ongoing command execution via T1071 application-layer protocols, and eventually staged data leaving over the same encoded channel under T1041.

Detection Strategies

The following detection strategies help SOC analysts identify Data Encoding activity. These methods apply across SIEM, XDR environments and can be implemented as detection rules, correlation queries, or behavioral analytics in your security platform.

SPL
index=proxy sourcetype=proxy
| where match(http_user_agent, "^(Q2hyb21l|QXBwbGVXZWJLaX|RGFsdmlr|TW96aWxsY)") OR match(http_user_agent, "=$")
| table _time, src_ip, dest, http_user_agent, url

Flags proxy requests whose User-Agent starts with one of the four common base64 browser prefixes, or ends in padding. Mirrors SigmaHQ's 'Suspicious Base64 Encoded User-Agent' and 'Potential Base64 Encoded User-Agent' rules, cross-referenced against the JPCERT writeup on Lazarus's YamaBot, which base64-encodes its User-Agent verbatim.

SPL
index=dns sourcetype=zeek:dns
| where like(query, "%==.%")
| stats count by query, id.orig_h
| where count > 5

Catches DNS queries where a subdomain label contains the '==' base64 padding sequence, then requires more than five in a session to filter one-off noise. Mirrors SigmaHQ's 'Suspicious DNS Query with B64 Encoded String' rule, originally written for base64 DNS exfiltration frameworks.

Simulated example generated by SOCSimulator Research
2026-07-16 03:14:22 proxy.corp.local
src_ip: 10.44.12.19
host: ACCT-WKS-114.corp.local
method: GET
url: https://cdn-metrics-sync.net/api/v2/sync?t=1752633262
status: 200
http_user_agent: TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCk=
referer: -
bytes_out: 812

Tuning and false positives

Base64 shows up in legitimate traffic more than analysts expect. Some mobile SDKs and enterprise monitoring agents embed device telemetry as base64 inside a custom User-Agent or query parameter by design. OAuth and SSO flows pass base64url-encoded state and token parameters in redirect URLs as a matter of course, and those frequently end in padding characters too. CDN edge nodes sometimes base64-encode internal routing or cache-key metadata into request headers that never reach the origin server unmodified.

The fix is correlation, not exemption. Don't alert on the presence of base64 alone, require that the decoded content actually resolves to something meaningful and internal, an RFC 1918 address, an account name that matches a real user, a hostname from your own estate, before treating it as encoded exfiltration rather than a coincidental match. Allow-list destination domains you have already confirmed are known SaaS or CDN infrastructure, and weight repetition: a one-off base64 parameter in a login redirect is noise, but the same pattern beaconing every sixty seconds to an unfamiliar domain is the signal worth escalating.

Example Alerts

These realistic alert examples show what Data Encoding looks like in your security tools. Use them to tune detection rules and train analysts to recognize true positives versus false positives in live environments.

HighSIEM

Base64-Encoded User-Agent Beaconing to External Host

Proxy logs show ACCT-WKS-114.corp.local sending repeated HTTPS GET requests to cdn-metrics-sync.net with a User-Agent field beginning TW96aWxsYS81LjAgKFdpbmRvd3M, the base64-encoded form of 'Mozilla/5.0 (Windows'. The requests carry no referrer and repeat every 60 seconds, matching the YamaBot beaconing pattern rather than a real browser.

MediumXDR

Internal IP Address Disclosed via Base64 URL Parameter

DeviceNetworkEvents on FIN-WKS-207.corp.local logs an outbound connection to 185.220.101.44 whose request path includes the parameter id=MTkyLjE2OC4xLjIw, which decodes to the host's own internal address 192.168.1.20. Initiating process was svchost.exe under account amelia.rios, with no legitimate service that should egress host identity this way.

MediumSIEM

DNS Queries Carrying Base64 Padding to Newly Seen Domain

DNS logs from ACCT-WKS-114.corp.local show a burst of 40 queries in three minutes to subdomains ending in '==.exfil-relay.io', a domain first seen in passive DNS that week. The '==' padding sequence and query volume are inconsistent with any legitimate application on the host.

Responding to Data Encoding

Start by actually decoding the candidate string rather than triaging on pattern match alone. If it resolves to a dotted-quad or account name, check whether that IP or user belongs to your own environment, that is the signature of a host or account disclosing its own identity to an external party, not routine web traffic. Then look at what generated the request: an unfamiliar process spawning outbound connections is a different problem than a documented agent doing its normal job, and the parent process and account context usually settle which one you're looking at within a couple of minutes.

If the decoded content confirms internal host or account data leaving through an encoded channel to a domain with no legitimate business reason to have it, treat this as an active C2 channel, not a curiosity. Isolate the host from the network, block the destination domain at the proxy and firewall layer, and pull DeviceNetworkEvents or equivalent EDR telemetry for every other host that has contacted the same domain, encoding schemes like this are rarely used against a single machine. Preserve the host rather than reimaging immediately; the encoding scheme and any decoded tasking are often the fastest lead into what the operator was trying to accomplish.

Frequently Asked Questions

How do SOC analysts detect Data Encoding?
Detection centers on SIEM, XDR telemetry for the command and control phase of the attack. Base64-encoded User-Agent strings are a hard tell: Chrome, Mozilla, AppleWebKit and Dalvik all start their encoded form with a fixed prefix (Q2hyb21l, TW96aWxsY, QXBwbGVXZWJLaX, RGFsdmlr), so any c-useragent field that begins with one of those four strings, or simply ends in a bare equals-sign padding character, is almost never a real browser. In DNS logs, watch for query names containing '==.', the base64 padding sequence that surfaces when exfiltrated data or C2 tasking is stuffed into a subdomain label ahead of the real domain.
What does a Data Encoding alert look like?
A representative SIEM detection is "Base64-Encoded User-Agent Beaconing to External Host" (high severity): Proxy logs show ACCT-WKS-114.corp.local sending repeated HTTPS GET requests to cdn-metrics-sync.net with a User-Agent field beginning TW96aWxsYS81LjAgKFdpbmRvd3M, the base64-encoded form of 'Mozilla/5.0 (Windows'. The requests carry no referrer and repeat every 60 seconds, matching the YamaBot beaconing pattern rather than a real browser.
Which tools detect Data Encoding, and how can I practice?
Data Encoding (T1132) is best surfaced with SIEM, XDR telemetry, which exposes the command and control signals described above. Practice detecting it on those exact consoles in SOCSimulator Operations, free.
Glossary

What is Command and Control? SOC Glossary

Command and Control (C2) refers to the infrastructure and communication channels adversaries use to remotely direct malw…

Read more
Glossary

What is NDR? SOC Glossary

Network Detection and Response (NDR) is a security platform that passively monitors network traffic, using machine learn…

Read more
Glossary

What is Firewall? SOC Glossary

A firewall is a network security control that inspects traffic crossing a boundary and permits or denies it against a co…

Read more
Glossary

What is IOC? SOC Glossary

An Indicator of Compromise (IOC) is an observable artifact, such as a file hash, IP address, domain name, URL, registry …

Read more
Career Path

SOC Analyst (Tier 2) Career Guide: Salary & Skills

Tier 2 SOC Analysts handle the investigations that Tier 1 escalates. You dig into multi-stage attacks, coordinate contai…

Read more
Career Path

Threat Hunter Career Guide: Salary & Skills

Threat Hunters do not wait for alerts. You develop hypotheses based on threat intelligence and adversary behavior models…

Read more
Tool

SIEM Training Console: SOCSimulator

The SIEM console in SOCSimulator replicates the workflow of enterprise platforms like Splunk Enterprise Security, Micros…

Read more
Tool

XDR Training Console: SOCSimulator

The XDR console in SOCSimulator replicates the investigation workflow of platforms like CrowdStrike Falcon, Microsoft De…

Read more
Comparison

SOCSimulator Vs. Letsdefend: Platform Comparison

SOCSimulator wins on operational realism. You get multi-tool shift simulation with SLA pressure, noise injection, and al…

Read more
Glossary

SOC Glossary: Security Operations Terminology

Complete glossary of Security Operations Center terminology for aspiring SOC analysts.

Read more
Feature

Shift Mode: Real-Time SOC Simulation

Practice alert triage under realistic time pressure with SLA timers and noise injection.

Read more
Feature

Operations: Guided Training Operations

Structured CTF-style investigation operations covering real-world attack scenarios.

Read more