Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-114550 — Podman lab and PoC reproducing the libwebsockets MQTT PUBACK out-of-bounds write (ZDI-CAN-31039), with a malicious broker, ASan test matrix, and heap unlink/control-flow hijack primitives. | Kitploit
Tools/GitHubGitHub/googlesky/cve-2026-114550
Container SecurityIoT SecurityMemory ForensicsVulnerability AnalysisExploitationFuzzingBinary ExploitationLabs & Practice
GitHubgooglesky/cve-2026-114550

CVE-2026-114550

Podman lab and PoC reproducing the libwebsockets MQTT PUBACK out-of-bounds write (ZDI-CAN-31039), with a malicious broker, ASan test matrix, and heap unlink/control-flow hijack primitives.

8h 32m agoNot yet reviewed
Share
View Repository

CVE-2026-114550: libwebsockets MQTT PUBACK OOB write

ZDI-CAN-31039, ZDI-26-792, CWE-787, CVSS 8.1 (AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H). Fixed upstream by c9e8e1834d7f13038c82963086b90e2ee9c5b44c ("ZDI-CAN-31039: enter wrong state").

Podman lab that reproduces the bug end to end and shows what the corruption buys: an attacker-run MQTT broker rewrites list pointers and a function-pointer table inside a libwebsockets MQTT client using nothing but PUBACK packets. No client-side misconfiguration needed; whoever runs the broker owns the parse (that's the "authentication is not required" in the advisory).

Versions

  • vulnerable: v4.2 through v4.5.8 (release 2026-03-27), and main up to d0d1c796 (parent of the fix)
  • fixed: c9e8e1834 (merged 2026-07-21), v5.0.0 and later

Only the MQTT client role is affected (-DLWS_ROLE_MQTT=1 or secure-streams MQTT). libwebsockets has no MQTT server listener, so the target is the client: IoT stacks connecting out to a broker.

Root cause

In _lws_mqtt_rx_parser() (lib/roles/mqtt/mqtt.c), when the properties-length VBI of a PUBACK completes with a non-zero value, the parser enters the wrong state:

case LMQCPP_PUBACK_PROPERTIES_LEN_VBI:
        ...
        par->props_len = par->vbit.value;
        if (!par->props_len)
                goto cmd_completion;
        lws_mqtt_vbi_init(&par->vbit);
        par->state = LMQCPP_PUBACK_VH_PKT_ID;        /* WRONG */

The fix changes that last line to par->state = LMQCPP_EAT_PROPERTIES_AND_COMPLETE;.

par->fixed (the fixed_seen[] slot counter, still 3) is not reset, so the re-entered state keeps executing par->fixed_seen[par->fixed++] = *buf++;: one attacker-controlled byte per received byte, sequentially past fixed_seen[4] into the rest of struct lws_mqtt_parser_t and then into the enclosing struct _lws_mqtt_related heap chunk (lws_zalloc(sizeof(*wsi->mqtt))).

Keeping the walk alive

Because fixed_seen[] sits mid-struct, the walk overwrites the parser's own fields. At offsets 16-19 (rel. fixed_seen) sits cpkt_remlen, which decides the completion check remlen == fixed; at 44-47 sits n, operand of the bounds check len < par->cpkt_remlen - par->n; at 84 sits fixed, the counter itself. The payload generator in evil_broker.py mirrors the vulnerable parser byte for byte and steers these fields: cpkt_remlen=256 never equals the wrapping uint8_t counter (no spurious completion) and n=0 keeps the bounds check satisfied, so the write sustains itself for as many bytes as the broker feels like sending. The uint8_t counter confines the walk to a 256-byte window sweeping chunk bytes 32-287, which covers the parser bookkeeping, the lws_mqttc_t tail (heap pointers id/username/password/will.*, and the qos2_state_ops function-pointer table on post-v4.5.8 trees), and the first lws_sorted_usec_list_t timer nodes.

Primitives this gives, and what the PoC does with them:

  • poison sul_qos_puback_pubrec_wait.dll2.prev/next: teardown calls lws_dll2_remove() and executes *(prev+8) = next; *(next) = prev with attacker values, the usual unlink write-what-where
  • poison qos2_state_ops: a follow-up QoS2 PUBLISH makes lws call qos2_state_ops->rx_add(wsi, cid, pkt_id), an indirect call through attacker memory
  • the same window reaches the timer .cb pointers (not demonstrated here)

To keep the connection alive across two stages the broker reads the victim's QoS1 publish packet-id off the wire and puts it in the crafted PUBACK, so the parse completes through the normal ACK path instead of hitting the "unsolicited PUBACK" close.

Layout

lab/Containerfile      self-contained build, clones upstream at pinned commits
lab/build.sh           builds vuln/fixed/release trees (ASan and plain)
lab/offsets_probe.c    offsetof() map, compiled with each tree's CC flags
lab/victim_client.c    lws MQTT client victim (QoS1 publish + subscribe)
lab/evil_broker.py     malicious broker + FSM-mirror payload generator
lab/run_poc.sh         6-test matrix with PASS/FAIL verdicts
Makefile               podman build/run (--cpus 2 --memory 4g)

Run

make poc
# or manually:
podman build -t cve-2026-114550:lab lab/
podman run --rm --cpus 2 --memory 4g --network none -v $PWD/output:/output \
    cve-2026-114550:lab

Matrix

testvictim buildbroker modeexpected
T1 benign controlvuln+ASanprops_len=0clean close
T2 OOB write / unlinkvuln+ASanpoison dll2.prev/next = 0x4141414141414141teardown deref of attacker pointer
T3 A/B fixed controlfix commit+ASansame as T2clean close
T4 control-flow hijackvuln+ASan+NDEBUGpoison qos2_state_ops = 0x0000424242424242 + QoS2 PUBLISHSEGV at ->rx_add deref (mqtt.c:952)
T5 natural crashvuln, NDEBUG, no ASanpoison client.id = 0x4141414141414141SIGSEGV core dump
T6 affected releasev4.5.8+ASansame as T2attacker pointer in list node

Results and log excerpts: RESULTS.md. ASan does not see the writes themselves (they stay inside one allocation), so the evidence is the dereference of attacker values instead of a redzone hit.

Why ZDI calls it RCE

P1 is a write-what-where and P2 is a call with argument registers chosen by lws. Turning that into code execution needs a heap leak/groom and no ASan; the walk is deterministic, so the payload only needs the victim build's offsets, which the probe prints per build.

Other problems in the same parser (pre-fix trees)

  1. LMQCPP_PROP_ID_VBI off-by-one: if (vbit.value > LWS_ARRAY_SIZE(property_valid)) accepts prop_id == ARRAY_SIZE, reading one element past property_valid[] and reaching a property state it should not. Low impact, but a plain bounds bug (present in v4.5.8; check current main).
  2. qos2_rx_list grows without a cap: every unique QoS2 PUBLISH packet-id allocates a lws_mqtt_qos2_rx_t freed only on PUBCOMP or close. A broker can grow client memory at will.
  3. pub->payload_len is the declared length (cpkt_remlen - overhead), never clamped to delivered bytes. The shipped minimal-mqtt-client hexdumps payload_len and over-reads; a declared-huge payload also swallows subsequent packets (parser stuck in LMQCPP_PAYLOAD).
  4. LMQCPP_SUBACK_VH_PKT_ID / LMQCPP_UNSUBACK_VH_PKT_ID return -1 (drop the connection) when fewer than 2 bytes are buffered, so those packet types are not fragmentation-tolerant despite the comment above the parser.

References

  • ZDI advisory: https://www.zerodayinitiative.com/advisories/ZDI-26-792/
  • Upstream fix: https://github.com/warmcat/libwebsockets/commit/c9e8e1834d7f13038c82963086b90e2ee9c5b44c
  • GHSA-64rj-2w6g-r32v

Standalone exploit

python3 exploit/exploit.py runs the full chain (exit 1 exploited, 0 safe).

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    927
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    555
  • 3

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    360
  • 4

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    357
  • 5

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    324
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    289

Explore all tools

Browse our collection of tools

View all tools →