Repository navigation
fix(network): classify NAT64/6to4 by embedded IPv4 and block reserved ranges - #2574
Merged
Merged
Conversation
… ranges is_private_ip let 64:ff9b::/96 and 2002::/16 addresses through even when they embed loopback, RFC1918 or link-local v4, and missed 0.0.0.0/8, 192.0.0.0/24, 198.18.0.0/15, multicast, 240.0.0.0/4, Teredo, site-local and v6 multicast. An allowlisted host with attacker DNS could reach internal services via these forms. Adds TM-NET-029.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | f7bd566 | Commit Preview URL Branch Preview URL |
Oct 07 2026, 06:20 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Михайло · project thread
What changed
The SSRF guard (
is_private_ip, used before the request and in the connect-time resolver) now:64:ff9b::/96) and 6to4 (2002::/16) addresses by the IPv4 address they carry;0.0.0.0/8,192.0.0.0/24,198.18.0.0/15,224.0.0.0/4,240.0.0.0/4(incl. broadcast), and v6100::/64, Teredo2001::/32, local-use NAT6464:ff9b:1::/48, site-localfec0::/10, multicastff00::/8.Documentation ranges (
192.0.2.0/24,198.51.100.0/24,203.0.113.0/24,2001:db8::/32) stay allowed, since they are unroutable and tests use them as public stand-ins.Why
An allowlisted hostname with attacker-controlled DNS could return
64:ff9b::a9fe:a9feor2002:7f00:1::. On a NAT64 network, or through a 6to4 relay, those reach cloud metadata or loopback while passing the v4 checks. Spotted while comparing against shipfastlabs/bashbox, which already handles these forms. New threat entry TM-NET-029.Before / After
Before: the 4 new unit tests fail (
test_is_private_ip_nat64_embeds_v4,_6to4_embeds_v4,_reserved_v4_ranges,_reserved_v6_ranges).After:
cargo test -p bashkit --lib --features http_client network::gives 58 passed, 0 failed.Risk
198.18/15) or Teredo addresses can no longer be reached. None of these are legitimate HTTP targets.Checklist