Detection rules › Splunk

Windows Hosts File Access

Author
Teoderick Contreras, Splunk
Source
upstream

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.

MITRE ATT&CK coverage

TacticTechniques
DiscoveryT1012 Query Registry

Event coverage

ProviderEvent IDTitle
Security-Auditing4663An attempt was made to access an object.

Stages and Predicates

Stage 1: search

search NOT process_path IN ("*:\\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") EventCode=4663 object_file_path="*:\\Windows\\System32\\drivers\\etc\\hosts"

Stage 2: stats

stats BY _time, object_file_path, object_file_name, dest, process_name, process_path, process_id, EventCode

Stage 3: eval

eval ...

Stage 4: lookup

lookup <lookup> browser_process_path, is_valid_browser_path, process_path

Stage 5: eval

eval ...

Stage 6: where

where is_valid_browser_path="false"

Stage 7: search

search

Stage 8: search

search

Stage 9: search

search `macro`

Exclusions

Top-level NOT(...) conjuncts — predicates this rule actively suppresses.

StageFieldKindExcluded values
1process_namein"*:\\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"

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
EventCodeeq
  • 4663 corpus 16 (splunk 16)
is_valid_browser_patheq
  • "false"
object_file_patheq
  • "*:\\Windows\\System32\\drivers\\etc\\hosts"

Neighbors

Broader alternatives (more inclusive than this rule)

These rules match a superset of what this rule catches. They cover the same events plus more. Use them if you want wider coverage and can absorb more false positives.