T1132.002 Google Chronicle · YARA-L

Detect Non-Standard Encoding in Google Chronicle

Adversaries may encode data with a non-standard data encoding system to make the content of command and control traffic more difficult to detect. Non-standard encoding schemes diverge from existing protocol specifications — for example, modified Base64 using a custom alphabet, XOR encoding with a static or rolling key, character substitution (replacing '/' with '-s', '+' with '-p'), or custom binary serialization. Real-world examples include OceanSalt (NOT operation on bytes), Small Sieve (hex byte swapping), TONESHELL (XOR with 32/256-byte key), NightClub (modified Base64 in DNS subdomains), RDAT (Base64 with character substitutions in DNS), InvisiMole (modified Base32 in DNS subdomains), and Uroburos (custom Base62/Base32). Detection focuses on anomalous DNS subdomain lengths and entropy, unusual encoded patterns in network traffic, and scripting processes generating high-entropy outbound data.

MITRE ATT&CK

Tactic
Command and Control
Technique
T1132 Data Encoding
Sub-technique
T1132.002 Non-Standard Encoding
Canonical reference
https://attack.mitre.org/techniques/T1132/002/

YARA-L Detection Query

Google Chronicle (YARA-L)
yaral
rule t1132_002_non_standard_encoding_dns {
  meta:
    author = "Argus Detection Engineering"
    description = "Detects T1132.002: Non-Standard Encoding — DNS subdomains with Base64, modified Base64, or hex-encoded first labels exceeding 50 characters. Covers TONESHELL, NightClub (DNS modified Base64), RDAT (Base64 with substitutions in DNS), and InvisiMole (modified Base32) families."
    severity = "HIGH"
    priority = "HIGH"
    mitre_attack_tactic = "Command and Control"
    mitre_attack_technique = "T1132.002"
    confidence = "MEDIUM"
    false_positives = "CDN hash-based subdomains, ngrok/localtunnel proxy subdomains, DNS-based service mesh identifiers"
    version = "1.0"

  events:
    $dns.metadata.event_type = "NETWORK_DNS"
    $dns.network.dns.questions.name != ""
    (
      re.regex($dns.network.dns.questions.name, `^[A-Za-z0-9+/=]{50,}\.`) nocase or
      re.regex($dns.network.dns.questions.name, `^[A-Za-z0-9_\-]{50,}\.`) nocase or
      re.regex($dns.network.dns.questions.name, `^[0-9a-fA-F]{50,}\.`) nocase
    )
    $dns.principal.hostname != ""

  match:
    $dns.principal.hostname over 1h

  outcome:
    $event_count = count_distinct($dns.network.dns.questions.name)
    $queried_names = array_distinct($dns.network.dns.questions.name)
    $process_paths = array_distinct($dns.principal.process.file.full_path)
    $users = array_distinct($dns.principal.user.userid)

  condition:
    $dns
}

rule t1132_002_non_standard_encoding_http {
  meta:
    author = "Argus Detection Engineering"
    description = "Detects T1132.002: Non-Standard Encoding — HTTP/S requests with anomalously long path segments or query parameters consistent with custom Base64, XOR-encoded, or character-substituted C2 payloads transmitted over standard web protocols."
    severity = "HIGH"
    priority = "MEDIUM"
    mitre_attack_tactic = "Command and Control"
    mitre_attack_technique = "T1132.002"
    confidence = "MEDIUM"
    false_positives = "SaaS platforms with long JWT tokens in URLs, package managers with hash-encoded integrity parameters"
    version = "1.0"

  events:
    $http.metadata.event_type = "NETWORK_HTTP"
    $http.network.http.method != ""
    (
      re.regex($http.target.url, `/[A-Za-z0-9_\-]{60,}(/|\?|$)`) nocase or
      re.regex($http.target.url, `[?&][a-z]{1,4}=[A-Za-z0-9+/_%\-]{60,}`) nocase
    )
    $http.principal.hostname != ""

  condition:
    $http
}
high severity medium confidence

Two Chronicle YARA-L 2.0 rules targeting T1132.002: (1) DNS rule groups NETWORK_DNS events by principal.hostname over 1-hour windows, matching first subdomain labels against Base64, URL-safe Base64, and hex encoding patterns; collects distinct queried names, process paths, and users in outcome fields for analyst triage. (2) HTTP rule triggers on NETWORK_HTTP events where target.url contains long encoded path segments or query parameters. Both rules use UDM field model and re.regex() with nocase modifier. Covers TONESHELL, NightClub, RDAT, InvisiMole, Uroburos, and OceanSalt malware families.

Data Sources

Chronicle UDM (Unified Data Model) — NETWORK_DNS eventsChronicle UDM — NETWORK_HTTP eventsChronicle forwarder: Zeek DNS/HTTP, Windows Sysmon, Google Cloud DNS

Required Tables

udm_events (event_type: NETWORK_DNS)udm_events (event_type: NETWORK_HTTP)

False Positives & Tuning

  • Cloud provider health check subdomains using Base64-encoded endpoint identifiers (AWS ALB, GCP GCLB, Azure Traffic Manager) — whitelist by target principal.hostname for known cloud provider FQDN suffixes
  • Mobile analytics SDKs encoding device fingerprints or crash report tokens as long Base64 strings in HTTP query parameters to vendor collection endpoints
  • Zero-trust network access and VPN solutions embedding encoded session certificates or ephemeral tokens in DNS-over-HTTPS subdomain labels for split-tunnel routing
Download portable Sigma rule (.yml)

Other platforms for T1132.002


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.

  1. Test 1Simulate DNS Tunneling with Modified Base64 Subdomain Encoding

    Expected signal: Sysmon Event ID 22 (DNS Query): QueryName will contain a long alphanumeric subdomain label (length > 30 characters) matching the pattern [a-z0-9ps]{30,}\.df00tech-test\.local. Sysmon Event ID 1 (Process Create): powershell.exe with command line containing Base64, Replace, and Resolve-DnsName. PowerShell ScriptBlock Log Event ID 4104 capturing the encoding logic.

  2. Test 2XOR-Encoded C2 Data Transmission Simulation (TONESHELL Pattern)

    Expected signal: Sysmon Event ID 1: powershell.exe with CommandLine containing -bxor, New-Object System.Net.WebClient, and UploadString. Sysmon Event ID 3: Network connection attempt to 127.0.0.1:8080 (connection will be refused but event fires). PowerShell ScriptBlock Log Event ID 4104 capturing the full XOR encoding loop and WebClient upload code.

  3. Test 3High-Volume DNS Query Burst Simulating DNS Tunneling Data Transfer

    Expected signal: 25x Sysmon Event ID 22 (DNS Query) events within ~5 seconds, each with a unique QueryName containing a long base64-like subdomain label (length 40-70 characters) under df00tech-dnstest.local. All queries initiated by powershell.exe. The burst pattern with unique subdomains matches DNS tunneling telemetry.

  4. Test 4HTTP C2 with Custom Base64 Alphabet Encoding (Neo-reGeorg Pattern)

    Expected signal: Sysmon Event ID 1: powershell.exe with CommandLine containing IndexOf, ToCharArray, WebClient, and UploadString — all indicators of custom encoding implementation. Sysmon Event ID 3: Network connection to 127.0.0.1:8080. PowerShell ScriptBlock Log Event ID 4104 capturing the full custom alphabet encoding logic. If stream:http is available, the POST body will contain d=<60+ char custom-alphabet string>.

Unlock Pro Content

Get the full detection package for T1132.002 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections