mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-01 13:20:36 +00:00
Fix OOB heap write in blockdata_read()
A flaw in the blockdata_read() function allows an attacker to overflow heap buffers. If memory allocation fails whilst reading data from an IPC pipe, some data is left unread in the pipe. This has the effect of desynchronising further reads from the pipe and allows an attacker to overflow a heap buffer. Note that the attack depends on running the dnsmasq process out of memory so that calls to malloc() begin to fail. This is difficult to do on most platforms, unless a small ulimit is set on the size of the dnsmasq process. This makes practical attacks somewhat difficult. Thanks to Michel Belleau for finding and characterising this vulnerability.
This commit is contained in:
2 files changed
+68
-34
No files matched your search
+12
-3
@@ -1039,9 +1039,18 @@ int cache_recv_insert(time_t now, int fd)
|
||||
unsigned short class = C_IN;
|
||||
struct blockdata *block = NULL;
|
||||
|
||||
if ((flags & F_RR) && !(flags & F_NEG) && (flags & F_KEYTAG)
|
||||
&& !(block = addr.rrblock.rrdata = blockdata_read(fd, addr.rrblock.datalen)))
|
||||
continue;
|
||||
/* Note that blockdata_read() can return NULL either
|
||||
because the stream ended, OR memory allocation failed.
|
||||
We continue here rather than returning 0 to finish draining
|
||||
the pipe in the second case. If the stream ended, the read
|
||||
of the next length at the top of the loop will fail
|
||||
and we'll return 0 there. */
|
||||
if (flags & F_RR)
|
||||
{
|
||||
if (!(flags & F_NEG) && (flags & F_KEYTAG) &&
|
||||
!(block = addr.rrblock.rrdata = blockdata_read(fd, addr.rrblock.datalen)))
|
||||
continue;
|
||||
}
|
||||
#ifdef HAVE_DNSSEC
|
||||
else if (flags & F_DNSKEY)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user