Skip to content

fix(unfurl): deny non-global IPv6 and reserved IPv4 in SSRF guard - #570

Open
cameronapak wants to merge 1 commit into
mainfrom
devin/1795101162-unfurl-ipv6-ssrf
Open

cameronapak wants to merge 1 commit into
mainfrom
devin/1795101162-unfurl-ipv6-ssrf

Conversation

@cameronapak

Copy link
Copy Markdown
Owner

Summary

isAllowedUnfurlTarget (run on the first URL and every redirect hop by fetchManualE) only decoded ::ffff: IPv4-mapped IPv6. NAT64 (64:ff9b::7f00:1), 6to4 (2002:7f00:1::), IPv4-compatible (::7f00:1) literals and reserved IPv4 ranges all passed.

IPv6 literals are now fully parsed (parseIpv6) and judged by an allowlist (isAllowedIpv6):

::ffff:0:0/96          -> judge embedded IPv4 (unchanged behavior, #232)
not 2000::/3           -> deny   (::, ::1, ::/96 compat, 64:ff9b::/96 NAT64, fc00::/7, fe80::/10, fec0::/10, ff00::/8)
2002::/16, 2001::/32   -> deny   (6to4, Teredo: tunnel to IPv4)
2001:db8::/32, 3fff::/20 -> deny (documentation)
else                   -> allow

isPrivateIpv4 also denies 192.0.0/24, 192.0.2/24, 198.18/15, 198.51.100/24, 203.0.113/24 and 224/4 + 240/4 (multicast, reserved, broadcast).

Side fix: the old host.startsWith("fc"|"fd") string check also blocked real hostnames like fcbarcelona.com / fdic.gov; the v6 checks now apply only to literals (hosts containing :).

Tests added in worker/unfurl.test.ts for each new denied form plus public v6/v4 and fc*/fd* hostnames that must stay allowed.

Link to Devin session: https://app.devin.ai/sessions/a8c2a2e383a84c25918bcbbfa3143566
Open in Devin Desktop: https://app.devin.ai/desktop/session/a8c2a2e383a84c25918bcbbfa3143566?variant=devin
Requested by: @cameronapak

Co-Authored-By: Cameron Pak <cameronandrewpak@gmail.com>
@pullfrog

pullfrog Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Pullfrog  | Review this ➔

@cameronapak cameronapak self-assigned this Nov 19, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

This branch has not been deployed

No deployments
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