Windows Event ID 5038: Code integrity determined image hash is not valid
- Applicable version
- Windows Server 2008 R2 and later
- Last reviewed
- 2026-07-21
Quick summary
Windows Security Event ID 5038 records Code Integrity rejecting a file because its image hash is not valid.
Technical Metadata
| Event ID | 5038 |
|---|---|
| Provider | Microsoft-Windows-Security-Auditing |
| Channel | Security |
| Level | Information |
| Audit keyword | Audit Failure |
| MITRE ATT&CK | TA0005 Defense Evasion / T1553.002 Subvert Trust Controls: Code Signing |
| Key fields to watch | File Name, Computer, Code Integrity context |
Trigger Scenarios
This event is generated by Code Integrity when a file signature is not valid, including unauthorized modification or disk/device error conditions.
Key Fields
File Name
The path of the file whose image hash was not valid. Microsoft documents the schema as File Name: %filepath\filename%.
Computer
Identifies the host where an unsigned, modified, or corrupt driver or system file attempted to load.
Code Integrity context
Microsoft notes Code Integrity validates driver or system file integrity each time loaded into memory, and x64 kernel-mode drivers must be digitally signed.
Threat Hunting Queries
SecurityEvent
| where EventID == 5038
| project TimeGenerated, Computer, Account, EventData
| order by TimeGenerated desc- Data source
- Microsoft Sentinel SecurityEvent table
- Assumptions
- The Windows Security Events connector populates SecurityEvent. Apply the event-specific field and correlation guidance on this page after retrieving the base events.
index=wineventlog source="WinEventLog:Security" EventCode=5038
| table _time, host, user, EventCode, Message- Data source
- Splunk Windows Security event data
- Assumptions
- Index, source, and field aliases vary by Splunk deployment and Windows add-on version. Map provider fields from the raw event before adding event-specific filtering or aggregation.
dataset = microsoft_windows_raw
| filter edr_event_id = 5038- Data source
- Cortex XDR microsoft_windows_raw
- Assumptions
- The Windows Security channel is ingested into Cortex XDR. Inspect raw provider fields because parsed names vary by collection path.
title: Windows Security Event ID 5038
status: experimental
logsource:
product: windows
service: security
detection:
selection:
EventID: 5038
condition: selection
falsepositives:
- Legitimate administrative or system activity
level: informational- Data source
- Sigma Windows Security log source
- Assumptions
- This rule retrieves the event and is not a standalone malicious-behavior detection. Add the field conditions and correlations documented on this page in the destination SIEM.
MITRE ATT&CK Mapping
- T1553.002Subvert Trust Controls: Code Signing
Detection Notes
T1553.002 Code Signing subversion is supported when FileName is under C:\Windows\System32\drivers\, C:\Windows\System32\, or a security-product directory and file telemetry shows unauthorized modification before threshold=1 Event 5038. Correlate the file hash and signer with Sysmon Event 6 or EDR data, 5035 driver failure, and vendor update timing; an invalid hash alone can be corruption.
Common False Positives
- Microsoft notes disk device error or file corruption can produce this event.
- Broken third-party driver updates can create repeated 5038 events until the vendor package is repaired.
Related Events
- 5035 - The Windows Firewall Driver failed to start
- 4688 - A new process has been created
- Event ID 7045Content pending
Sample Log
EventID: 5038
Computer: HOST01
File Name: C:\Windows\System32\drivers\bad.sysFrequently Asked Questions
What does Windows Event ID 5038 mean?
Event ID 5038 records that Code Integrity found an invalid hash for an image being validated and identifies the file.
Does Event ID 5038 always indicate malware?
No. File corruption, storage errors, incomplete updates, and third-party software defects can also invalidate a hash or signature.
How should 5038 be investigated?
Validate FileName, signer and catalog status, file hash, recent writes, update timing, and related driver or service failures before containment.
Sources
- 5038: Microsoft Windows security auditing event reference
Microsoft · vendor
- Subvert Trust Controls: Code Signing (T1553.002)
MITRE ATT&CK · attack
- XDR Collector datasets
Palo Alto Networks · vendor
- Sigma Rules Specification
SigmaHQ · detection rule