Improper certificate validation for non-canonical IPv4 hostnames allows DNS SANs to authenticate IP endpoints
Node.js TLS hostname verification failed to treat non-canonical IPv4 spellings as IP addresses, so a certificate carrying only a DNS SAN for an IP address was accepted when connecting to that IP written in an alternative form. An attacker with a CA-trusted certificate containing a numeric DNS name could therefore authenticate an IP endpoint that should have been rejected.
- Triaged in 8 days
- Fixed in 60 days
- Disclosed after 2 months
Summary by the program
A flaw in Node.js TLS hostname verification allows a certificate with only a DNS SAN to authenticate an IP endpoint when the client connects using a non-canonical IPv4 spelling, such as 0177.0.0.1, 0x7f.0.0.1, 2130706433 or 127.1.
tls.checkServerIdentity() did not classify these hosts as IP addresses, but normalized them to their canonical form and matched the result against the certificate DNS names. A certificate containing DNS:127.0.0.1 and no IP Address:127.0.0.1 SAN was therefore accepted, while the same certificate is correctly rejected for 127.0.0.1. Exploitation requires a certificate with a numeric DNS SAN issued by a CA trusted by the client, and a platform resolver that accepts these spellings, such as glibc.
This vulnerability affects Node.js 26.x, 24.x, and 22.x.
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 the hostname check did not recognise non-canonical IPv4 spellings as IP addresses, normalised them to canonical form, and then compared the result against DNS SANs instead of requiring an IP SAN.
Impact
A client connecting to an IP endpoint written in a non-canonical form could accept a certificate that only has a matching DNS SAN, so the endpoint is authenticated when it should not be; this depends on the client trusting a CA that issued such a certificate and on the platform resolver accepting those spellings.
What the attacker needed
CA-trusted cert with numeric DNS SAN; Client connects via non-canonical IPv4; Resolver accepts such spellings (e.g. glibc)
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.
When your browser or program connects to a server over TLS, it checks that the certificate names the host you asked for. Certificates can list names in two ways: as a domain name (DNS) or as a numeric IP address, and these are meant to be checked separately. Here, writing the same IP address in an unusual but valid form made Node.js compare it as if it were a domain name, so a certificate that should not have matched an IP address was accepted.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.