Event ID 4657: registry value modified
What Event ID 4657 (registry value modified) means, the fields to check, what is normal and what is suspicious, with PowerShell and KQL queries to find it.
Event ID 4657 records a change to a registry value, but only for keys with registry auditing (a SACL) configured. Put that auditing on the handful of keys attackers love, such as Run keys, Image File Execution Options and Defender settings, and 4657 shows persistence and tampering the moment it happens, with old and new values.
The fields that matter
| Field | What it tells you |
|---|---|
| Subject > Account Name | Who changed it. |
| Object Name | The key, for example \REGISTRY\MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run. |
| Object Value Name | The value that changed. |
| Operation Type | New value created, existing value modified, or deleted. |
| Old Value / New Value | Before and after. The new value of a Run key is the program that will start. |
| Process Name | What made the change. |
What is normal
Software installers adding their own Run entries, Group Policy writing policy keys.
When Event ID 4657 is suspicious
- New Run or RunOnce values pointing into
AppData,Temp,ProgramDataorUsers\Public. - Values added under Image File Execution Options (debugger hijacking) or Winlogon.
- Changes to Defender exclusion or LSA keys by anything other than your management tools.
Common false positive: Updaters for browsers and collaboration apps rewrite their Run entries often. Learn their paths.
Find Event ID 4657 with PowerShell
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4657; StartTime=(Get-Date).AddDays(-7)} -MaxEvents 50 |
ForEach-Object {
$d = [ordered]@{ Time = $_.TimeCreated; Computer = $_.MachineName }
([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }
[pscustomobject]$d
} | Format-List
Microsoft Sentinel (KQL)
SecurityEvent
| where TimeGenerated > ago(7d) and EventID == 4657
| project TimeGenerated, Computer, Account, Activity, EventData
| order by TimeGenerated desc
Related events
- Sysmon Event ID 13: registry value set
- Event ID 4663: Attempt to access an object
- Event ID 4670: Permissions on an object changed
- Event ID 4697: Service installed
FAQ
Is Sysmon event 13 better than 4657?
Sysmon 13 needs no SACLs and covers any key in its configuration, so it is easier to deploy widely. 4657 is built in and works where Sysmon isn't installed.
Windows Event Triage reads a CSV, EVTX-to-JSON or XML export in your browser and flags brute force, new admins, suspicious services and log clearing.
IOC Triage, our free browser extension: right-click it for a verdict from 15 threat-intel sources, then copy a ready ticket note.