Blackhat hackers modify the Windows event log to erase traces of their activity and hinder forensic investigations, a tactic categorized under Defense Evasion in frameworks like MITRE ATT&CK. The methods range from crude, noisy deletions to stealthy, surgical tampering that leaves minimal evidence.
đź§ą Outright Log Clearing
This is the most direct—and noisiest—approach. It removes the entire contents of a log channel, often generating a highly visible Event ID 1102 (“The audit log was cleared”) that defenders can easily detect.
- Native Command-Line Utilities: Using built-in tools like
wevtutil.exe(e.g.,wevtutil cl Security) or PowerShell’sRemove-EventLog -LogName Securitywith administrative privileges. - Event Viewer GUI: Manually clearing logs through the graphical interface, which achieves the same result but may be less common in automated attacks.
- Third-Party Tools: Using utilities like
psloglist.exewith its-cflag to clear specific logs from the command line.
đź“‚ Direct File Manipulation
Instead of using the logging service, attackers can target the underlying .evtx log files stored in C:\Windows\System32\winevt\logs\. This bypasses some API-level logging but requires overcoming file locks held by the EventLog service.
- File Deletion: Simply deleting the
.evtxfiles, though this requires first stopping or suspending the EventLog service to release its exclusive lock on the files. - Log Redirection: Modifying the
Filevalue in the registry under...\Services\EventLog\[LogName]to point to a different or malicious.evtxfile, hiding future events from the legitimate log.
✂️ Surgical Log Tampering
Sophisticated actors avoid the obvious “log cleared” event by removing or modifying individual records. This is a more stealthy “poisoning of the well” that can make the log appear intact while hiding specific activity.
- Event-Level Deletion: Using specialized tools (like
EventCleaneror certain features ofmimikatz) to surgically remove specific event records without triggering a full-log clear notification. This often involves suspending the EventLog service threads, closing file handles, and editing the.evtxfile directly. - Log Configuration Manipulation: Reconfiguring the log to drop new events instead of overwriting old ones, or shrinking its maximum size to a tiny value (e.g., 64KB). After malicious activity, the attacker can restore the original size, causing older evidence to be rapidly overwritten and lost.
🔇 Disabling or Impairing Logging
Rather than altering past records, attackers can prevent future events from being recorded, creating a “blind spot” for defenders.
- Disabling the EventLog Service: Using commands like
sc config eventlog start=disabledorSet-Service -Name EventLog -Status Stoppedto prevent the service from starting, often requiring a reboot to take effect. - Modifying Audit Policies: Using
auditpol.exeto disable auditing for specific categories (e.g.,auditpol /set /category:"Account Logon" /success:disable) or clearing the policy entirely withauditpol /clear /y. - Registry Tampering for Autologger: Modifying
Startvalues underHKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\(e.g., forEventLog-Security) to disable logging at a lower level, sometimes possible without full administrator rights depending on the key’s permissions.
đźš« ETW Bypassing and Patching
Event Tracing for Windows (ETW) is a broader tracing framework that feeds many security tools. Attackers can tamper with ETW providers or the EventLog service itself to suppress telemetry generation at its source.
- Patching the Logging Function: Injecting code to patch the
EtwEventWritefunction in memory, preventing the process from emitting events without touching the EventLog service or logs on disk. - ETW Provider Manipulation: Using PowerShell’s
Set-EtwTraceProvideror direct registry edits to modify provider properties, effectively disabling specific logging triggers. - Service Thread Suspension: Suspending the threads of the
svchost.exeprocess hosting the EventLog service to temporarily halt logging while performing other actions, then resuming it to avoid leaving obvious gaps.
🔍 Detection and Implications
These techniques leave their own artifacts. Defenders can look for Event ID 1102 (log cleared) or Event ID 104 (log file cleared), though sophisticated actors avoid these. Other indicators include Event ID 7040 (EventLog service start type changed) and suspicious command-line executions of wevtutil, auditpol, or PowerShell clearing cmdlets. The existence of tools specifically designed to surgically remove events (like EventCleaner) highlights that even “intact” logs should be treated with suspicion if other signs of compromise are present.
In summary, the methods available to a blackhat hacker range from simple log clearing to complex, low-level tampering with ETW and the EventLog service itself. Each technique carries different levels of stealth and leaves distinct forensic artifacts that defenders can hunt for.