Skip to content

Instantly share code, notes, and snippets.

@JohnLBevan
Last active March 22, 2022 10:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JohnLBevan/ec5991482e4ae02fcfd6c10d1a3b67b3 to your computer and use it in GitHub Desktop.
Save JohnLBevan/ec5991482e4ae02fcfd6c10d1a3b67b3 to your computer and use it in GitHub Desktop.
NXDomain DNS Hijacking BareFruit

ISP DNS Hijacking Notes

Symptoms

  • Web pages replaced with ISP's pages / adverts.
  • Failure to find/connect to expected resources.
  • Monitoring/tests of services that are down shows them as being up / responding to HTTP or ICMP pings.
  • Issues particularly common when using VPN.

Fixes per offender

UK - BT Broadband

UK - Talk Talk

I've not yet found a working fix for this, but in theory the below should work:

  • Disable it here: https://www.talktalk.co.uk/optout/ then restart your router. NB: Doesn't work for most users.
  • Contact support: https://community.talktalk.co.uk/ - select the chat option in the bottom right and say "I'd like to opt-out of TalkTalk's Error Replacement Service". There's also an 0345 number; but that's like tipping someone for giving you bad service.

UK - Virgin Media

Other

List of offensive IPs

Explanation

ISPs do this for money, even though you're a paying customer and this damages your service. The line they give is "rather than an unhelpful error message, we help you find something you're after" (paraphrased). What they mean is "instead of reporting an error so your system can handle it, we direct you to a site that pays us to send you their way, and we pass on all the information that you'd been sending to the site you requested to a company you don't know, who do god knows what with it".

  • I request server: myServer
  • This is not an FQDN, so my computer appends my primary DNS suffix: myServer.myPrimaryDnsSuffix.com
  • My computer then sends a DNS lookup request. This is not a valid name (since this server is on a different domain, so its FQDN is myServer.myOtherDnsSuffix.com). As such, the DNS server returns an NXDOMAIN ("non existnant domain" / no joy)
  • My ISP sees the NXDOMAIN response and replaces it with an A Record response pointing at BareFruit's (or whoever's) IP (which were I using a web browser would directs my HTTP traffic at their advertising pages).
  • When my computer sees the A record returned it believes the lookup to be successful, so doesn't work through the rest of my DNS Search Suffix list (i.e. doesn't try to lookup myServer.myOtherDnsSuffix.com), so doesn't find the correct IP

These issues are most often seen on VPN since you're looking for items in a private DNS that the ISP won't be aware of.

Accessing by IP or FQDN circumvents this issue. The problem with using IP (aside from inconvenience) is that many SSL certificates only include the FQDN in their SAN list; not the IP; so when the browser compares the IP with the certificate's details, it will show a warning. Generally using FQDN should be OK - but if there are any links in pages which don't use the FQDN, those will have problems (i.e. since the user can't amend the site's internal content). For those it's best that the site owners ensure they always use FQDNs rather than netbios names when sending content to the client.

FAQs

Isn't this illegal / doesn't the law give some protection against this?

In my opinion it should be; you're paying for a service and not receiving it. However it could be argued that the law doesn't say that communication standards have to be followed, and likely the ISPs legal teams have put something in the small print that you've agreed to, so it may be hard to word a law to cover this that wouldn't then risk opening the innocent to litigation. Also, I have no legal knowledge.

Is this a security issue?

Yes. DNS Hijacking doesn't mean that you're actually being attacked by someone malicious; this is all above board and there are contracts in place between your ISP and BareFruit (or potentially other vendors doing the same). However, once your DNS request fails and you're given the false IP, all communication from your client to what it believes to be the correct resource is then sent to BareFruit's servers. In theory, they can get a lot of information from you. This is one reason why SSL certificates are important; they give your client a way to validate that the resource is what it claims to be. Also, BareFruit don't really care about you; you're not their customer; so they have no reason to protect you beyond basic legal / contractual requirements. As such, who's to say a malicious hacker couldn't exploit their systems / they've just added another potential vulnerability to the list...

I have the same issue, but my ISP's not listed here

Please comment on this GIST. My aim with this is to provide a single resource where anyone with this issue can find the solution for their ISP.

Note: BareFruit provide the following advice: BareFruit Opt Out. Basically, change your DNS server from your ISPs to an alternative. The CloudFlare 1.1.1.1 DNS service is a good, free option: More Info.

The best fix: Change your ISP

By introducing this feature and enabling it by default your ISP is providing you with an unfit for purpose service.

I personally recommend switching to Zen: https://www.zen.co.uk/, though do your research before making any decisions.

Other Links

@JohnLBevan
Copy link
Author

I've heard rumours that Plus.Net may be doing this. I can't find confirmation of this. Looking around I found an opt-out page for something called "direct marketing", but it's unclear if that's DNS Hijacking, or some other marketing preference. Should it help others sharing here: http://www.plus.net/dm/optout/ - but not included in the gist as it's not yet verified.

@rudikershaw
Copy link

Looks like the "List of offensive IPs" link is dead.

@JohnLBevan
Copy link
Author

Thanks @rudikershaw - it seems the trailing dot wasn't included in the clickable link; now fixed.

@userbradley
Copy link

This reallly pissed me off. If you're using a BT hot spot (bt wifi x, the likes) you have no control over it.

I found the best way to stop traffic being send to the site, as changing your DNS settings breaks internet, is to use an ad blocker. I am making the assumption they block all port 53 to anything other than their DNS servers.

The sketchy fix is to use something like Ublock Origin and add *.barefruit.com to your block list.

image

Really not happy with ISP's doing this. If I had the money and legal knowledge I would sue them for everything they had.

@userbradley
Copy link

One additional fix I found for this, which is a lot better is to use the cloud flare tunnel.

If you use a bt hotspot, get the IP address of the login page, and add it to your /etc/hosts file like below:

127.0.0.1       localhost

92.168.23.21 www.btopenzone.com

Install it here: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation/

Once done, run sudo cloudflared proxy-dns (Sudo is required)

Change your DNS settings on your computer to use 127.0.0.1
image

You should now be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment