fix(security): block IPv4-compatible IPv6 SSRF bypass#4467
fix(security): block IPv4-compatible IPv6 SSRF bypass#4467waleedlatif1 merged 3 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview
Reviewed by Cursor Bugbot for commit 031ef68. Configure here. |
Greptile SummaryThis PR fixes an SSRF bypass where IPv4-compatible IPv6 addresses (RFC 4291 §2.5.5.1, the deprecated
Confidence Score: 5/5Safe to merge — the change is a tightly scoped addition to a well-tested security function with no side effects on unrelated code paths. The logic correctly identifies the IPv4-compatible No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[isPrivateOrReservedIP ip] --> B{ipaddr.isValid?}
B -- No --> BLOCK[return true blocked]
B -- Yes --> C[addr = ipaddr.process ip]
C --> D{addr.range != unicast?}
D -- Yes --> BLOCK
D -- No --> E{addr.kind == ipv6?}
E -- No IPv4 --> ALLOW[return false allowed]
E -- Yes --> F{parts 0..5 all zero? /::/96 space/}
F -- No --> ALLOW
F -- Yes --> G[Extract embedded IPv4 from parts 6+7]
G --> H[embedded = ipaddr.fromByteArray bytes]
H --> I{embedded.range != unicast?}
I -- Yes private/reserved --> BLOCK
I -- No public --> ALLOW
Reviews (2): Last reviewed commit: "fix(security): correct RFC1918 test labe..." | Re-trigger Greptile |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 031ef68. Configure here.
* fix(security): block IPv4-compatible IPv6 SSRF bypass * fix(security): also block IPv4-compatible IPv6 with Class E embedded IPv4 * fix(security): correct RFC1918 test label for IPv4-compat IPv6
Summary
isPrivateOrReservedIPclassified deprecated IPv4-compatible IPv6 addresses (::a.b.c.d, RFC 4291 §2.5.5.1) as plain unicast becauseipaddr.jshas no SpecialRange entry for that prefix[::192.168.1.1]to[::c0a8:101], which then slipped past the validator and reached the MCP connection stage — confirmed reachable viaPOST /api/mcp/servers/test-connection::/96(excluding::ffff:0:0/96whichipaddr.jsalready extracts), pulls out the embedded IPv4, and recurses onrange()so private/reserved targets like169.254.169.254,127.0.0.1, and RFC1918 ranges are blocked regardless of encodingType of Change
Testing
input-validation.test.tsanddomain-check.test.tsChecklist