Georgi Steffenhagen 9785e2ec41 Fix use-after-free in relay_upstream6(). CVE-2026-133730
relay_upstream6() takes a pointer to the Relay-forward header at the
start of the output packet, then adds the client link-layer address
and relay message options, and then writes the link-address into the
header through that pointer, once for each relay. Adding the options
makes expand_buf() move the packet buffer whenever the relayed message
doesn't fit the buffer as it is, and the buffer starts out at 548
bytes. The link-address is then written into memory which has been
freed, and the packet goes out with an empty link-address.

One DHCPv6 message of about 500 bytes or more arriving on an interface
with --dhcp-relay configured is enough for that. With a normal build
it takes a few messages of growing size to crash dnsmasq: the write
lands on the heap's own bookkeeping in the freed block.

Up to 2.86 the link-address was written before the options were
added. Commit 7fbf1cc ("Improve the performance of DHCP relay.")
moved it into the loop over the relays, so 2.87 is the first release
with the problem.

Find the header again once the packet is complete.

Credit to Akin Yilmaz (DecompilerAI) and, independently,
Georgi Steffenhagen <georgisteffenhagen@servertec.net> for finding this.
2026-11-29 11:37:04 +00:00
2012-04-02 20:40:34 +01:00
2025-12-07 13:44:40 +00:00
2012-01-05 17:31:15 +00:00
2018-01-14 17:32:52 +00:00
2022-05-13 21:22:11 +01:00
2012-01-05 17:31:13 +00:00
2025-07-20 15:29:43 +01:00
2021-06-15 23:14:59 +01:00
2026-04-08 12:08:18 +01:00
2025-07-20 15:29:43 +01:00
2012-01-05 22:00:08 +00:00
S
Description
No description provided
GPL-2.0
6.5 MiB
0 Stars 1 Watchers 0 Forks
Languages
C 94.3%
Perl 2.2%
HTML 1.2%
Shell 1%
Makefile 0.6%
Other 0.6%