Always use the local DNS resolver announced by DHCP for all queries ending with the primary DNS suffix
If you set a custom DNS server in Adguard for Windows, all queries for local hostnames on your network will also be redirected to the external DNS server. Routers such as FritzBox announce a primary DNS suffix "fritz.box" via DHCP. As a result, Windows appends the suffix "fritz.box" to all queries or pings to local network resources. If Adguard now forwards all DNS queries to an external DNS server, these queries will naturally fail with the response "NXDOMAIN".
Now this is problematic for two reasons:
-
the Windows "Web Proxy Autodiscovery Protocol" (WPAD) automatically searches for a proxy configuration in the local network, and makes a request "http://wpad.dns-suffix/wpad.dat" or in the case of the Fritzbox "http://wpad.fritz.box/wpad.dat". Due to Adguard DNS, this request does not end up at the FritzBox, but at the external DNS server, which responds with NXDOMAIN. As a result of the error, WPAD automatically tries to request the next level of the TLD, i.e. "http://wpad.box/wpad.dat". This then leads to a potential security hole if the domain "wpad.box" were to fall into the hands of criminals at some point, who could then distribute a malicious proxy script over it. Imagine the case of the DNS suffix "company.com", which would then ultimately lead to a request "wpad.com" to a public DNS resolver, followed by the execution of a script loaded from this page...
-
connecting to local network resources or SMB shares is noticeably slowed down, because Windows first tries to connect to a computer on the LAN by automatically appending the DNS suffix, i.e. using "hostname.fritz.box". Adguard also forwards these requests to the external DNS server. Only in the second attempt after this has failed or run into a timeout, Windows directly tries "hostname" without suffix (although I have no idea where it then gets the IP address from, maybe it's getting it from some sort of cache).
A possible solution to this problem would be for Adguard to look up whether the system has received a primary DNS suffix from the DHCP server, and then filter out any DNS queries ending in that suffix and forward it to the local DNS server announced by the DHCP rather than to the custom one configured in Adguard. Additionally, this would also help FritzBox users who wants to use the DNS feature of Adguard for Windows to continue using all features of the FritzBox without inconvenience, as many of them rely on local host name resolution of queries ending with "fritz.box". The same benefit would be for people in a company/university network, where local ressources like printers or intranet pages are accessible only via subdomains which are known only to the DNS resolver of the local network. Requests like "internal.company.com" will fail when they get redirected to a public resolver. If, however, "company.com" is announced as primary DNS suffix, passing these request to the DHCP-announced DNS will prevent all these inconveniences.
Your environment
- Adguard for Windows 7.5.3
- Windows 10, 21H1, build 19043.867
Edit: sry for closing/reopening, I hit the wrong button...
@AdguardTeam please also note that there are different scenarios and the suffix is not always present. So if you're planing to make any changes take this into account as well.
Makes perfect sense, but we should move it to DnsLibs and implement there first.
Issue moved to AdguardTeam/DnsLibs #100 via ZenHub
dns-libs/pull-requests/217