T1132 IBM QRadar · QRadar

Detect Data Encoding in IBM QRadar

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/

QRadar Detection Query

IBM QRadar (QRadar)
sql
SELECT
  DATEFORMAT(devicetime, 'yyyy-MM-dd HH:mm:ss') AS event_time,
  logsourcename(logsourceid) AS log_source,
  username,
  sourceip,
  "Process Name" AS process_name,
  "Command" AS command_line,
  "Parent Process Name" AS parent_process,
  CASE
    WHEN LOWER("Process Name") LIKE '%certutil.exe%'
         AND (LOWER("Command") LIKE '%-encode%' OR LOWER("Command") LIKE '%-decode%' OR LOWER("Command") LIKE '%-urlcache%')
      THEN 'CertutilEncoding'
    WHEN LOWER("Process Name") SIMILAR TO '%(python[23]?\.exe|perl\.exe|php\.exe|ruby\.exe|node\.exe|nodejs)%'
         AND (LOWER("Command") LIKE '%base64%' OR LOWER("Command") LIKE '%b64encode%' OR LOWER("Command") LIKE '%hexlify%' OR LOWER("Command") LIKE '%binascii%' OR LOWER("Command") LIKE '%gzip%')
         AND (LOWER("Command") LIKE '%http://%' OR LOWER("Command") LIKE '%https://%' OR LOWER("Command") LIKE '%socket%' OR LOWER("Command") LIKE '%requests.%')
      THEN 'ScriptingEncodeNetwork'
    WHEN LOWER("Process Name") SIMILAR TO '%(powershell\.exe|pwsh\.exe)%'
         AND (LOWER("Command") LIKE '%frombase64string%' OR LOWER("Command") LIKE '%tobase64string%' OR LOWER("Command") LIKE '%[convert]%' OR LOWER("Command") LIKE '%system.convert%')
         AND (LOWER("Command") LIKE '%net.webclient%' OR LOWER("Command") LIKE '%invoke-webrequest%' OR LOWER("Command") LIKE '%invoke-restmethod%' OR LOWER("Command") LIKE '%tcpclient%' OR LOWER("Command") LIKE '%downloadstring%')
      THEN 'PSEncodeNetwork'
    WHEN LOWER("Process Name") SIMILAR TO '%(curl\.exe|wget\.exe|\bcurl|\bwget)%'
         AND (CHAR_LENGTH("Command") > 120)
      THEN 'EncodedNetworkUtil'
    ELSE 'Unknown'
  END AS detection_branch
FROM events
WHERE
  LOGSOURCETYPEID IN (12, 13, 14, 215, 260, 369)
  AND devicetime > NOW() - 86400000
  AND (
    (LOWER("Process Name") LIKE '%certutil.exe%'
      AND (LOWER("Command") LIKE '%-encode%' OR LOWER("Command") LIKE '%-decode%' OR LOWER("Command") LIKE '%-urlcache%'))
    OR
    (LOWER("Process Name") SIMILAR TO '%(python%\.exe|perl\.exe|php\.exe|ruby\.exe|node\.exe|nodejs)%'
      AND (LOWER("Command") LIKE '%base64%' OR LOWER("Command") LIKE '%binascii%' OR LOWER("Command") LIKE '%hexlify%' OR LOWER("Command") LIKE '%gzip%')
      AND (LOWER("Command") LIKE '%http://%' OR LOWER("Command") LIKE '%https://%' OR LOWER("Command") LIKE '%socket%' OR LOWER("Command") LIKE '%requests.%'))
    OR
    (LOWER("Process Name") SIMILAR TO '%(powershell\.exe|pwsh\.exe)%'
      AND (LOWER("Command") LIKE '%frombase64string%' OR LOWER("Command") LIKE '%tobase64string%' OR LOWER("Command") LIKE '%[convert]%')
      AND (LOWER("Command") LIKE '%net.webclient%' OR LOWER("Command") LIKE '%invoke-webrequest%' OR LOWER("Command") LIKE '%downloadstring%'))
    OR
    (LOWER("Process Name") SIMILAR TO '%(curl\.exe|wget\.exe|\bcurl|\bwget)%'
      AND CHAR_LENGTH("Command") > 120
      AND (LOWER("Command") LIKE '%=%' OR LOWER("Command") LIKE '%//%'))
  )
ORDER BY devicetime DESC
LIMIT 1000
high severity medium confidence

Detects T1132 Data Encoding C2 communication techniques in QRadar by querying process creation events from Windows Security, Sysmon, and endpoint log sources. Identifies certutil LOLBin encoding, scripting interpreters combining encoding with network calls, PowerShell Base64+network class combos, and curl/wget with large encoded argument strings.

Data Sources

Windows Security EventsSysmonEndpoint Detection Logs

Required Tables

events

False Positives & Tuning

  • Developers running Python or Node.js automation scripts that encode payloads for REST APIs, messaging platforms, or cloud services
  • Security scanning tools (Nessus, Qualys, Rapid7) that use certutil or scripting engines to test encoding-related vulnerabilities
  • Backup or monitoring agents using curl with long authentication tokens embedded as Base64 in request headers
Download portable Sigma rule (.yml)

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.

  1. 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).

  2. 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.

  3. 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.

  4. 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.

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections