Hosts file tampering changes local name resolution so specific domains map to loopback or other attacker-chosen addresses. Ransomware uses it to block security sites, malware analysis services, or update destinations, which can isolate the victim machine from help and slow remediation efforts.
What hosts file tampering does
Hosts file tampering is a local name-resolution attack, not a DNS attack in the network path. By changing the mappings on one endpoint, an attacker can make trusted domains resolve to a chosen address, often without affecting any other machine in the environment.
Because the change happens on the host itself, normal network controls may not see it. That makes the technique useful for redirecting users, suppressing access to defensive services, or steering traffic away from legitimate update and support destinations.
Why attackers use it
The hosts file is attractive because it is simple, deterministic, and often trusted by the operating system before external DNS is consulted. A single line can override many security-relevant domains, including vendor portals, antivirus update services, or malware analysis sites, which can slow containment and hide compromise conditions.
This is especially useful during ransomware or post-exploitation activity, where blocking access to remediation tools can delay investigation and buy the attacker more time. The technique is also low-noise: if defenders are not monitoring local resolver settings, the change can persist unnoticed.
How hosts file tampering is detected
Exposure is usually found through endpoint inventory, file-integrity monitoring, and security telemetry that compares local name resolution against expected state. The practical question is whether the endpoint can still resolve the domains it needs for security operations, software updates, and incident response.
Detection often starts with a simple baseline review of the file itself, but mature monitoring looks for unexpected edits, new loopback mappings, or domain-specific overrides on hosts that should never carry them. You should also correlate the change with suspicious process activity, because the edit is usually just one step in a larger intrusion chain. For broader adversary mapping, the MITRE ATT&CK Enterprise Matrix helps place local tampering alongside persistence and defense-evasion techniques.
Prevention and recovery
Prevention is strongest when the hosts file is treated as a protected system artifact, not an ordinary text file. Restrict who can modify it, monitor it for drift, and make sure local administrative access is not broader than it needs to be. When defenders remove the malicious mapping, they should also confirm that the attacker did not use the same access path to alter update settings, proxy settings, or security tooling.
Recovery should include a post-change integrity check of the endpoint and a review of any security software, update channels, or support destinations that were blocked. If the tampering was used to isolate the host, restore network reachability first, then verify that the machine can again reach its legitimate control and remediation services. NIST guidance on endpoint and control hardening is often the right baseline, and a broader control catalog such as NIST SP 800-53 Rev 5 Security and Privacy Controls supports the underlying integrity and monitoring expectations.
Risk and Threat Considerations
Hosts file tampering is risky because it can silently sever an endpoint from the services defenders rely on most, including patching, threat intelligence, and malware remediation. The same technique can also be used to redirect users to attacker-controlled destinations if the hostile mapping points outward rather than to loopback.
Failure mechanism: The attacker changes local resolution before trusted DNS is used, so the endpoint reaches the wrong destination even when the network is otherwise healthy.
Impact: Security tooling can fail open or fail disconnected, remediation may stall, and the host can remain operationally isolated or actively misdirected during an intrusion.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
MITRE ATT&CK addresses the attack and risk surface, while NIST SP 800-53 Rev 5 sets the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| MITRE ATT&CK | T1565 — Data Manipulation | Hosts file tampering is a local configuration manipulation used to alter resolution. |
| Recommendation — Map the file edit to T1565 and hunt for adjacent tampering and defense-evasion activity. | ||
| NIST SP 800-53 Rev 5 | SI-7 — Software, Firmware, and Information Integrity | Integrity monitoring directly applies to unauthorized local resolution changes. |
| CM-5 — Access Restrictions for Change | Write access to the hosts file must be tightly restricted to prevent unauthorized changes. | |
| AU-6 — Audit Record Review, Analysis, and Reporting | Reviewing endpoint and change logs helps confirm when the tampering occurred. | |
| Recommendation — Monitor system files for unauthorized edits and alert on unexpected resolver changes. Restrict who can modify local name-resolution files and review privileged change paths. Correlate file changes with process and authentication telemetry to confirm the source. | ||
Practitioner Guidance
What to watch for: Treat unexpected hosts file edits as a containment signal, not a cosmetic configuration issue. If the modification appears alongside failed updates, unreachable security portals, or unusual administrative activity, assume the endpoint may be trying to hide or prolong compromise.
Practitioner takeaway: The key judgment is whether the tampering is only blocking a benign destination or actively removing the machine from your defensive reach, because that distinction changes how urgently you investigate the host and its neighboring systems.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on October 30, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org