The vulnerability is a denial-of-service in the CoreDNS loop plugin, caused by a combination of predictable random number generation and a fatal error handler. The analysis of commit 7ae1c40db200a29d8160707bcffb232c53a2005c reveals the core of the fix.
-
Predictable Token Generation: The function qname in plugin/loop/setup.go was identified as the source of the vulnerability. It used Go's math/rand package seeded with time.Now().UnixNano(). This method of seeding is predictable, allowing an attacker to guess the 'random' query name used by the loop detection mechanism.
-
Exploitable Crash Condition: The (*Loop).ServeDNS method in plugin/loop/loop.go, as detailed in the vulnerability description, contains the logic that triggers the crash. It increments a counter for any incoming DNS query whose name matches the predictable name generated by qname. Upon the third match, it calls log.Fatalf.
-
Process Termination: The log.Fatalf call results in an immediate os.Exit(1), terminating the entire CoreDNS process and causing a denial of service. An attacker can repeatedly trigger this to create a crash-restart loop.
The patch addresses the root cause by modifying the qname function to use the cryptographically secure crypto/rand package. This makes the query name unpredictable, preventing the attacker from being able to trigger the crash condition in (*Loop).ServeDNS. Both qname (the source of the vulnerability) and (*Loop).ServeDNS (the runtime trigger of the exploit) are the key functions involved.