Windows Defender “HostsFileHijack” alert appears if Telemetry is blocked

Since July last week, Windows Defender started issuing Win32/HostsFileHijack “potentially unwanted behavior” alerts if you had blocked Microsoft’s Telemetry servers using the HOSTS file.

defender hostsfilehijack

Out of the SettingsModifier:Win32/HostsFileHijack cases reported online, the earliest one was reported at the Microsoft Answers forums where the user stated:

I’m getting a serious “potentially unwanted” message. I have the current Windows 10 2004 (1904.388) and only Defender as permanent protection.
How is that to evaluate, since nothing has changed at my hosts, I know that. Or is this a false positive message? A second check with AdwCleaner or Malwarebytes or SUPERAntiSpyware shows no infection.

“HostsFileHijack” alert if Telemetry is blocked

After inspecting the HOSTS file from that system, it was observed that the user had added Microsoft Telemetry servers to the HOSTS file and routed it to (known as “null-routing”) to block those addresses. Here is the list of telemetry addresses null-routed by that user.­

And the expert Rob Koch responded saying:

Since you’re null routing and other reputable websites into a black hole, Microsoft would obviously see this as potentially unwanted activity, so of course they detect these as PUA (not necessarily malicious, but undesired) activity, related to a Hosts File Hijack.

That you’ve decided it’s something you wish to do is basically irrelevant.

As I clearly explained in my first post, the change to perform the PUA detections was enabled by default with the release of Windows 10 Version 2004, so that’s the entire reason for your sudden issue. Nothing is wrong except that you don’t prefer to operate Windows in the manner that the developer Microsoft intended.

However, since your wish is to retain these unsupported modifications in the Hosts file, despite the fact they’ll clearly break many of the Windows functions those sites are designed to support, you’d likely be better off to revert the PUA detection portion of Windows Defender to disabled as it used to be in previous versions of Windows.

It was Günter Born who blogged about this issue first. Check out his excellent post Defender flags Windows Hosts file as malicious and his subsequent post on this topic. Günter was also the first to write about the Windows Defender/CCleaner PUP detection.

In his blog, Günter notes this has been happening since July 28, 2020. However, the Microsoft Answers post discussed above, was created on July 23, 2020, though. So, we don’t know which Windows Defender Engine/client version introduced the Win32/HostsFileHijack telemetry block detection exactly.

The recent Windows Defender definitions (issued from July 3rd week onwards) consider those ‘tampered’ entries in the HOSTS file as undesirable and warns the user of “potentially unwanted behavior” — with the threat level denoted as “severe”.

Any HOSTS file entry containing a Microsoft domain (e.g. such as the one below, would trigger an alert:


Windows Defender would then provide three options to the user:

  • Remove
  • Quarantine
  • Allow on device.

defender hostsfilehijack

Selecting Remove would reset the HOSTS file to the Windows-default settings, thereby completely erasing your custom entries if any.

defender hostsfilehijack

So, how do I block Microsoft’s telemetry servers?

If the Windows Defender team wants to continue with the above detection logic, you have three options to block telemetry without getting alerts from Windows Defender.

Option 1: Add HOSTS file to Windows Defender exclusions

You can tell Windows Defender to ignore the HOSTS file by adding it to exclusions.

  1. Open Windows Defender Security settings, click Virus & threat protection.
  2. Under Virus & threat protection settings, click Manage settings.
  3. Scroll down and click Add or remove exclusions
  4. Click Add an exclusion, and click File.
  5. Select the file C:\Windows\System32\drivers\etc\HOSTS and add it.
    defender hostsfilehijack

Note: Adding HOSTS to the exclusions list means that if a malware tampers with your HOSTS file in the future, Windows Defender would sit still and do nothing about the HOSTS file. Windows Defender exclusions must be used cautiously.

Option 2: Disable PUA/PUP scanning by Windows Defender

PUA/PUP (potentially unwanted application/program) is a program that contains adware, installs toolbars, or has unclear motives. In the versions earlier than Windows 10 2004, Windows Defender didn’t scan PUA or PUPs by default.  PUA/PUP detection was an opt-in feature that needed to be enabled using PowerShell or the Registry Editor.

hand point iconThe Win32/HostsFileHijack threat raised by Windows Defender comes under PUA/PUP category. That means, by disabling PUA/PUP scanning option, you can bypass the Win32/HostsFileHijack file warning despite having telemetry entries in the HOSTS file.

defender pua block windows 10

Note: A downside of disabling PUA/PUP is that Windows Defender would do nothing about the adware-bundled setup/installers that you inadvertently download.

tips bulb iconTip: You can have Malwarebytes Premium (which includes real-time scanning) running alongside Windows Defender. That way, Malwarebytes can take care of the PUA/PUP stuff.


Option 3: Use a custom DNS server like Pi-hole or pfSense firewall

Tech-savvy users can set up a Pi-Hole DNS server system and block adware and Microsoft telemetry domains. DNS-level blocking usually requires separate hardware (like Raspberry Pi or a low-cost computer) or a third-party service like OpenDNS family filter. OpenDNS family filter account provides a free option to filter adware and block custom domains.

Alternately, a hardware firewall like pfSense (along with the pfBlockerNG package) can accomplish this easily. Filtering servers at the DNS or firewall level is very effective. Here are some links which tell you how to block the telemetry servers using pfSense firewall:

Blocking Microsoft Traffic In PFSense | Adobo Syntax:

How to block in Windows10 Telemetry with pfsense | Netgate Forum:

Block Windows 10 From Tracking You:

Windows 10 Telemetry is bypassing VPN connection : VPN:
by u/Tzunamii from discussion Windows 10 Telemetry is bypassing VPN connection
in VPN
Connection endpoints for Windows 10 Enterprise, version 2004 - Windows Privacy | Microsoft Docs:

Editor’s note: I’ve never blocked telemetry or Microsoft Update servers in my systems. If you’re concerned very much about privacy, you can use one of the above workarounds to have the telemetry servers blocked without getting the Windows Defender alerts.

One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded in 2005.

1 thought on “Windows Defender “HostsFileHijack” alert appears if Telemetry is blocked”

  1. I’m glad I came across your blog. I’ll bookmark it and so remember to peruse it later.

    I will not be liking, sharing, and that sort of thing as you request; Only because I refuse to use face book, twitter, or etc. because I don’t “like” them, I get by without them, and I wish only for their demise.


Leave a Comment