
Proof-of-concept and ASan differential lab for CVE-2026-110486, an unauthenticated Mosquitto WebSocket zero-length frame bug causing MQTT parser desync and heap over-read.
| CVE | CVE-2026-110486 |
| Component | Eclipse Mosquitto — lib/net_ws.c::net__read_ws(), builtin websockets implementation |
| Affected | 2.1 through 2.1.2 |
| Fixed in | 2.1.3 — genuine vendor fix, commit 021b063d |
| CWE | CWE-125 (Out-of-bounds Read), CWE-787 (Out-of-bounds Write) |
| Impact | An unauthenticated WebSocket client can make the broker parse bytes that were never read from the wire: uninitialised heap contents enter CONNECT handling, enabling information disclosure and, with the right heap layout, to_process underflow and an out-of-bounds write before authentication |
| Vector | Network — a WebSocket connection to a protocol websockets listener, one zero-length data frame |
| Trigger | a masked WebSocket data frame with payload length 0 |
For a zero-length data frame, net__read_ws() consumed the four masking-key
bytes, set len to 4, and never wrote to the caller's buffer:
// v2.1.2, lib/net_ws.c (~L302, ~L344)
len = net__read(mosq, buf, count); // skipped when payloadlen == 0
...
if (mosq->wsd.pos == (ssize_t)mosq->wsd.payloadlen) { // 0 == 0
/* data frames have no out_packet, so none of the branches reset len */
}
return len; // 4 — but buf is untouched
packet__read_single() treats that return value as four bytes of MQTT
data. The vendor fix (2.1.3) introduces a separate mqtt_len, initialised
to -1, and returns -1/EAGAIN for an empty frame after reading the mask.
The laboratory builds both upstream tags with ASan+UBSan and drives the
real broker over its WebSocket listener. During the handshake the broker
zeroes the packet buffer, so the phantom read is deterministically four
zero bytes: the vulnerable broker logs First packet not CONNECT (00) and
drops the client, while the fixed broker ignores the frame and keeps the
session alive.
The function conflated "bytes consumed from the socket" (frame header and
masking key) with "bytes delivered to the MQTT reader". For an empty data
frame those quantities differ by four. Because the MQTT reader then
believes a packet header has arrived, parser state advances over memory
the broker never filled; with controlled follow-up frames the unsigned
to_process counter can underflow and subsequent writes land outside the
payload allocation. The fix returns a distinct value that means "no
application data yet" for empty frames.
| service | image | role |
|---|---|---|
mosq-vuln | cve-2026-110486:vuln | mosquitto v2.1.2, ASan+UBSan |
mosq-fixed | cve-2026-110486:fixed | mosquitto v2.1.3, ASan+UBSan, genuine vendor fix |
poc | cve-2026-110486-poc:local | stdlib-only Python driver |
Both sides share the same config (plain WS listener on 8080, MQTT on 1883,
anonymous allowed), build flags and supervisor. The supervisor runs the
broker as a child and exposes /status (exit code, sanitizer flag, broker
log) and POST /restart so each probe case starts from a clean log.
./run-lab.sh build # builds 2.1.2 and 2.1.3 with ASan+UBSan
./run-lab.sh up # cve110486lab network: mosq-vuln / mosq-fixed
./run-lab.sh sweep # check / exploit / probe / mitigation on both sides
./run-lab.sh down
poc/poc.py (stdlib only) performs the WebSocket handshake, sends one
zero-length masked data frame and reads the broker log:
First packet not CONNECT (00) marker means the broker
parsed four bytes that were never delivered; exit 1 vulnerable, 0 safe,
3 no worker, 2 unreachable.021b063d.A standalone full-chain exploit ships at exploit/exploit.py:
python3 exploit/exploit.py --host=mosq-vuln
# exit 1 on confirmed parser desync, 0 on a safe target
| frame | mosq-vuln (2.1.2) | mosq-fixed (2.1.3) |
|---|---|---|
| empty data frame | "First packet not CONNECT (00)", client dropped | no phantom command; session stays alive until the client closes |
| ping frame (control) | no phantom command | no phantom command |
| real data frame (control) | normal MQTT processing | normal MQTT processing |
Captured runs: evidence/check-*-run.txt, evidence/exploit-*-run.txt,
evidence/probe-*-run.txt, evidence/mitigation-*-run.txt,
evidence/exploit-standalone-run.txt, evidence/versions.txt,
evidence/0day-sweep.txt.
listener with protocol websockets using mosquitto's builtin
implementation (WITH_WEBSOCKETS_BUILTIN=ON).cve110486lab
network.in_packet.packet_buffer during the handshake, which
makes the phantom bytes deterministic (zero) in this lab.The probe matrix on 2.1.3 shows no phantom command for the empty frame; ping and data-frame controls stay clean on both builds. The advisory's downstream heap overflow depends on attacker-shaped heap state — a particular uninitialised prefix declaring a MQTT remaining length plus a follow-up frame — so this lab proves the deterministic root cause (the phantom four-byte read before authentication) rather than asserting one specific heap layout. No bypass of the 2.1.3 guard was found.
README.md this write-up
run-lab.sh environment driver (build / up / sweep / down)
Makefile convenience targets
poc/poc.py the PoC (check / exploit / probe / mitigation)
exploit/exploit.py standalone full-chain exploit
lab/lab.Dockerfile ASan+UBSan build of both upstream tags
lab/mosquitto.conf websockets listener configuration
lab/supervisord.py child-process broker supervisor + /status
evidence/ captured runs of every mode on both sides
TRACKING.md excluded (working record)