fix: DNS rebinding protection checks AAAA (IPv6) records too#744
Open
Gonzih wants to merge 1 commit intogarrytan:mainfrom
Open
fix: DNS rebinding protection checks AAAA (IPv6) records too#744Gonzih wants to merge 1 commit intogarrytan:mainfrom
Gonzih wants to merge 1 commit intogarrytan:mainfrom
Conversation
resolvesToBlockedIp() was only calling resolve4() — an attacker could host a DNS entry with only AAAA records pointing to a blocked IPv6 metadata endpoint (fe80::, fd00::, etc.) and bypass the check entirely. Fix: - Check both A and AAAA records in parallel (Promise.all) - Block entire fe80::/10 link-local range, not just a single address - Add ::ffff:169.254.169.254 (IPv4-mapped IPv6) to the blocklist - Independent error handling per record family — ENODATA on one type doesn't suppress the other Closes garrytan#668
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.
The Gap
`resolvesToBlockedIp()` in `url-validation.ts` only called `resolve4()` (A records). A DNS rebinding attack using AAAA-only records pointing to IPv6 metadata endpoints (e.g. `fe80::1`, GCP's IPv6 metadata endpoint) bypassed the check completely.
Issue #668 documented this. Here's the fix.
Changes
The DNS calls were already async and run in parallel, so no performance regression.
sent from mStack