CVE-2023-31147: Insufficient randomness for DNS query identifiers in C-ares
c-ares used an RC4-based PRNG with a flawed key schedule and a fallback to unseeded rand() to generate DNS query IDs, making them predictable. An attacker could more easily forge DNS responses by guessing the query ID and source port.
blog.sigma-star.at
Published on blog.sigma-star.at
Despite having DNSSEC, DoH or DoT to secure DNS lookups, many systems still rely on plain old DNS from 1983. Earlier this year, we’ve been part of a larger team that audited c-ares v1.19.0. c-ares is an asynchronous DNS client library with support for a wide range of platforms.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the RC4 key schedule was implemented incorrectly (confusing the state buffer with the key data) and the fallback random number generator was not seeded, leading to predictable query IDs.
Impact
An attacker’s search space for the tuple of source port and DNS query ID is smaller, making it more likely to succeed in forging DNS responses.
What the attacker needed
Attacker can send spoofed DNS responses; victim uses c-ares with predictable IDs
The fix
The issue was fixed in c-ares v1.19.1.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
DNS is the system that turns website names into IP addresses. When your computer asks a DNS server for an address, it includes a random number (the query ID) so it can match the reply to its request. If an attacker can guess that number, they can send a fake reply before the real one arrives, potentially redirecting you to a malicious site. This report found that a widely used DNS library generated these numbers in a predictable way.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.