mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-10-29 12:50:47 +00:00
fix: rand64() must share global outleft with rand16()/rand32()
rand64() declared its own `static int outleft`, shadowing the global one while all three functions share the same out[] SURF output buffer. When rand64() called surf() to refill out[], the global outleft still indexed into the now-overwritten buffer, so subsequent rand32() or rand16() calls could return the same words rand64() had already consumed. Drop the local static so all three functions coordinate through the same counter. Security: rand64() is used to generate DHCPv6 temporary address interface IDs, which are visible on the local network. Because of the shared buffer issue, an observer could reconstruct the out[] words consumed by rand64() and predict the next rand32() outputs. rand32() drives the 0x20 case-scrambling bitmap used to harden DNS queries against cache-poisoning, so this leaks PRNG state across the DHCPv6 and DNS code paths. I'd still say the overall severity is rather low as local network access required, and 0x20 encoding is really a defence-in-depth and not some kind of essential security. Signed-off-by: Dominik <dl6er@dl6er.de>
This commit is contained in:
1 parent
68c149e9dd
commit
9dec84ca42
1 file changed
-2
@@ -105,8 +105,6 @@ u32 rand32(void)
|
||||
|
||||
u64 rand64(void)
|
||||
{
|
||||
static int outleft = 0;
|
||||
|
||||
if (outleft < 2)
|
||||
{
|
||||
if (!++in[0]) if (!++in[1]) if (!++in[2]) ++in[3];
|
||||
|
||||
Reference in new issue
Block a user