Kuboid
Open Luck·Kuboid.in
Black Hat2024
Open in YouTube ↗

How the Internet Dodged a Bullet: The KeyTrap Denial-of-Service Attacks against DNSSEC

Black Hat906 views39:0711 months ago

This talk demonstrates the KeyTrap denial-of-service attack, a resource exhaustion technique that exploits the DNSSEC validation process to force resolvers into performing an excessive number of cryptographic operations. The attack targets DNSSEC-validating resolvers by crafting malicious DNS responses that trigger quadratic complexity in signature validation, leading to a complete service outage. The researchers show that this vulnerability is inherent in the DNSSEC standard and affects virtually all major DNS resolver implementations. The presentation includes a live demonstration of the attack against an Unbound resolver, highlighting the severe impact on availability.

How DNSSEC Validation Logic Became a Global Denial-of-Service Vector

TLDR: Researchers discovered that the DNSSEC validation process is inherently vulnerable to resource exhaustion attacks, now tracked as CVE-2023-50387 and CVE-2023-50868. By crafting malicious DNS responses with colliding key tags and excessive signatures, an attacker can force recursive resolvers to perform an exponential number of cryptographic operations. This vulnerability affects nearly every major DNS resolver implementation, turning a security feature into a potent weapon for service disruption.

DNSSEC was designed to solve the fundamental problem of DNS spoofing by adding cryptographic signatures to resource records. The industry spent years pushing for its adoption, treating it as a foundational layer for a secure internet. However, the recent discovery of the KeyTrap vulnerability proves that when you bake complex cryptographic requirements into a high-throughput, mission-critical protocol, you often end up creating a massive, distributed attack surface.

The Mechanics of the KeyTrap Attack

At its core, KeyTrap is an algorithmic complexity attack that exploits the way recursive resolvers handle DNSSEC validation. The DNSSEC standard requires resolvers to validate signatures (RRSIG) against public keys (DNSKEY). To do this, the resolver must associate the correct key with the signature using a combination of the owner name, the algorithm number, and the key tag.

The vulnerability arises because the DNSSEC specification does not mandate that a key tag uniquely identifies a single DNSKEY record. It is entirely possible to have multiple distinct DNSKEY records that share the same key tag, algorithm, and owner name. When a resolver encounters a response containing these colliding records, it must attempt to validate the signature against every possible key until it finds a match or exhausts the set.

Attackers exploit this by crafting a zone file where a single signature is associated with a massive set of colliding keys. When a victim resolver queries this zone, it enters a validation loop. Because the resolver is required to try all combinations to ensure robustness, the computational cost scales quadratically. In a live demonstration against an Unbound resolver, the researchers showed that a single, small DNS response could pin the resolver's CPU at 100% for several minutes.

Why This Matters for Pentesters

For those of us conducting red team engagements or infrastructure assessments, KeyTrap changes how we view DNS-based denial-of-service. Previously, we looked for volumetric amplification attacks, like DNS reflection, which rely on bandwidth saturation. KeyTrap is different. It is a surgical strike on the resolver's processing power.

You do not need a botnet to take down a target's DNS infrastructure. You only need to be able to trigger a lookup for a domain you control. If you are testing an organization that uses a specific, vulnerable version of BIND9, Knot, or PowerDNS, you can effectively disable their internal or external DNS resolution with a handful of packets.

The impact is not limited to the target domain. Because the resolver is stuck in a validation loop, it stops responding to all other legitimate queries. This creates a cascading failure across the entire network. During an engagement, this is a high-impact finding that demonstrates a critical failure in the target's ability to maintain availability while enforcing security policies.

The Failure of Generic Warnings

One of the most frustrating aspects of this research is that the vulnerability was effectively written into the RFC 4034 and RFC 4035 specifications. The standards bodies included warnings about the potential for resource exhaustion, but these were treated as generic, "best-effort" advice rather than hard constraints.

Developers implemented the validation logic exactly as the RFCs described, assuming that the protocol's inherent complexity was a necessary trade-off for security. The researchers found that even when developers attempted to implement rate limiting or buffer constraints, the sheer complexity of the DNSSEC state machine made it nearly impossible to do so without breaking legitimate resolution.

Defensive Realities

Defending against KeyTrap is not as simple as flipping a switch. Patching is the only viable path forward. Vendors have released updates that introduce stricter limits on the number of cryptographic operations a resolver will perform for a single request. If you are managing DNS infrastructure, your immediate priority is to audit your resolver versions against the known CVEs and ensure you are running the latest patched releases.

Beyond patching, consider the trade-offs of your DNSSEC implementation. If your organization does not strictly require DNSSEC validation for all internal traffic, you might consider disabling it on specific, high-risk segments of your network until you can verify that your resolvers are fully patched and hardened against algorithmic complexity attacks.

The internet dodged a bullet here, but the incident serves as a stark reminder that security protocols are not immune to the laws of computer science. When we prioritize cryptographic completeness over computational efficiency, we invite the very outages we are trying to prevent. Keep an eye on your resolver logs for unusual spikes in CPU usage or high rates of validation failures, as these are the primary indicators that someone might be testing your infrastructure for this exact vulnerability.

Talk Type
research presentation
Difficulty
advanced
Has Demo Has Code Tool Released


Black Hat Europe 2024

52 talks · 2024
Browse conference →
Premium Security Audit

We break your app before they do.

Professional penetration testing and vulnerability assessments by the Kuboid Secure Layer team. Securing your infrastructure at every layer.

Get in Touch
Official Security Partner
kuboid.in