T1132: Data Encoding

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.

Positive Technologies products that cover the technique

Detection

PT NAD can detect encoded requests to C2 servers. Some triggered rules, marked as SUSPICIOUS, should be verified by the operator as they are based on indirect indicators of an attack. Most post-exploitation and hacking tools can encode data before sending it to the C2 server. For example, the Cobalt Strike or Brute Ratel post-exploitation tools can encode agent's data to Base64 before sending it to the C2 server. Such malicious activity can be detected using rules or modules of the activity stream.

Examples of PT NAD detection rules

  • SUSPICIOUS [PTsecurity] HostName in Base64 Exfil (sid 10006584)
  • TOOLS [PTsecurity] Sliver C2 HTTP Key exchange (Base64gzip) (sid 10008538)

PT NAD detection modules

  • Cobalt Strike usage
  • Brute Ratel usage

Detection

IDDS0029Data source and componentNetwork Traffic: Network Traffic ContentDescription

Monitor for network data for uncommon data flows (e.g., a client sending significantly more data than it receives from a server). Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Analyze packet contents to detect communications that do not follow the expected protocol behavior for the port that is being used.

Note: Network Analysis frameworks such as Zeek can be used to capture, decode, and alert on network protocols and packet contents.

Mitigation

IDM1031NameNetwork Intrusion PreventionDescription

Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary malware can be used to mitigate activity at the network level. Signatures are often for unique indicators within protocols and may be based on the specific obfuscation technique used by a particular adversary or tool, and will likely be different across various malware families and versions. Adversaries will likely change tool C2 signatures over time or construct protocols in such a way as to avoid detection by common defensive tools.