Join our Newsletter — 33% off our NHI Course

How can security teams detect /etc/hosts?

Security teams can detect tampering with /etc/hosts by monitoring the file for unauthorised changes and comparing it with a trusted baseline. Look for new name-to-IP mappings, especially entries that override legitimate internal or external domains. Changes here can redirect traffic, so review edits, ownership, and permissions promptly.

What to look for when /etc/hosts changes

The practical signal is not just that the file changed, but whether the change alters name resolution in a way the environment would not expect. Security teams should treat new host overrides, unexpected internal address mappings, or edits that redirect a familiar domain to a different IP as high-value indicators. File monitoring works best when it is paired with a trusted baseline and ownership checks, because the same file can be edited legitimately during troubleshooting.

A useful review path is to compare the current file against the approved version, then ask whether each mapping is necessary for the host’s role. That makes it easier to spot deliberate redirection, shadow IT testing, or quiet persistence attempts that depend on local resolution behaving differently from DNS.

Where tampering usually shows up first

Changes to /etc/hosts often surface before users notice anything obvious. Browser traffic may resolve to the wrong service, internal portals may send users to a different address, and security tooling may still show the DNS record as correct while the endpoint behaves differently. That gap is why host-level monitoring matters.

Review file metadata as part of detection, not just contents. Unexpected ownership, mode changes, or edits from non-administrative processes can be as important as the mapping itself. In mature environments, teams also correlate changes with process execution, remote login activity, and administrative windows so they can separate planned maintenance from suspicious modification.

How to confirm and contain suspicious edits

Once a suspicious change is found, confirm whether it is isolated to one endpoint or repeated across a fleet. If the same override appears on multiple systems, that can point to a broader configuration issue, a scripted deployment error, or coordinated tampering rather than a one-off local change. If only one host is affected, containment can stay narrow while the investigation focuses on who touched the file and why.

For visibility and response structure, map this kind of file-integrity and endpoint-change monitoring to the broader detection and recovery disciplines in the NIST Cybersecurity Framework 2.0. If the change is linked to adversary activity, use the MITRE ATT&CK Enterprise Matrix to reason about how local name-resolution tampering supports credential access, redirect-based abuse, or persistence.

Risk and Threat Considerations

Local hosts-file tampering is attractive because it can bypass expected DNS controls and quietly steer a system to an attacker-controlled destination. That makes it useful for phishing-style redirection, traffic interception, and persistence on a compromised endpoint, especially when teams do not routinely compare local resolution sources with approved baselines.

Failure mechanism: An attacker or misconfiguration changes local name resolution so the endpoint resolves a trusted hostname to an unexpected IP address, while DNS monitoring alone still appears normal.

Impact: Users can be sent to malicious services, internal traffic can be diverted, and investigation can be delayed because the endpoint behaviour no longer matches central DNS records.

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 CSF 2.0, NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
NIST CSF 2.0 DE.CM-01 — Networks and network services are monitored to detect potential cybersecurity events Hosts-file tampering can redirect traffic and needs continuous change detection.
ID.AM-03 — Hardware assets are inventoried Baseline comparison depends on knowing which systems should carry approved local overrides.
Recommendation — Monitor endpoint name-resolution changes and alert on unauthorized host overrides. Maintain an accurate host inventory so approved local mappings can be validated.
NIST SP 800-53 Rev 5 CM-5 — Access Restrictions for Change Unauthorized edits to /etc/hosts are prevented and controlled through change restrictions.
SI-7 — Software, Firmware, and Information Integrity File integrity monitoring and baseline comparison directly support integrity of host resolution.
Recommendation — Restrict who can modify host-resolution files and require approved change control. Use integrity monitoring to detect and investigate unauthorized /etc/hosts modifications.
CIS Controls v8 CIS-4 — Secure Configuration of Enterprise Assets and Software Hosts-file tampering is a secure-configuration drift issue on endpoints.
Recommendation — Continuously enforce and audit approved endpoint configuration baselines.
MITRE ATT&CK T1565.001 — Stored Data Manipulation: Local Data Manipulation Modifying /etc/hosts is direct local data manipulation used to alter resolution behavior.
Recommendation — Hunt for unauthorized local file changes that alter system behavior or routing.

Practitioner Guidance

What to verify: Check whether the file change corresponds to an approved change window, a sanctioned troubleshooting ticket, or a known deployment action. If not, treat the edit as a potential integrity event and preserve the current file, metadata, and relevant process context before remediation.

What good looks like: A trusted baseline exists, file-integrity alerts are monitored, and approved exceptions are rare, documented, and time-bounded. Teams should be able to explain why each non-default mapping is present and who owns it.

Practitioner takeaway: The key judgment is not whether /etc/hosts changed, but whether the change is explainable, authorized, and consistent with how the host should resolve critical names.