DNS domain search list followed for extant domain missing A or AAAA records
When curl resolves a hostname using AF_INET or AF_INET6, glibc continues searching the DNS search list past a NODATA response until it finds an address of the requested family. An attacker controlling a domain on the search list could therefore have curl connect to their own address instead of the intended IPv4-only host.
Originally disclosed on HackerOne
- Disclosed after 4 days
Summary:
Curl calls getaddrinfo to resolve a domain's addresses, however glibc will continue though the domain search list to find data even if it gets a NODATA response. When using AF_UNSPEC in the ai_hints, this search will stop at the first domain with either an A or AAAA record, however when using AF_INET or AF_INET6, the search will continue until an address of the specified type is found. This was encountered by someone who had a wildcard subdomain for one of the domains in their search list (https://discourse.nixos.org/t/0a000410-ssl-routines-ssl-error-only-in-nix-sandbox/78015/3).
I apologize if glibc is a better location for this report considering their handling of NODATA (not NXDOMAIN) responses (https://sourceware.org/git/?p=glibc.git;a=blob;f=resolv/res_query.c;h=30ace9d06dcd7fe938df29a654643b656725de9f;hb=HEAD#l481).
Affected version
curl 8.20.0 (x86_64-pc-linux-gnu) libcurl/8.20.0 OpenSSL/3.6.2 zlib/1.3.2 brotli/1.2.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.5 libssh2/1.11.1 nghttp2/1.69.0 ngtcp2/1.22.1 nghttp3/1.15.0 mit-krb5/1.22.1 Release-Date: 2026-04-29 Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt mqtts pop3 pop3s rtsp scp sftp smtp smtps telnet tftp Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd
Steps To Reproduce:
Disable nscd and try to connect to an IPv4 only host (e.g. github.com) where an AAAA record exists for a domain in the search list (e.g. github.com.home.arpa). If curl can connect to the IPv6 address for github.com.home.arpa, it will prefer it over the IPv4 address for github.com.
Again: there is no bug-bounty for curl. We do not offer any rewards, only proper credits.
Impact
Summary:
An attacker in control of part or all of a domain on a computer's domain search list can intercept and block traffic to IPv4 only hosts. This does not affect certificate validation so TLS traffic can't be decrypted.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely glibc's resolver treats a NODATA response as a reason to keep searching the domain search list when a specific address family is requested, rather than stopping at the first matching name.
Impact
An attacker controlling a search-list domain could intercept and block traffic to IPv4-only hosts, though TLS certificate validation still prevents decryption.
What the attacker needed
Attacker controls a domain on the search list; target host is IPv4-only; nscd disabled
How it was found
- Disable nscd on the system.
- Choose an IPv4-only host such as github.com and ensure a domain on the search list has an AAAA record.
- Run curl against the IPv4-only host and observe whether it connects to the IPv6 address from the search-list domain.
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 report has not been written yet. The Original tab links to the source.
Computers often append a local suffix to short names when looking them up, like turning 'printer' into 'printer.office.example'. This report says that when curl asks for only IPv4 or only IPv6 addresses, the system keeps trying those suffixes even after the real name has no address of that kind. If someone owns one of those suffixes, they can make curl talk to their machine instead of the real server.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.