Skip to content

tighten SSRF protection - #2449

Open
pngwn wants to merge 1 commit into
mainfrom
blissful-spence-f4e007
Open

tighten SSRF protection#2449
pngwn wants to merge 1 commit into
mainfrom
blissful-spence-f4e007

Conversation

@pngwn

@pngwn pngwn commented Jul 24, 2026

Copy link
Copy Markdown
Member

Hardens the server-side ssrf guard so raw IP literals and ipv6 edge-cases can no longer slip past the private-range blocklist before a request leaves the box. General hardneing and prep for mcp oauth.

  • up-front host check before connecting: every request and redirect hop is now validated before the socket opens. Previously the check only ran in undici's dns lookup hook, which never fires for raw IP literals, so http://127.0.0.1 reached the network unchecked.
  • ipv4-mapped ipv6 fixed: matched via the ::ffff:0:0/96 subnet instead of ip-address's is4(), which only recognised the dotted form and missed the canonical hex form (::ffff:7f00:1). Closes the ::ffff:127.0.0.1 / ::ffff:169.254.169.254 bypass.
  • ipv6 unspecified :: blocked: routes to localhost, same as 0.0.0.0.
  • ipv6 unique-local fc00::/7 blocked: the ipv6 counterpart of the private 192.168/172.16 ranges.

@pngwn
pngwn force-pushed the blissful-spence-f4e007 branch from 2250601 to 803dc44 Compare July 24, 2026 08:30
@gary149
gary149 requested a review from rtrompier July 24, 2026 10:37
@gary149

gary149 commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

this was discussed a lot with @rtrompier (adding him)

@pngwn

pngwn commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

For reference, 10.0.0.0/8 which is used by internal load baancers is still allowed with this PR, and the existing tests for it still pass.

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