Code Integrity (CI) detected a file with an invalid or non-matching hash. FileName is key.
Rootkit or malware tampering with signed system files. Invalid hash of a Windows system file indicates either corruption or replacement with a malicious version (T1014). Also triggered by some legitimate unsigned software.
Alert: invalid hash on Windows system files (System32, SysWOW64). Investigate FileName — system files should always have valid hashes.
SubjectUserNameTargetUserNameLogonTypeIpAddressWorkstationName | Tactic | Technique |
|---|---|
| Defense Evasion | Rootkit (T1014) |
Starting points — adapt the log source, projected fields and thresholds for your environment.
SecurityEvent
| where EventID == 5038 // Code integrity determined that the image hash of a file is not valid
| project TimeGenerated, Computer, SubjectUserName, TargetUserName, LogonType, IpAddress, WorkstationName
| sort by TimeGenerated desc
index=* sourcetype="WinEventLog:Security" EventCode=5038
| stats count earliest(_time) as first_seen latest(_time) as last_seen by ComputerName
| sort - count `# Code integrity determined that the image hash of a file is not valid — add EventData fields: SubjectUserName, TargetUserName, LogonType, IpAddress`
Code integrity determined that the image hash of a file is not valid. Code Integrity (CI) detected a file with an invalid or non-matching hash. FileName is key.
Event 5038 is written to the Security channel by Microsoft-Windows-Security-Auditing. Advanced Audit Policy — enable the 'System Integrity' subcategory (Success and/or Failure).
Event 5038 is associated with: Rootkit (T1014).
Alert: invalid hash on Windows system files (System32, SysWOW64). Investigate FileName — system files should always have valid hashes.