Skip to content

Add test coverage for standard NAT64 prefix and IPv4-mapped IPv6 in SSRF protection - #8041

Open
presendapp wants to merge 1 commit into
Countly:masterfrom
presendapp:ssrf-add-ipv4-mapped-and-nat64-tests
Open

presendapp wants to merge 1 commit into
Countly:masterfrom
presendapp:ssrf-add-ipv4-mapped-and-nat64-tests

Conversation

@presendapp

Copy link
Copy Markdown

isBlockedIP() already handles both cases correctly -- the rfc6052 range check for the standard 64:ff9b::/96 NAT64 prefix, and the explicit isIPv4MappedAddress() unwrap-and-recheck for ::ffff:x.x.x.x -- but neither had an explicit test naming them. Only the RFC 8215 local-use NAT64 variant (64:ff9b:1::/48) was covered.

Added 3 cases:

  • the standard NAT64 prefix (should block, embeds a loopback address)
  • an IPv4-mapped IPv6 loopback (should block)
  • an IPv4-mapped IPv6 public address (should allow -- confirms the check unwraps and rechecks the embedded IPv4 rather than blocking every mapped address outright)

All 17 tests (14 existing + 3 new) pass locally with mocha 10.8.2. No behavior change, test coverage only.

isBlockedIP() already handles both cases correctly (the rfc6052 range
check for the standard 64:ff9b::/96 NAT64 prefix, and the explicit
isIPv4MappedAddress() unwrap-and-recheck for ::ffff:x.x.x.x), but
neither had an explicit test naming them -- only the RFC 8215
local-use NAT64 variant (64:ff9b:1::/48) was covered.

Added 3 cases: the standard NAT64 prefix, an IPv4-mapped IPv6 loopback
(should block), and an IPv4-mapped IPv6 public address (should allow,
to confirm the check isn't overly broad and only unwraps to recheck
the embedded IPv4, not blocking every mapped address outright).

All 17 tests (14 existing + 3 new) pass locally with mocha 10.8.2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant