Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent DNS lookups for CNAME decloaking for adblock for already-blocked requests #15302

Closed
pes10k opened this issue Apr 14, 2021 · 2 comments · Fixed by brave/brave-core#8704

Comments

@pes10k
Copy link
Contributor

pes10k commented Apr 14, 2021

Brave looks up CNAME information for all requests so that we can make blocking decisions on the entire CNAME chain (when relevant). Currently the CNAME / DNS information is fetched before making any blocking decisions. This results in unnecessary DNS calls when we can make a blocking determination from the initial URL (or at least earlier on before reaching the end of a CNAME chain).

We should optimize our CNAME decloaking, and prevent non-useful DNS requests, by waiting to fetch CNAME records until we need them (i.e., we shouldn't do any checks when we can make a blocking determination from the initial, or middle of the CNAME chain, URL and host information).

@stephendonner
Copy link

stephendonner commented May 18, 2021

Verified PASSED on macOS for the first two testcases from brave/brave-core#8704 using build

Brave 1.26.24 Chromium: 91.0.4472.57 (Official Build) nightly (x86_64)
Revision e3443317fa07f1e9997e4a9c738eddfefc3c0292-refs/branch-heads/4472_54@{#6}
OS macOS Version 11.3.1 (Build 20E241)

Steps:

DoH off

  1. follow the section Using the (Pre)-Master-Secret to set up SSLKEYLOGFILE (https://wiki.wireshark.org/TLS#Using_the_.28Pre.29-Master-Secret)
  2. After Wireshark is capturing traffic, use the dns filter
  3. new profile, launch Brave
  4. go to brave://settings/security and set Use secure DNS via the toggle to off
  5. open Tor window
  6. navigate to https://tools.ietf.org
  7. after site loaded, stop Wireshark capturing
  8. there shouldn't be any DNS query or DoH query for tools.ietf.org

confirmed there were no CNAME / DNS lookups for tools.ietf.org in Wireshark

screenshots
example example
Screen Shot 2021-05-18 at 3 43 20 PM Screen Shot 2021-05-18 at 3 41 54 PM

DoH enabled

  1. follow the section Using the (Pre)-Master-Secret to set up SSLKEYLOGFILE (https://wiki.wireshark.org/TLS#Using_the_.28Pre.29-Master-Secret)
  2. after Wireshark is capturing traffic, use the dns filter
  3. new profile, launch Brave
  4. go to brave://settings/security and make sure Use secure DNS is toggled to on and With Cloudflare (1.1.1.1) is checked
  5. open Tor window
  6. navigate to https://tools.ietf.org
  7. after site finishes loading, stop Wireshark capturing
  8. there shouldn't be any DNS query or DoH query for tools.ietf.org

confirmed there were no CNAME / DNS lookups for tools.ietf.org in Wireshark

screenshots
example example
Screen Shot 2021-05-18 at 3 43 14 PM Screen Shot 2021-05-18 at 3 45 44 PM

MacRumors.com / googletagmanager

I filed #15953 for macOS-specific behavior; Windows 10 is working fine, but I haven't checked Linux.

/cc @brave/legacy_qa


Verification passed on

Brave 1.26.53 Chromium: 91.0.4472.77 (Official Build) beta (64-bit)
Revision 1cecd5c8a856bc2a5adda436e7b84d8d21b339b6-refs/branch-heads/4472@{#1246}
OS Ubuntu 18.04 LTS

Verified test plan from brave/brave-core#8704

DoH off

image
image
image

DoH on

image
image
image

MacRumors.com / googletagmanager

Reproduced on Ubuntu: #15953 (comment)


Verification passed on

<!--StartFragment-->
Brave | 1.26.54 Chromium: 91.0.4472.88&nbsp;(Official Build)&nbsp;beta&nbsp;(64-bit)
-- | --
Revision | 109e9cd038b94a631aea7d40ee3d56c1278f2597-refs/branch-heads/4472@{#1385}
OS | Windows&nbsp;10 OS Version 2004 (Build 19041.985)

<!--EndFragment-->

DoH off

image
image
image

DoH on

image
image
image

@srirambv
Copy link
Contributor

Verification done on OnePlus 6T with Android 10 running 1.26.63 x64 build

Removing Android label as the Tor windows is not possible on Android.

cc: @antonok-edm @pes10k

@rebron rebron changed the title Don't do DNS lookups for CNAME decloaking for adblock for already-blocked requests Prevent DNS lookups for CNAME decloaking for adblock for already-blocked requests Jun 21, 2021
@srirambv srirambv removed the OS/Android Fixes related to Android browser functionality label Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants