Skip to content

Fix DNS rebinding bypass (#69)#73

Draft
jjk1492 wants to merge 1 commit into
ACK-J:mainfrom
jjk1492:fix/dns-rebinding-bypass-69
Draft

Fix DNS rebinding bypass (#69)#73
jjk1492 wants to merge 1 commit into
ACK-J:mainfrom
jjk1492:fix/dns-rebinding-bypass-69

Conversation

@jjk1492

@jjk1492 jjk1492 commented May 9, 2026

Copy link
Copy Markdown
Contributor

Problem

The local_filter regex in cancel() only matches requests whose URL contains a literal local IP address or localhost. A hostname like attacker.com that resolves to 127.0.0.1 passes all checks unblocked:

  1. thirdParty: true — passes same-origin guard
  2. Not in allowlist — passes whitelist check
  3. local_filter regex — no match (URL contains the hostname, not the IP)
  4. DNS was only used for ThreatMetrix CNAME detection, not IP validation

Reported in #69.

Fix

Added a pure isPrivateIPv4(ip) helper that covers all RFC-1918, loopback (127.0.0.0/8), link-local (169.254.0.0/16), and 0.0.0.0 ranges.

Updated the DNS resolution block to call browser.dns.resolve() once and check both:

  • Whether any resolved address is a private IP → block as port scan
  • Whether the CNAME chain hits ThreatMetrix → block as tracker

The existing dns permission and browser.dns.resolve() usage are unchanged. The local_filter regex is kept as a fast pre-filter for literal-IP URLs.

Fail-open on DNS error — resolution failures (NXDOMAIN, captive portals, split-horizon DNS) allow the request through rather than breaking legitimate browsing.

Testing

Load the extension from source, open the browser console, and verify a domain with an A record pointing to 127.0.0.1 is blocked while a non-local domain is allowed.

Closes #69

Hostnames that resolve to RFC-1918/loopback addresses (e.g. evil.com → 127.0.0.1)
previously bypassed local_filter because the regex only matched literal IPs. After
the regex check, resolve the hostname and reject any address that falls in a private
range. Reuses the existing dns permission and browser.dns.resolve() call.

Closes ACK-J#69

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jjk1492 jjk1492 marked this pull request as draft May 9, 2026 15:59
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.

Domain names that resolve to local addresses aren't blocked

2 participants