DNS hijacking

From HandWiki
Revision as of 16:48, 6 February 2024 by Jport (talk | contribs) (update)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Short description: Practice of subverting the resolution of Domain Name System queries

DNS hijacking, DNS poisoning, or DNS redirection is the practice of subverting the resolution of Domain Name System (DNS) queries.[1] This can be achieved by malware that overrides a computer's TCP/IP configuration to point at a rogue DNS server under the control of an attacker, or through modifying the behaviour of a trusted DNS server so that it does not comply with internet standards.

These modifications may be made for malicious purposes such as phishing, for self-serving purposes by Internet service providers (ISPs), by the Great Firewall of China and public/router-based online DNS server providers to direct users' web traffic to the ISP's own web servers where advertisements can be served, statistics collected, or other purposes of the ISP; and by DNS service providers to block access to selected domains as a form of censorship.

Technical background

One of the functions of a DNS server is to translate a domain name into an IP address that applications need to connect to an Internet resource such as a website. This functionality is defined in various formal internet standards that define the protocol in considerable detail. DNS servers are implicitly trusted by internet-facing computers and users to correctly resolve names to the actual addresses that are registered by the owners of an internet domain.

Screenshot of a dig command, showing a false response from an Iranian DNS server for a request to resolve Persian Wikipedia

Rogue DNS server

A rogue DNS server translates domain names of desirable websites (search engines, banks, brokers, etc.) into IP addresses of sites with unintended content, even malicious websites. Most users depend on DNS servers automatically assigned by their ISPs. A router's assigned DNS servers can also be altered through the remote exploitation of a vulnerability within the router's firmware.[2] When users try to visit websites, they are instead sent to a bogus website. This attack is termed pharming. If the site they are redirected to is a malicious website, masquerading as a legitimate website, in order to fraudulently obtain sensitive information, it is called phishing.[3]

Manipulation by ISPs

A number of consumer ISPs such as AT&T,[4] Cablevision's Optimum Online,[5] CenturyLink,[6] Cox Communications, RCN,[7] Rogers,[8] Charter Communications (Spectrum), Plusnet,[9] Verizon,[10] Sprint,[11] T-Mobile US,[12] Virgin Media,[13][14] Frontier Communications, Bell Sympatico,[15] Deutsche Telekom AG,[16] Optus,[17] Mediacom,[18] ONO,[19] TalkTalk,[20] Bigpond (Telstra),[21][22][23][24] TTNET, Türksat, and all Indonesian customer ISPs use or used DNS hijacking for their own purposes, such as displaying advertisements[25] or collecting statistics. Dutch ISPs XS4ALL and Ziggo use DNS hijacking by court order: they were ordered to block access to The Pirate Bay and display a warning page[26] while all customer ISP in Indonesia do DNS hijacking to comply with the National DNS law[27] which requires every customer Indonesian ISP to hijack port 53 and redirect it to their own server to block website that are listed in Trustpositif by Kominfo under Internet Sehat campaign. These practices violate the RFC standard for DNS (NXDOMAIN) responses,[28] and can potentially open users to cross-site scripting attacks.[25]

The concern with DNS hijacking involves this hijacking of the NXDOMAIN response. Internet and intranet applications rely on the NXDOMAIN response to describe the condition where the DNS has no entry for the specified host. If one were to query the invalid domain name (for example www.example.invalid), one should get an NXDOMAIN response – informing the application that the name is invalid and taking the appropriate action (for example, displaying an error or not attempting to connect to the server). However, if the domain name is queried on one of these non-compliant ISPs, one would always receive a fake IP address belonging to the ISP. In a web browser, this behavior can be annoying or offensive as connections to this IP address display the ISP redirect page of the provider, sometimes with advertising, instead of a proper error message. However, other applications that rely on the NXDOMAIN error will instead attempt to initiate connections to this spoofed IP address, potentially exposing sensitive information.

Examples of functionality that breaks when an ISP hijacks DNS:

  • Roaming laptops that are members of a Windows Server domain will falsely be led to believe that they are back on a corporate network because resources such as domain controllers, email servers and other infrastructure will appear to be available. Applications will therefore attempt to initiate connections to these corporate servers, but fail, resulting in degraded performance, unnecessary traffic on the Internet connection and timeouts.
  • Many small office and home networks do not have their own DNS server, relying instead on broadcast name resolution. Many versions of Microsoft Windows default to prioritizing DNS name resolution above NetBIOS name resolution broadcasts; therefore, when an ISP DNS server returns a (technically valid) IP address for the name of the desired computer on the LAN, the connecting computer uses this incorrect IP address and inevitably fails to connect to the desired computer on the LAN. Workarounds include using the correct IP address instead of the computer name, or changing the DhcpNodeType registry value to change name resolution service ordering.[29]
  • Browsers such as Firefox no longer have their 'Browse By Name' functionality (where keywords typed in the address bar take users to the closest matching site).[30]
  • The local DNS client built into modern operating systems will cache results of DNS searches for performance reasons. If a client switches between a home network and a VPN, false entries may remain cached, thereby creating a service outage on the VPN connection.
  • DNSBL anti-spam solutions rely on DNS; false DNS results therefore interfere with their operation.
  • Confidential user data might be leaked by applications that are tricked by the ISP into believing that the servers they wish to connect to are available.
  • User choice over which search engine to consult in the event of a URL being mistyped in a browser is removed as the ISP determines what search results are displayed to the user.
  • Computers configured to use a split tunnel with a VPN connection will stop working because intranet names that should not be resolved outside the tunnel over the public Internet will start resolving to fictitious addresses, instead of resolving correctly over the VPN tunnel on a private DNS server when an NXDOMAIN response is received from the Internet. For example, a mail client attempting to resolve the DNS A record for an internal mail server may receive a false DNS response that directed it to a paid-results web server, with messages queued for delivery for days while retransmission was attempted in vain.[31]
  • It breaks Web Proxy Autodiscovery Protocol (WPAD) by leading web browsers to believe incorrectly that the ISP has a proxy server configured.
  • It breaks monitoring software. For example, if one periodically contacts a server to determine its health, a monitor will never see a failure unless the monitor tries to verify the server's cryptographic key.

In some, but not most cases, the ISPs provide subscriber-configurable settings to disable hijacking of NXDOMAIN responses. Correctly implemented, such a setting reverts DNS to standard behavior. Other ISPs, however, instead use a web browser cookie to store the preference. In this case, the underlying behavior is not resolved: DNS queries continue to be redirected, while the ISP redirect page is replaced with a counterfeit DNS error page. Applications other than web browsers cannot be opted out of the scheme using cookies as the opt-out targets only the HTTP protocol, when the scheme is actually implemented in the protocol-neutral DNS.

Response

In the UK, the Information Commissioner's Office has acknowledged that the practice of involuntary DNS hijacking contravenes PECR, and EC Directive 95/46 on Data Protection which require explicit consent for processing of communication traffic. However, they have refused to intervene, claiming that it would not be sensible to enforce the law, because it would not cause significant (or indeed any) demonstrable detriment to individuals.[13][14] In Germany, in 2019 it was revealed that the Deutsche Telekom AG not only manipulated their DNS servers, but also transmitted network traffic (such as non-secure cookies when users did not use HTTPS) to a third-party company because the web portal T-Online, at which users were redirected due to the DNS manipulation, was not (any more) owned by the Deutsche Telekom. After a user filed a criminal complaint, the Deutsche Telekom stopped further DNS manipulations.[32]

ICANN, the international body responsible for administering top-level domain names, has published a memorandum highlighting its concerns, and affirming:[31]

ICANN strongly discourages the use of DNS redirection, wildcards, synthesized responses and any other form of NXDOMAIN substitution in existing gTLDs, ccTLDs and any other level in the DNS tree for registry-class domain names.

Remedy

End users, dissatisfied with poor "opt-out" options like cookies, have responded to the controversy by finding ways to avoid spoofed NXDOMAIN responses. DNS software such as BIND and Dnsmasq offer options to filter results, and can be run from a gateway or router to protect an entire network. Google, among others, run open DNS servers that currently do not return spoofed results. So a user could use Google Public DNS instead of their ISP's DNS servers if they are willing to accept that they use the service under Google's privacy policy and potentially be exposed to another method by which Google can track the user. One limitation of this approach is that some providers block or rewrite outside DNS requests. OpenDNS, owned by Cisco, is a similar popular service which does not alter NXDOMAIN responses.

Google in April 2016 launched DNS-over-HTTPS service.[33] This scheme can overcome the limitations of the legacy DNS protocol. It performs remote DNSSEC check and transfers the results in a secure HTTPS tunnel.

There are also application-level work-arounds, such as the NoRedirect[34] Firefox extension, that mitigate some of the behavior. An approach like that only fixes one application (in this example, Firefox) and will not address any other issues caused. Website owners may be able to fool some hijackers by using certain DNS settings. For example, setting a TXT record of "unused" on their wildcard address (e.g. *.example.com). Alternatively, they can try setting the CNAME of the wildcard to "example.invalid", making use of the fact that '.invalid' is guaranteed not to exist per the RFC. The limitation of that approach is that it only prevents hijacking on those particular domains, but it may address some VPN security issues caused by DNS hijacking.

See also

References

  1. "What is a DNS Hijacking | Redirection Attacks Explained | Imperva" (in en-US). https://www.imperva.com/learn/application-security/dns-hijacking-redirection/. 
  2. Constantin, Lucian (27 January 2015). "DNS hijacking flaw affects D-Link DSL router, possibly other devices" (in en-US). http://www.computerworld.com/article/2876292/dns-hijacking-flaw-affects-d-link-dsl-router-possibly-other-devices.html. 
  3. "Rogue Domain Name System Servers". Trend Micro. http://blog.trendmicro.com/rogue-domain-name-system-servers-5breposted5d/. 
  4. "ATT DNS Assist Page". 27 March 2017. https://forums.att.com/t5/AT-T-Internet-Features/ATT-DNS-Assist-Page/td-p/5108480. 
  5. "Optimum Online DNS Assistance". http://www.optimum.net/Article/DNS. 
  6. "Re: [Qwest Opting out of CenturyLink Web Helper hijacking not w - CenturyLink | DSLReports Forums"]. http://www.dslreports.com/forum/r26682725-. 
  7. "Who Stole My Web Browser?". 13 October 2009. http://infiniteedge.blogspot.com/2009/10/who-stole-my-web-browser.html. 
  8. "Rogers Uses Deep Packet Inspection for DNS Redirection". dslreports.com. 2008-06-20. http://www.dslreports.com/shownews/Rogers-Uses-Deep-Packet-Inspection-for-DNS-Redirection-96239. 
  9. "UK ISP's providing cdn for google". equk.co.uk. https://equk.co.uk/2014/04/07/uk-isps-providing-cdn-for-google/. 
  10. "Opting out of DNS Assistance". http://www.verizon.com/support/residential/internet/fiosinternet/troubleshooting/network/questionsone/99031.htm. 
  11. "Are Sprint 3G and 4G towers hijacking NXDOMAIN responses? More information in comments... • r/Sprint". 5 September 2014. https://www.reddit.com/r/Sprint/comments/2fl6pk/are_sprint_3g_and_4g_towers_hijacking_nxdomain/. 
  12. "How do I turn of NXDOMAIN hijacking? • r/tmobile". 20 July 2015. https://www.reddit.com/r/tmobile/comments/3dyk1h/how_do_i_turn_of_nxdomain_hijacking/. 
  13. 13.0 13.1 "ICO: We won't stop Advanced Network Error Search". https://nodpi.org/forum/index.php/topic,2390.msg25643/topicseen.html. 
  14. 14.0 14.1 "Case Reference Number ENQ0265706". https://nodpi.org/wp-content/uploads/2010/01/virgin_anes.pdf. ""I am not convinced that there is any likelihood of detriment or harm to subscribers or users that would justify taking formal action in this case."" [yes|permanent dead link|dead link}}]
  15. "Bell Starts Hijacking NS Domain Queries". http://tech.slashdot.org/story/09/08/04/1512248/Bell-Starts-Hijacking-NX-Domain-Queries. 
  16. Reiko Kaps (2009-04-17). "Telekom leitet DNS-Fehlermeldungen um" (in de). https://www.heise.de/newsticker/meldung/Telekom-leitet-DNS-Fehlermeldungen-um-213726.html. 
  17. "Optus' "About the Search Results Page"". http://service1.dnsassist.optusnet.com.au/search?qh=DNS. 
  18. "Want a real world example of why we need network neutrality? I have one here.". 25 September 2009. https://www.reddit.com/r/programming/comments/9o3as/want_a_real_world_example_of_why_we_need_network/. 
  19. "XSS Reflected dnssearch.Ono.es NXD redirect". 10 May 2010. http://www.iniqua.com/2010/05/10/nxdomain-redirect-xss/. 
  20. "TalkTalk - Search". http://error.talktalk.co.uk/main?ParticipantID=nmum6rqpq5q6gkm3933n3nf9s76onu6r&ClientLocation=uk&FailureMode=14&LinkID=Xyi3jH8AAAEAAG2pYhkAAABb&PlatformInfo=&LinkType=1&Implementation=0. [yes|permanent dead link|dead link}}]
  21. "BigPond redirects typos to 'unethical' branded search page". http://www.crn.com.au/News/160923,bigpond-redirects-typos-to-unethical-branded-search-page.aspx. 
  22. "Charter Corrupting DNS protocol ie hijacking hosts". http://www.dslreports.com/forum/r17871432-Charter-Corrupting-DNS-protocol-ie-hijacking-hosts. 
  23. "road runner dns hijack causing slow web-pages". http://jeffturner.net/2008/03/road-runner-dns-hijack-causing-slow-web-pages/. 
  24. "Rogers violates net neutrality by hijacking failed DNS lookups". http://www.digitalhome.ca/content/view/2689/206/. 
  25. 25.0 25.1 Singel, Ryan (19 April 2008). "ISPs Error Page Ads Let Hackers Hijack Entire Web, Researcher Discloses". Wired. http://blog.wired.com/27bstroke6/2008/04/isps-error-page.html. 
  26. Digined. "XS4ALL blokkeert adressen Pirate Bay voorlopig | XS4ALL Weblog" (in nl-NL). https://blog.xs4all.nl/xs4all-moet-adressen-pirate-bay-voorlopig-blokkeren/. 
  27. Tanjung, Tidar. "Kominfo Finalisasi DNS Nasional?" (in en-id). https://kominfo.go.id/index.php/content/detail/4991/Kominfo+Finalisasi+DNS+Nasional/0/sorotan_media. 
  28. Andrews, M. (1998). Negative Caching of DNS Queries. doi:10.17487/RFC2308. https://tools.ietf.org/html/rfc2308. 
  29. "NetBIOS and WINS". http://www.howtonetworking.com/netbios&wins.htm#How+to+modify+Node+Type. 
  30. "Using Firefox + NoRedirect Extension to Avoid DNS Hijacking". http://www.earobinson.org/2009/08/01/using-firefox-noredirect-extension-to-avoid-dns-hijacking/. 
  31. 31.0 31.1 "Harms Caused by NXDOMAIN Substitution in Toplevel and Other Registry-class Domain Names" (in en-US). ICANN. 2009-11-24. http://www.icann.org/en/topics/new-gtlds/nxdomain-substitution-harms-24nov09-en.pdf. 
  32. "Telekom beendet DNS-Hijacking". https://www.golem.de/news/t-online-navigationshilfe-telekom-beendet-dns-hijacking-nach-strafanzeige-1905-141370.html. 
  33. "DNS-over-HTTPS - Public DNS" (in en-US). 4 September 2018. https://developers.google.com/speed/public-dns/docs/dns-over-https. 
  34. "NoRedirect – Add-ons for Firefox". https://addons.mozilla.org/en-GB/firefox/addon/noredirect/.