Finding CVE-2026-87121 in Firmware You Didn't Write
CISA's September advisory names an open-source TCP/IP stack, a version range and a git commit, and no product you could look up in a CMMS.
The advisory CISA published on 22 September 2026 names its affected product as the lwIP MQTT client application, versions 2.0.1 through 2.2.1, and names no equipment manufacturer at all. ICSA-26-265-01 carries CVE-2026-87121: an out-of-bounds write in that client, scored CVSS v3.1 9.8, reachable without credentials, and good for full code execution on the device according to the advisory text. No model number appears anywhere in it. No fixed firmware release does either, because the remedy CISA prints is a git commit in a project hosted on Savannah, credited to Shahriyar Jalayeri of ByteRay Ltd.
lwIP is a free TCP/IP stack written for memory-constrained embedded targets, and it has been compiled into industrial firmware for two decades, usually as a handful of files copied out of a silicon vendor's SDK. So the uncomfortable part of this advisory isn't the defect. One missing bounds check, repaired in a six-line diff you could read over coffee. The uncomfortable part is the question it puts to your asset register: do you run this code? Most plants can't answer, and not because the maintenance team is sloppy. The register is keyed on make, model and serial, while the defect lives in a source file compiled into other companies' products under build options that were never written down. A waste-to-energy site or a dairy is full of candidates: MQTT-speaking edge gateways, vibration nodes watching a baghouse fan, weigh-bridge controllers, protocol converters bolted inside a motor control centre. The advisory can't name them. Their vendors can, and the question that gets a useful answer is not the one most people send.
Six lines of repair, and what the diff gives away
lwIP's MQTT client holds the head of each incoming message in one fixed array, rx_buffer, whose length is the compile-time option MQTT_VAR_HEADER_BUFFER_LEN. The shipped header sets that default to 128 bytes, with a comment telling integrators it has to hold the longest incoming topic plus eight. Payloads longer than the buffer arrive fragmented through the data callback, which is why 128 is usually left alone: it only ever needed to cover a topic string, and topic strings in a plant are short. Line3/Filler2/vib/ch1 and you're done.
Before the fix, the parse loop wrote each arriving byte to client->rx_buffer[client->msg_idx++] and never compared msg_idx against the array length. Announce a long enough topic and the write walks straight off the end. The repair committed on 31 August 2026 wraps that store in a bounds comparison and returns a disconnect once the buffer is full. Six lines. Three bug reports on the project tracker stand behind it, with a unit test added alongside.
MQTT 3.1.1 makes that array do more work than its size suggests. The fixed header is a single control byte followed by a remaining-length field spread across one to four bytes with a continuation bit, so the parser cannot know how long a message is until it has read those bytes one at a time. A PUBLISH then opens its variable header with a two-byte topic length and the topic itself. All of that accumulates in the same 128-byte array, byte by byte, on the strength of lengths the sender declares and nothing checks.
What sits immediately behind rx_buffer in the client struct, in the current source, is the output ring buffer together with its head and tail indices. Corrupt those and the next publish writes wherever they now point, which stops being a parsing bug and starts being a write primitive. On a Cortex-M part with no MMU, no address randomisation and frequently no stack protection, there's not much standing between that and running code. The control room sees almost none of it. A node resets, reconnects and carries on, and reconnection counts for edge gear are among the least-watched numbers in any plant.
The device dials the broker, so the firewall never sees it
CISA's recommended practices give the standard list. Minimise network exposure. Keep control-system devices off the internet. Put them behind firewalls, away from the business network. Prefer a VPN for remote access. Sound advice for a listening service, and close to irrelevant here, because apps/mqtt in lwIP is a client. Its API is mqtt_client_connect, mqtt_subscribe, mqtt_set_inpub_callback. The device opens the TCP connection outbound, then parses whatever comes back down it.
So what does "remotely exploitable, no authentication required" mean for a box that never listens? Whoever answers that outbound connection gets to feed the parser. That could be a compromised broker container on the edge server, an attacker in path on a plaintext link to port 1883, or a DNS answer if the broker is configured by name rather than by address. MQTT credentials travel from client to broker and never the other way, so the device has nothing to verify before the bytes reach the parse loop, and the fixed-header parse runs on the first segment that arrives, well before anything resembling a CONNACK is understood.
A device that subscribes to nothing gains nothing from that, incidentally. The parse loop runs on every inbound segment the broker sends, subscription list or not.
In food and metals plants a common arrangement is Sparkplug B through a broker sitting on the plant network, which makes that broker the single point of trust for every node subscribed to it. One container, and every lwIP-based device talking to it becomes a code-execution target with no packet crossing a firewall. I'd rank that above an internet-reachable HMI in most risk registers, because the HMI at least turns up in a port scan.
The controls that move the needle for a client-side parser are a different set from the ones in the advisory. Who is allowed to answer on 1883, enforced by an ACL rather than by goodwill. Whether the broker address is pinned or resolved. Whether the connection runs TLS with the broker certificate genuinely verified: lwIP can do that through its altcp_tls layer, but plenty of ports compile without mbedTLS, and plenty of ports that have it skip verification because a self-signed certificate was quicker at commissioning. And whether the gateway's egress rules permit it to reach any broker other than yours.
The hash in the advisory patches a unit test
The advisory names one commit as the fix: f89407ea. Pull it up and it changes a single line in test/unit/mqtt/test_mqtt.c, swapping the arguments of a memset so the new test fills its receive buffer correctly. Its subject line says so plainly: "mqtt: fix wrong memset in last test commit". The code change is the parent commit, 68b2c119, the one that touches src/apps/mqtt/mqtt.c. An integrator who cherry-picks exactly the hash CISA printed ships a corrected unit test on top of a vulnerable stack.
That's a small clerical thing with a practical edge. The hash a reporter had at hand travels into an advisory through a coordination process that doesn't diff it, and the person downstream treats it as authoritative. If you're forwarding this advisory to a vendor, forward the parent commit with it, and ask which one they took.
The dates carry more weight than either hash. The code fix was public in git on 31 August 2026, with "fix rx_buffer overrun" in the subject line, three weeks before any advisory existed. For a component distributed as source, the patch is the disclosure: anyone watching the repository knew before anyone watching advisory feeds, and that population includes people with no stake in your uptime. Vendors who track upstream commits had three weeks of lead. Vendors who track CVE feeds started in late September, if they started at all.
Three more MQTT fixes landed after the advisory
Memory-safety defects cluster in parsers, and finding one usually means somebody is now reading the rest of the file. That's exactly what the commit log for lwIP's MQTT client shows.
| Landed upstream | Short hash | Subject line | CVE |
|---|---|---|---|
| end of August 2026 | 68b2c119 | mqtt: fix rx_buffer overrun | CVE-2026-87121 |
| mid-October 2026 | 576da61c | mqtt: fixed heap overflow by unbounded remaining-length | none |
| late October 2026 | 81bfe390 | mqtt: fix infinte loop via crafted publish for some pbuf configurations | none |
| early November 2026 | f6137fbc | mqtt: fix use-after-free when callback frees client | none |
An unbounded remaining-length field driving a heap overflow is the same class of bug as the one that got the CVE, in the same file, reachable the same way. But none of the three later commits has an advisory, a CVE identifier or a release behind it. The affected range in the advisory stops at 2.2.1, which is also the newest release the project has published, so there's no later release to move to and no version number that means "fixed". Whatever your integrator backports, the sensible target is the current tip of that file rather than one hash from a September advisory.
That has an awkward consequence for anyone running a patch programme the way IEC 62443-2-3 frames it, as an exchange in which the product supplier publishes patch state and the asset owner applies it. The exchange assumes the supplier knows what's inside their own firmware image. For a stack pulled in as source through an SDK, that's the assumption that fails, and it fails without a message: no supplier sends a bulletin saying they don't track the component.
A version string can't answer "am I affected?"
Say your vendor does reply, and the answer is "we use lwIP 2.1.3". You've learned less than it looks.
lwIP gets copied, not linked. It lands in silicon vendors' SDKs as a source tree the integrator compiles with their own configuration, and some of those trees are long-lived forks with their own backports. A device reporting 2.1.3 may carry patches that 2.1.3 never shipped with, or may be missing ones that landed in 2.2.0. Beyond provenance, the build options decide the exposure. Whether apps/mqtt is compiled into the image at all is a switch. Whether MQTT_VAR_HEADER_BUFFER_LEN sits at the default or at 1024 changes how long a topic has to be before anything overflows. A port that raised it to swallow whole payloads without fragmenting has a larger buffer to fill and a different reachable surface, while still reporting the same version.
So the useful artefact is not a version. It's a commit, plus the handful of configuration values that bound the parser.
Ask a supplier for a commit hash and a buffer length, not a version number. On a stack distributed as source and configured at build time, the version string identifies a tarball somebody started from, not the code running in the cabinet.
Hard-coded credentials inside an engineering project file raised the same inventory problem from the other end a while back: the thing carrying the defect was a file people email around. Different mechanism, same gap. The thing you need to patch and the thing your records describe are not the same object.
Four fields in the CMMS and one broker log
The fastest inventory of MQTT-speaking devices on a plant network is already being written for you. Every MQTT CONNECT packet carries a client identifier and a protocol level, and brokers log that identifier with the source address on connect. An afternoon with the broker's log or its connection table enumerates every device that talks to it, including the ones no drawing shows. That list is your population at risk. And the rest of the work is narrowing it.
Four fields in the asset record do most of that narrowing, and they're cheap to capture at commissioning:
- the firmware version string exactly as the device reports it, not as the datasheet describes it;
- the build or release date of that firmware;
- the SDK or network stack the vendor builds on, if they'll say;
- the broker this device connects to, and whether that connection runs TLS with verification enabled.
The cheapest moment to collect them is before a device goes into service. Site and factory acceptance tests already generate a document package, and adding firmware string, build date and stack provenance costs the integrator one line each, which saves someone crawling behind a panel two years later with a torch. For the installed base, fill the fields opportunistically, whenever a device gets touched for another reason. In most plants this question falls between the controls engineer who commissioned the gateway and whoever carries the security remit, which is a large part of why it falls nowhere.
Then the vendor email. "Are you affected by CVE-2026-87121" gets a templated denial or six weeks of silence. Three narrower questions do better: does this firmware compile lwIP's MQTT client; from which upstream commit; and what is MQTT_VAR_HEADER_BUFFER_LEN set to in your build? A supplier who answers the third is tracking the component properly ("we're on the latest SDK" is not an answer to any of them). One who can't has told you something useful about the rest of their firmware, free of charge.
Where a vendor won't answer at all, the behaviour is testable. Point a spare unit at a broker you control, publish to it under a topic a few hundred bytes long, and watch whether the device holds its connection or resets. Do that on the bench. A reset mid-cycle on a CIP skid or during a furnace charge sequence costs more than the information is worth, and the result from the workshop is the same result.
Noticing is the other half, and it's the part plants are worst at. A device under this kind of attention reboots, and if nothing records that, the evidence evaporates into a reconnect counter nobody reads. Where an edge layer already adapts Modbus, OPC-UA and MQTT and buffers readings locally, the gateway's own uptime and reconnect counts can ride the same path as the process tags, which turns "that node is a bit flaky" into a timestamped pattern. A vibration node that resets at 04:12 every third day stops looking like a network glitch and starts looking like something worth a packet capture.
Where this inventory work doesn't pay
Not every site needs any of it. A rolling mill whose instruments are Modbus RTU on RS-485 into a PLC, with the only TCP/IP in the control room, has no lwIP MQTT client to find; the advisory is noise there, and the hour is better spent on the engineering workstation that still runs a five-year-old editor. Below roughly twenty networked devices from two or three suppliers, a spreadsheet of firmware fields is overhead. Phone each supplier's support desk instead. You'll remember the answers, and you'll hear the hesitation.
Where the method stops entirely is equipment whose network you don't own. An OEM-managed gateway on its own cellular modem, publishing to the manufacturer's cloud broker under a service contract, gives you no broker log to read, no commit hash to ask for, and no authority to patch what's inside it. The only lever is the contract: a clause requiring component disclosure and a named patch interval at the next renewal, negotiated on a procurement cycle measured in years. The next parser fix in this stack will land long before that conversation finishes.
Notes
A CVSS score of 9.8 describes a worst-case deployment rather than yours. Reachability here depends on build options (whether the MQTT client is compiled in at all, what the receive buffer is set to, whether the broker is authenticated) and on how much of the path between device and broker you control. Version-range matching against a vendor SDK's fork of lwIP misleads in both directions, so treat an SBOM entry naming the stack as a lead to chase, not an answer.
References
Reuse & license
This article is published by Zoniax OÜ under a Creative Commons Attribution 4.0 International (CC BY 4.0) license. You are free to share and adapt it for any purpose, including commercially, as long as you give appropriate credit to Zoniax and link back to the original article.
Disclaimer
These Field Notes are general technical information, published as-is for industry peers. They are not professional, engineering, safety, legal, or financial advice, and nothing here is a recommendation to buy, sell, or act. Figures are cited from public sources believed reliable but are not independently guaranteed - verify them against the primary sources and your own plant conditions before acting. Zoniax OÜ and the author accept no liability for decisions made from this content. Naming a standard, product, or vendor is not an endorsement.
Cite this article
Nõmm, A. (2026). Finding CVE-2026-87121 in Firmware You Didn't Write. Zoniax. https://zoniax.com/blog/posts/embedded-network-stack-vulnerability-ot-inventory
Permalink: https://zoniax.com/blog/posts/embedded-network-stack-vulnerability-ot-inventory