GHSA-2gf7-5224-5vrj: mDNS string cache accepts a shorter name as a match for a longer stored one, so the known-answer encoder writes past the transmit packet
GHSA ID |
|
|---|---|
CVE ID |
CVE‑2026‑102715 |
Severity |
High |
CWE |
|
Published |
2026‑10‑13 |
Last updated |
2026‑10‑13 |
Affected packages
| Package | Vulnerable versions | Patched versions |
|---|---|---|
NetX Duo |
⇐ 6.5.2.202603 |
6.5.2.202603a |
Description
Summary
_nx_mdns_name_match compares two names only as far as the destination string runs and never requires the source to terminate at the same point. _nx_mdns_cache_add_string calls it with the incoming name’s own length as the length argument, which makes the trailing length guard tautological, so a shorter incoming name that is a prefix of a longer stored one matches it and the caller receives a pointer to the longer string. A record then carries a name pointer and a name length that describe different names, and the encoder that writes it overruns the transmit packet.
Details
The comparison loop runs while the destination byte is non-zero, counting iterations into index, and the guard afterwards rejects the match only when index differs from the length argument. _nx_mdns_cache_add_string passes the incoming name as the destination together with that same incoming name’s length, so index always equals length and the guard can never fire for this caller. Other callers pass the source length instead, which is why the same guard works everywhere else. One call site has the argument backwards.
The string table stores each name in a slot rounded up to a multiple of four, and the lookup first requires the stored slot size to equal the rounded size of the incoming name. Names whose lengths round to the same slot are therefore eligible to collide, and within such a bucket the aliasing above resolves a shorter name against a longer stored one.
When the record is parsed, its rdata name pointer is taken from the cache — now naming the longer string — while its nx_mdns_rr_rdata_length is computed from the length of the incoming string. Pointer and length describe different names from that point on.
_nx_mdns_packet_rr_add bounds its write with a size built from the owner name length plus the fixed header bytes plus nx_mdns_rr_rdata_length. The owner-name half is recomputed live from the record’s real name and is always consistent with what the encoder writes; the rdata half is the stale stored value. The encoder then writes the string the pointer actually names, copying it byte by byte, and runs past the end of the transmit packet.
Both the PTR and the SRV record types are affected. nx_mdns_rr_ptr_name and nx_mdns_rr_srv_target are the first members of their respective structures inside the rdata union, so they occupy the same offset, and the SRV encoder writes through that pointer exactly as the PTR encoder does. A fix and its tests must cover both.
Impact
One to three bytes of attacker-influenced data are written past the end of the transmit packet. In an ordinary packet pool that lands in the next packet in the same pool rather than in a guard region, so the effect is a corrupted neighbouring packet or a corrupted pool free list rather than a clean crash.
Independently of the overflow, the aliasing misattributes records: a peer record received under one name is stored pointing at a different, longer name, so service discovery resolves to the wrong target.
Affected configurations
Builds using the NetX Duo mDNS add-on with the mDNS client enabled and an active continuous query — the normal state for a device performing service discovery. The overflowing encode happens in _nx_mdns_query_send, which walks the peer cache and adds its records to the known-answer section of an outgoing query; it is not the response encoder, so a purely unsolicited path does not reach it.
The attacker supplies the known-answer records and so controls how full the transmit packet is when the aliased record is encoded. Two mDNS records from any host on the link are sufficient, with owner names whose lengths fall in one bucket and where the second is a prefix of the first.
Releases up to and including 6.5.2.202603 are affected.
Severity
CVSS:4.0/AV:A/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:H/SC:N/SI:N/SA:N, 7.1, High. CWE-787 and CWE-697.
VI:L covers the misattributed records as well as the corrupted neighbouring packet. Availability is high because free-list corruption is not recoverable in place. The attack vector is adjacent because both records must come from a host on the local link.
CWE-697 is recorded alongside CWE-787 because the write is downstream of a comparison that treats a prefix as equal.
Patches
Fixed in NetX Duo 6.5.2.202603a.
_nx_mdns_name_match now requires both names to terminate at the same point, so a prefix is no longer a match. The string slot additionally records the real length of the name it holds and returns it to the caller, which stops the rdata pointer and nx_mdns_rr_rdata_length from describing different names in the first place. Coverage includes both the PTR and the SRV encoder. No public API changes, so applications need no source change.