That is why some Anti-Virus programs may monitor changes to the HOSTS file, preventing malicious software from modifying it.
So does Windows, and unless you use elevated permissions to edit the file, you will be prevented from saving it.
On Windows Operating Systems, the hosts file is located here , C – is the drive Windows OS had been installed.This is how the HOSTS file looks on a Windows 10 Technical Preview build machine: The HOSTS file may sometimes be used by malicious software such as adware, computer viruses, or trojan horses etc. For example, adding a line that translates 192.168.1.1 to “kuku”. These applications may use it to redirect traffic from the intended destination to sites hosting malicious or unwanted content. So the browsing and accessing other network places/shares by ‘name’ will be smoother by avoiding DNS server requests.We can manually customize DNS name and IP address for specific sites in this file which will be helpful in several ways in Windows or Mac OS X.
The Lmhosts file is located in the %System Root%\System32\Drivers\Etc folder on a Windows computer. SAM, and must be renamed to LMHOSTS before it can be used.