security(core): reject the RFC 8215 local-use NAT64 prefix in the SSRF filter - #7959
Open
ar2rsawseen wants to merge 1 commit into
Open
security(core): reject the RFC 8215 local-use NAT64 prefix in the SSRF filter#7959ar2rsawseen wants to merge 1 commit into
ar2rsawseen wants to merge 1 commit into
Conversation
…F filter isBlockedIP admits only ipaddr.js 'unicast' addresses and relies on ipaddr.js to classify NAT64 as non-public. ipaddr.js@1.9.1 reports the well-known NAT64 prefix (64:ff9b::/96) as 'rfc6052' but the RFC 8215 local-use prefix (64:ff9b:1::/48) as generic unicast, so add an explicit check to reject that prefix, matching the existing NAT64 handling. Network-specific NAT64 prefixes carved from an operator's own unicast space cannot be distinguished by prefix and remain out of scope. Mirrors the same change in the MCP server's address classifier. Adds unit tests for 64:ff9b:1::7f00:1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
api/utils/ssrf-protection.jsisBlockedIPadmits only ipaddr.jsunicastaddresses and relies on ipaddr.js to classify NAT64 as non-public.ipaddr.js@1.9.1reports the well-known NAT64 prefix (64:ff9b::/96) asrfc6052(rejected by theunicastcheck) but the RFC 8215 local-use NAT64 prefix (64:ff9b:1::/48) as genericunicast, so it was accepted.This adds an explicit check to reject
64:ff9b:1::/48, matching the module's existing NAT64 handling and documented intent. Network-specific NAT64 prefixes carved from an operator's own global-unicast space cannot be distinguished by prefix and remain out of scope; the connect-time routing requirement bounds the residual.This is the shared core SSRF module, so it applies to both this repo and countly-platform. It mirrors the same change in the MCP server's address classifier (Countly/countly-mcp-server#152).
Tests: two cases added to
test/unit-tests/api.utils.ssrf-protection.js(local-use NAT64 rejected; public IPv6 still allowed). Full SSRF suite and eslint green.🤖 Generated with Claude Code