Investigation · Log tampering
Were the logs cleared or tampered with?
Detect log clearing, selective deletion and audit or sensor tampering from the clearing events, service gaps, 4719 policy changes and Defender state.
When you would ask thisYou need to know whether the record you are relying on is complete, and whether the attacker disabled auditing or the endpoint sensors.
Steps
- 1
Check for a Security log clear
Event 1102, 'the audit log was cleared', is written to the Security log when it is cleared, and records SubjectUserName, SubjectDomainName and SubjectLogonId of whoever did it. Because clearing wipes the log, 1102 is normally the very first event in the new log, so its presence near the start of your timeline with earlier events missing is the signature of a clear. One 1102 is written per clear; join the SubjectLogonId to a 4624 to identify the session responsible.
Pull the clearing events from Security and SystemGet-WinEvent -FilterHashtable @{ LogName = 'Security'; Id = 1102 } Get-WinEvent -FilterHashtable @{ LogName = 'System'; Id = 104 } - 2
Check every other log for a clear
Security 1102 only covers the Security log. The Eventlog service writes System event 104, 'the event log file was cleared', for any other channel, naming the Channel that was cleared and the user. Pull 104 and list the channels: an attacker clearing the System, Application, PowerShell or TerminalServices logs shows up here. A 104 for a channel you expected to be rich, now nearly empty, tells you which part of your evidence was destroyed and when.
- 3
Find gaps from service stops and shutdowns
Clearing is not the only way to lose events. System 6005 marks the Event Log service starting and 6006 a clean stop; 6008 is a dirty, unexpected shutdown; 1074 records who initiated a shutdown or restart; and 7036 can show the Event Log service being stopped. A 6005 with no preceding 6006, or a long stretch of silence between a service stop and start, is a gap where events were simply never written. Line these up against the quiet periods in your timeline.
- 4
Look for audit-policy tampering
Disabling auditing is quieter than clearing. Event 4719, 'system audit policy was changed', records a subcategory being turned off and the account that changed it; a 4719 that disables Logon, Process Creation or Object Access right before the quiet period explains missing events without any clear. Events 4904 and 4905 record registering and unregistering a security event source, and 4907 a change to an object's SACL. A burst of these around the incident window is defensive evasion.
- 5
Check the endpoint sensors
Attackers blind Sysmon and Defender before acting. Sysmon event 4 records the service state changing (a stop), 16 a configuration change (rules swapped for a permissive set) and 255 internal errors; gaps in the Sysmon EventRecordID sequence also signal interference. Defender event 5001 marks real-time protection being disabled and 5007 a configuration change such as a new exclusion path; 1116 and 1117 are detections, so detections that suddenly stop after a 5001 mean the sensor was turned off, not that the threat ended.
Where it goes wrong
- 1102 is written only for the Security log; a cleared System or PowerShell log produces System 104 instead, so searching only for 1102 misses most clearing.
- A full clear leaves 1102 (or 104) as the first record in the new log, but selective deletion of individual records leaves no clearing event at all; look for gaps in the EventRecordID sequence and unexplained time jumps.
- Disabling a subcategory with auditpol leaves a 4719 but no further events, so the evidence of tampering is the policy change plus the subsequent silence, not a missing-log error.
- An attacker can stop the Event Log or Sysmon service, act, then restart it; the events created in between are permanently lost and only the service stop/start bracket remains.
- Event timestamps are UTC in the raw log; a tool showing local time can make a gap look larger or smaller than it is, so compare in UTC.
- Clearing tools like wevtutil cl do not always leave per-record artifacts, so the .evtx file's size and modification time on disk may be your best corroboration of when it happened.
Beyond event logs
Event log files on disk
C:\Windows\System32\winevt\Logs\*.evtx
Compare each file's size and last-modified time against its event count. A large modification-time jump, or a file far smaller than peers, flags a clear or truncation. Carving the file can recover records from a selectively deleted or reset log.
USN journal and $LogFile
The volume's $Extend\$UsnJrnl:$J and $LogFile (NTFS metadata)
File-system journals can show the .evtx files being written, truncated or replaced, giving an independent timestamp for tampering that does not depend on the logs themselves.
Audit policy configuration
auditpol /get /category:* output and HKLM\SECURITY\Policy (registry)
The current effective audit policy tells you what is being recorded now; compare it against the organization's baseline to spot subcategories that were quietly switched off.