T1071.005 CrowdStrike LogScale · LogScale

Detect Publish/Subscribe Protocols in CrowdStrike LogScale

Adversaries may communicate using publish/subscribe (pub/sub) application layer protocols to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. Protocols such as MQTT, XMPP, AMQP, and STOMP use a publish/subscribe design, with message distribution managed by a centralized broker. Publishers categorize their messages by topics, while subscribers receive messages according to their subscribed topics. An adversary may abuse publish/subscribe protocols to communicate with systems under their control from behind a message broker while also mimicking normal, expected traffic.

MITRE ATT&CK

Tactic
Command and Control
Technique
T1071 Application Layer Protocol
Sub-technique
T1071.005 Publish/Subscribe Protocols
Canonical reference
https://attack.mitre.org/techniques/T1071/005/

LogScale Detection Query

CrowdStrike LogScale (LogScale)
cql
#event_simpleName = "NetworkConnectIP4"
| RemotePort in [1883, 8883, 5222, 5223, 5269, 5672, 5671, 61613, 61614]
// Exclude RFC-1918 and loopback
| !cidr(RemoteAddressIP4, subnet="10.0.0.0/8")
| !cidr(RemoteAddressIP4, subnet="172.16.0.0/12")
| !cidr(RemoteAddressIP4, subnet="192.168.0.0/16")
| !cidr(RemoteAddressIP4, subnet="127.0.0.0/8")
// Classify protocol
| Protocol := case {
    RemotePort in [1883, 8883]             => "MQTT";
    RemotePort in [5222, 5223, 5269]       => "XMPP";
    RemotePort in [5672, 5671]             => "AMQP";
    RemotePort in [61613, 61614]           => "STOMP";
    *                                      => "Unknown"
  }
// Score suspicion — exclude known MQTT broker tools before flagging MQTT
| Suspicion := case {
    Protocol in ["XMPP", "STOMP"]                                                     => "high";
    Protocol = "MQTT" AND ImageFileName != /(?i)(mosquitto_pub|mosquitto_sub|mosquitto)(\.exe)?$/ => "high";
    Protocol = "AMQP"                                                                 => "medium";
    *                                                                                  => "low"
  }
| Suspicion in ["high", "medium"]
| groupBy(
    [ComputerName, UserName, ImageFileName, RemoteAddressIP4, RemotePort, Protocol, Suspicion],
    function=[
      count(as=ConnectionCount),
      min(@timestamp, as=FirstSeen),
      max(@timestamp, as=LastSeen)
    ]
  )
| ConnectionCount > 1
| sort(Suspicion, order=asc)
| sort(ConnectionCount, order=desc)
high severity medium confidence

CrowdStrike LogScale (Falcon) query hunting for repeated outbound NetworkConnectIP4 events to pub/sub protocol ports on external IP addresses. Applies the same suspicion-scoring logic as the reference KQL/SPL: XMPP/STOMP connections externally are high, MQTT from non-mosquitto processes is high, external AMQP is medium. Groups by host, user, and process for triage. Run against Falcon telemetry in the last 24 hours using a time-range selector in the LogScale UI.

Data Sources

CrowdStrike Falcon Insight XDR endpoint telemetry (NetworkConnectIP4 events)Falcon Data Replicator (FDR) feed ingested into LogScaleCrowdStrike Falcon LogScale (SIEM) — requires network connection telemetry enabled on sensor policy

Required Tables

Falcon telemetry: #event_simpleName = NetworkConnectIP4Fields required: RemotePort, RemoteAddressIP4, ImageFileName, ComputerName, UserName

False Positives & Tuning

  • Falcon-protected OT/IoT gateway hosts running MQTT broker clients (mosquitto, HiveMQ Edge, EMQX) for telemetry forwarding — the mosquitto regex exclusion handles standard installs but custom binary names or paths may still fire
  • Security tools and monitoring agents (Nagios, Zabbix, custom health-check scripts) that use AMQP or STOMP to push metrics to external observability platforms — these generate high-frequency repeated connections that will exceed the ConnectionCount > 1 threshold immediately
  • Developers running local pub/sub client tools (MQTT Explorer, AnotherMQTTClient, MQTTX) for debugging or testing against public broker sandboxes (broker.hivemq.com, test.mosquitto.org) — common on developer workstations and will appear as high-suspicion MQTT from non-standard process names
Download portable Sigma rule (.yml)

Other platforms for T1071.005


Testing Methodology

Validate this detection against 3 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 1MQTT C2 Publish Simulation

    Expected signal: Sysmon for Linux Event ID 3: Network connection from mosquitto_pub to 127.0.0.1:1883. Process creation event for mosquitto_pub with topic name 'c2/beacon' and system data in the message payload.

  2. Test 2XMPP C2 Connection Simulation

    Expected signal: Sysmon for Linux Event ID 3: Network connection from nc to 127.0.0.1:5222. Process creation event for nc with XMPP XML stanza in piped input.

  3. Test 3MQTT Subscribe for Commands Simulation

    Expected signal: Sysmon for Linux Event ID 3: Network connection from mosquitto_sub to 127.0.0.1:1883. Long-lived connection (up to 10 seconds) as the client waits for messages on the 'c2/commands/#' wildcard topic.

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections