TLS certificate hostname bypass when the host loosely resolves to an IP address
Node.js TLS hostname verification normalises a non-canonical IPv4 literal with a leading zero using WHATWG URL rules (octal), while the actual connection uses the OS resolver, which on some platforms reads it as decimal. A server at the connected address could therefore be authenticated with a certificate issued for a different IP address.
Originally disclosed on HackerOne
- Triaged in 8 days
- Fixed in 44 days
- Disclosed after 46 days
Summary by the program
A flaw in Node.js TLS hostname verification can cause a server certificate to be validated against a different IP address than the one the client connected to, when the host is a non-canonical IPv4 literal with a leading zero, such as 0127.0.0.1.
tls.checkServerIdentity() normalizes the host following the WHATWG URL rules, which read a leading-zero octet as octal (0127.0.0.1 becomes 87.0.0.1), while the connection is made through the operating system resolver, which on some platforms such as macOS reads it as decimal (127.0.0.1). A server at the connected address can then be authenticated with a certificate issued for another IP address.
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 normalises the host with WHATWG URL rules (treating a leading-zero octet as octal) while the connection is resolved by the operating system, which on some platforms treats it as decimal, so the two disagree on the target address.
Impact
A server at the connected address could be authenticated with a certificate issued for another IP address, though the text notes this depends on the platform resolver behaviour.
What the attacker needed
Host written as a leading-zero IPv4 literal; platform resolver reads it as decimal
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 a program connects to a server over TLS, it checks that the server's certificate matches the address it meant to reach. Here the address was written in an unusual form with a leading zero, and the checking code and the connecting code disagreed about what that address meant. That mismatch could let a server present a certificate for a different address and still be accepted.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.