Skip to content

fix: block CGNAT range 100.64.0.0/10 in SSRF protection#253

Merged
pinodeca merged 1 commit into
microsoft:mainfrom
iemejia:fix/ssrf-cgnat
Jun 18, 2026
Merged

fix: block CGNAT range 100.64.0.0/10 in SSRF protection#253
pinodeca merged 1 commit into
microsoft:mainfrom
iemejia:fix/ssrf-cgnat

Conversation

@iemejia

@iemejia iemejia commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Split from #221 to ease review.

Add RFC 6598 Carrier-Grade NAT addresses to the IPv4 blocklist. These are used by cloud providers for internal routing and could expose metadata endpoints via DNS rebinding attacks.

Also narrow the cfg gate on extract_host to match only the feature flags that actually use it (http-allow-azure-domains, http-allow-test-domains) instead of the overly broad not(http-allow-all).

Files: src/ssrf.rs, src/lib.rs
Tests: 1 unit test + 1 pg_test

@pinodeca pinodeca left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed with Opus 4.8:

Findings

  1. Medium — ungated pg_test: test_ssrf_blocks_cgnat_range in lib.rs lacks #[cfg(not(feature = "http-allow-all"))], unlike its sibling unit test in ssrf.rs. Under http-allow-all, SSRF returns None and this test would fail.
  2. Low — docs: http-security.md §4.1 "Blocked IPv4 ranges" table wasn't updated to list 100.64.0.0/10 (RFC 6598).

Add RFC 6598 Carrier-Grade NAT addresses to the IPv4 blocklist. These
are used by cloud providers for internal routing and could expose metadata
endpoints via DNS rebinding attacks.

Also narrow the cfg gate on extract_host to match only the feature flags
that actually use it (http-allow-azure-domains, http-allow-test-domains)
instead of the overly broad not(http-allow-all).

@pinodeca pinodeca left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@pinodeca pinodeca merged commit b8f9844 into microsoft:main Jun 18, 2026
5 checks passed
@iemejia iemejia deleted the fix/ssrf-cgnat branch June 18, 2026 22:38
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.

2 participants