Detection rules › Splunk

Windows Hosts File Access

Status
production
Severity
low
Group by
_time, dest, object_file_name, process_id, process_name, signature_id, target_filename
Author
Teoderick Contreras, Splunk
Source
github.com/splunk/security_content

This Analytic detects the execution of a process attempting to access the hosts file. The hosts file is a critical file for network configuration and DNS resolution. If an attacker gains access to it, they can redirect traffic to malicious websites, serve fake content or block legitimate security websites.

Known false positives

  • Administrator may access this registry for product key recovery purposes.

MITRE ATT&CK coverage

TacticTechniques
Discovery

Telemetry coverage

Rule body

name: Windows Hosts File Access
id: b34bcf35-5380-4b00-b208-5531303fb751
version: 4
creation_date: '2026-03-16'
modification_date: '2026-05-13'
author: Teoderick Contreras, Splunk
status: production
type: Anomaly
description: |
    This Analytic detects the execution of a process attempting to access the hosts file.
    The hosts file is a critical file for network configuration and DNS resolution.
    If an attacker gains access to it, they can redirect traffic to malicious websites, serve fake content or block legitimate security websites.
data_source:
    - Windows Event Log Security 4663
search: |
    `wineventlog_security`
    EventCode=4663
    object_file_path="*:\\Windows\\System32\\drivers\\etc\\hosts"
    NOT process_path IN (
        "*:\\Windows\\explorer.exe",
        "*:\\Windows\\System32\\lsass.exe",
        "*:\\Windows\\System32\\SearchIndexer.exe",
        "*:\\Windows\\System32\\services.exe",
        "*:\\Windows\\System32\\svchost.exe",
        "*:\\Windows\\SysWow64\\SearchIndexer.exe",
        "*:\\Windows\\SysWow64\\svchost.exe"
    )
    | stats count
        by _time object_file_path object_file_name dest process_name
           process_path process_id EventCode
    | eval process_path = lower(process_path)
    | lookup browser_process_and_path browser_process_path as process_path OUTPUT is_valid_browser_path
    | eval is_valid_browser_path=coalesce(is_valid_browser_path,"false")
    | where is_valid_browser_path = "false"
    | `security_content_ctime(firstTime)`
    | `security_content_ctime(lastTime)`
    | `windows_hosts_file_access_filter`
how_to_implement: |
    To successfully implement this search, you must ingest Windows Security Event logs and track event code 4663. For 4663, enable "Audit Object Access" in Group Policy. Then check the two boxes listed for both "Success" and "Failure." This search may trigger on a browser application that is not included in the browser_app_list lookup file.
known_false_positives: Administrator may access this registry for product key recovery purposes.
references:
    - https://cert.gov.ua/article/6284730
intermediate_findings:
    entities:
        - field: dest
          type: system
          score: 20
          message: A [$process_name$] attempting to access the hosts file [$object_file_path$] on [$dest$].
threat_objects:
    - field: process_name
      type: process_name
analytic_story:
    - BlankGrabber Stealer
    - Gh0st RAT
asset_type: Endpoint
mitre_attack_id:
    - T1012
product:
    - Splunk Enterprise
    - Splunk Enterprise Security
    - Splunk Cloud
category: endpoint
security_domain: endpoint

Stages and Predicates

Stage 1: search

`wineventlog_security`
EventCode=4663
object_file_path="*:\\Windows\\System32\\drivers\\etc\\hosts"
NOT process_path IN (
    "*:\\Windows\\explorer.exe",
    "*:\\Windows\\System32\\lsass.exe",
    "*:\\Windows\\System32\\SearchIndexer.exe",
    "*:\\Windows\\System32\\services.exe",
    "*:\\Windows\\System32\\svchost.exe",
    "*:\\Windows\\SysWow64\\SearchIndexer.exe",
    "*:\\Windows\\SysWow64\\svchost.exe"
)

Stage 2: stats

| stats count
    by _time object_file_path object_file_name dest process_name
       process_path process_id EventCode

Stage 3: eval

| eval process_path = lower(process_path)

Stage 4: lookup

| lookup browser_process_and_path browser_process_path as process_path OUTPUT is_valid_browser_path
Lookup table
browser_process_and_path
Key field
browser_process_path as process_path
Output columns
['is_valid_browser_path', 'is_valid_browser_path']

Stage 5: eval

| eval is_valid_browser_path=coalesce(is_valid_browser_path,"false")

Stage 6: where

| where is_valid_browser_path = "false"

Stage 7: search

| `security_content_ctime(firstTime)`

Stage 8: search

| `security_content_ctime(lastTime)`

Stage 9: search

| `windows_hosts_file_access_filter`

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process_pathin"*:\\Windows\\SysWow64\\SearchIndexer.exe", "*:\\Windows\\SysWow64\\svchost.exe", "*:\\Windows\\System32\\SearchIndexer.exe", "*:\\Windows\\System32\\lsass.exe", "*:\\Windows\\System32\\services.exe", "*:\\Windows\\System32\\svchost.exe", "*:\\Windows\\explorer.exe"excludes:process_path

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
EventCodeeq
  • 4663 corpus 35 (splunk 30, kusto 5)
field:"EventID" kind:eq value:"4663"
is_valid_browser_patheq
  • "false"
field:"is_valid_browser_path" kind:eq
object_file_patheq
  • "*:\\Windows\\System32\\drivers\\etc\\hosts"
field:"TargetFilename" kind:eq