mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-30 21:28:34 +00:00
Fix use-after-free in send_ra_alias() for large router advertisements.
send_ra_alias() has the same problem relay_upstream6() had. It keeps a pointer to the header of the router advertisement while prefixes and options are added to the packet, and afterwards sets the router lifetime and the M and O flags through it. If the advertisement doesn't fit the packet buffer as it is, expand_buf() has moved the buffer by then. The flags are set in memory which has been freed, and the advertisement goes out without them, so hosts which see it don't use DHCPv6. The buffer starts out at 548 bytes, so this takes an advertisement larger than that: many prefixes on one interface, or long lists of DNS servers or search domains. It happens each time an advertisement needs a larger buffer than any packet before it. Find the header again each time before writing to it. Credit to Georgi Steffenhagen (ServerTec IT Engineering) for finding and fixing this.
This commit is contained in:
1 parent
9785e2ec41
commit
34b9f9117f
2 files changed
+10
-1
No files matched your search
@@ -15,7 +15,9 @@ version 2.94
|
||||
|
||||
Fix heap OOB write in relay_upstream6() Thanks to
|
||||
Akin Yilma (DecompilerAI) and Georgi Steffenhagen for spotting this.
|
||||
CVE-2026-133730 appiles.
|
||||
CVE-2026-133730 applies. Also fix heap OOB write in send_ra_alias()
|
||||
which arrises from the same mistake, Credit to
|
||||
Georgi Steffenhagen (ServerTec IT Engineering) for this one.
|
||||
|
||||
version 2.93
|
||||
Fix a corner-case in DNSSEC validation with wildcards. If we have
|
||||
|
||||
@@ -400,6 +400,10 @@ static void send_ra_alias(time_t now, int iface, char *iface_name, struct in6_ad
|
||||
up = &context->next;
|
||||
}
|
||||
|
||||
/* Adding the prefixes above may have moved the packet buffer,
|
||||
so find the header again before writing to it. */
|
||||
ra = daemon->outpacket.iov_base;
|
||||
|
||||
/* If we're advertising only old prefixes, set router lifetime to zero. */
|
||||
if (old_prefix && !parm.found_context)
|
||||
ra->lifetime = htons(0);
|
||||
@@ -531,6 +535,9 @@ static void send_ra_alias(time_t now, int iface, char *iface_name, struct in6_ad
|
||||
put_opt6(&parm.link_local, IN6ADDRSZ);
|
||||
}
|
||||
|
||||
/* The options added since then may have moved the buffer again. */
|
||||
ra = daemon->outpacket.iov_base;
|
||||
|
||||
/* set managed bits unless we're providing only RA on this link */
|
||||
if (parm.managed)
|
||||
ra->flags |= 0x80; /* M flag, managed, */
|
||||
|
||||
Reference in new issue
Block a user