Good Cache, BAD Cache: Exploiting DNSSEC Validation Failures for DNS Cache Poisoning Attacks
Abstract
Cache poisoning has been a persistent adversarial challenge in the DNS for decades. DNSSEC (Domain Name System Security Extensions) verifies DNS resource records by digital signatures and is widely regarded as the best practice for mitigating cache poisoning attacks. In this paper, we present BadDNS, a novel DNS cache poisoning attack, which exploits the improper handling of a new type of cache in the resolver to undermine DNSSEC validation. Specifically, when DNSSEC validation for a domain fails, some resolvers still cache the resource records from the response, storing them in what is known as a ''BAD cache.'' Then, these resolvers incorrectly use these unverified resource records in subsequent resolution processes, creating a potential attack vector. By systematically analyzing and reviewing the BAD cache implementations in six major software packages, we confirmed that BadDNS is practically exploitable, affecting three of these implementations, including PowerDNS and Microsoft DNS. With comprehensive measurements, we discovered that approximately 16.86% of the 300,792 DNSSEC-validating open resolvers and 10 public DNS providers are susceptible, including OpenDNS and Quad9. Moreover, we found that 26,930 DNSSEC-enabled nameservers are vulnerable, including Cloudflare and INWX GmbH, which affects 5.68% of the domains they serve. We responsibly disclosed our findings to the affected vendors, along with detailed mitigation advice. We have since received positive responses from 7 vendors, such as PowerDNS, several of whom are now implementing our proposed solutions.