Details
Reading the result: every control (direct IMDS, RFC 1918, loopback, IPv4-mapped IMDS) is rejected at the gate with blocked fetch to non-public address and no socket is ever opened. Every CGNAT / 6to4 / NAT64 / site-local target instead passes isPublicIP and proceeds to the network dial — observed as context deadline exceeded or EOF (a real connection attempt), never blocked fetch to non-public address. The blocked vs dial-attempted split isolates the isPublicIP classification defect precisely.
A standalone re-check of the verbatim isPublicIP body confirms the classification directly (Go 1.26.1):
100.64.0.1 isPublicIP=true (CGNAT — should be blocked)
100.127.255.254 isPublicIP=true (CGNAT)
2002:a9fe:a9fe:: isPublicIP=true (6to4 -> 169.254.169.254)
64:ff9b::a9fe:a9fe isPublicIP=true (NAT64 -> 169.254.169.254)
64:ff9b:1::a9fe:a9fe isPublicIP=true (NAT64 local-use -> 169.254.169.254)
fec0::1 isPublicIP=true (deprecated site-local)
169.254.169.254 isPublicIP=false (direct IMDS — correctly blocked, control)
::ffff:169.254.169.254 isPublicIP=false (IPv4-mapped — correctly blocked, control)
8.8.8.8 isPublicIP=true (public — correctly allowed, control)
Honest scope note
The test host used for verification has no CGNAT/NAT64 routing that returns to a local recorder, so I did not capture live instance-metadata bytes here — the connection lands on the upstream NAT or times out. The 6to4/NAT64 vectors require a dual-stack or NAT64-enabled host to reach IMDS, and the CGNAT vector requires the deployment's internal network to use 100.64.0.0/10. These are the same routing preconditions the references below were accepted under. The defect demonstrated above is unconditional: isPublicIP permits the forbidden ranges on every host.
References (canonical dimension precedents)
- CVE-2026-45741 / GHSA-86m8-88fq-xfxp — Gotenberg
IsPublicIPIPv6 6to4 / NAT64 / site-local bypass; same Gonetip+Unmapgap. - GHSA-5jh9-2h63-pw4q — CC-Tweaked NAT64 (
64:ff9b::/96) bypass; their fix addsisCarrierGradeNatAddress(CGNAT) + NAT64 handling.
Suggested fix
In isPublicIP, after Unmap():
- Reject CGNAT:
100.64.0.0/10for IPv4 (and the::ffff:100.64.0.0/106mapped form is already handled byUnmap). - For IPv6, extract any embedded IPv4 and re-run the classification on it: 6to4 (
2002::/16-> bytes 2-5), NAT64 well-known (64:ff9b::/96) and local-use (64:ff9b:1::/48) -> low 32 bits. Then apply the same loopback/private/link-local/CGNAT checks to the extracted IPv4. - Reject deprecated site-local
fec0::/10.