Event ID 4657: A registry value was modified
Event 4657 is generated when a registry value is modified, created, or deleted, providing critical visibility into registry changes often used for persistence, privilege escalation, and configuration tampering. This event is essential for detecting malware establishing autorun persistence, attackers disabling security controls, and unauthorized system configuration modifications.
- Channel
- Security
- Logged by default
- No
- Written on
- Any host
- Volume
- Moderate
- Audit subcategory
- Registry
- Needs a SACL
- Yes
To have this event
- Enable Registry:
auditpol /set /subcategory:"Registry" /success:enable /failure:enable - A SACL on the registry key.
Key fields
Exact XML field names, as they appear in <Data Name="…"> and in SIEM field extractions.
| Field | What it tells you |
|---|---|
| SubjectUserName | Account that modified the registry |
| SubjectDomainName | Domain of the account |
| SubjectLogonId | Logon ID for correlation |
| ObjectName | Full registry key path |
| ObjectValueName | Name of the modified registry value |
| OperationType | Type of operation (New value written, Existing value modified, Value deleted) |
| OldValueType | Previous value type (REG_SZ, REG_DWORD, etc.) |
| OldValue | Previous registry value data |
| NewValueType | New value type |
| NewValue | New registry value data |
| ProcessName | Process that modified the registry |
| ProcessId | Process ID |
In an investigation
Event 4657 provides detailed visibility into Windows registry modifications, which is critical for detecting various attack techniques. The Windows registry stores system configuration, application settings, and security policies, making it a primary target for attackers establishing persistence and evading defenses. Common malicious registry modifications include adding entries to Run/RunOnce keys for startup persistence, modifying Windows Defender settings to disable real-time protection, changing UAC settings to weaken privilege controls, and altering network configuration for command and control communication. This event captures the registry path modified, the value name, the old and new data, and the process that performed the modification. Security teams should focus monitoring on high-value registry keys related to startup, security software, and privilege controls.
What it can reveal
- Persistence establishment through modifications to HKLM\Software\Microsoft\Windows\CurrentVersion\Run and similar autorun keys
- Security control tampering by disabling Windows Defender, UAC, or firewall through registry value changes
- Privilege escalation through modification of service configurations or elevation policies in registry
- Credential access by modifying WDigest UseLogonCredential setting to enable plaintext password storage in memory
- Nearly all malware families modify registry for persistence - Emotet, TrickBot, Qakbot all use Run key modifications
How to detect with it
Enable Event 4657 auditing on critical registry paths including all Run/RunOnce keys, Windows Defender configuration keys, service definitions, and UAC settings. Alert on any modifications to autorun registry keys from non-installer processes. Monitor changes to Windows Defender registry values, particularly DisableRealtimeMonitoring and DisableAntiSpyware. Track WDigest UseLogonCredential modifications which enable credential theft. Correlate Event 4657 with Event 4688 to identify which processes are modifying registry values - legitimate system installers vs suspicious user-mode processes. Alert on registry modifications during off-hours or from unusual user accounts. Monitor service-related registry changes under HKLM\SYSTEM\CurrentControlSet\Services for malicious service creation.
Attack patterns
- Run-key persistence attack pattern: malware adds a value with a benign-sounding name under HKCU\Software\Microsoft\Windows\CurrentVersion\Run (or the HKLM equivalent) pointing to an executable in AppData; 4657 records it when the key has an auditing SACL
- WDigest downgrade attack pattern: attackers set HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest\UseLogonCredential to 1 so LSASS keeps plaintext passwords for users who log on afterwards, then dump them from memory
- Ransomware defense evasion: Before encryption, ransomware modified HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection\DisableRealtimeMonitoring to 1 to disable real-time protection
- APT privilege escalation: Attackers modified UAC registry key HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA to '0' to disable User Account Control prompts
Compared withEvent 4657 specifically tracks registry value modifications, while Event 7045 (Service Control Manager Event) monitors service installation. Event 4663 provides broader object access auditing. Monitor registry-specific Event 4657 for detailed registry change visibility.
Pull this event
Retrieval queries for a live host, a collected .evtx file and common SIEMs. Filter further on the key fields above.
Get-WinEvent -LogName 'Security' -FilterXPath "*[System[(EventID=4657)]]" -MaxEvents 50 |
Select-Object TimeCreated, Id, MachineName, Message-FilterXPath supports exact matches only. For substring matching, filter in Where-Object.
Where it shows up
Investigations, attack signals and lateral movement techniques that rely on this event.
ATT&CK mapping
Techniques this event can help detect. Most of these depend on specific field values; the event alone does not mean the technique happened.
Also relevant, depending on field values
- T1546.003 Windows Management Instrumentation Event Subscription
- T1546.012 Image File Execution Options Injection
- T1546.010 AppInit DLLs
- T1546.009 AppCert DLLs
- T1547.004 Winlogon Helper DLL
- T1547.005 Security Support Provider
- T1547.010 Port Monitors
- T1547.012 Print Processors
- T1574.011 Services Registry Permissions Weakness
- T1574.012 COR_PROFILER
- T1562.001 Disable or Modify Tools
- T1562.002 Disable Windows Event Logging
- T1562.006 Indicator Blocking
- T1546.015 Component Object Model Hijacking
- T1553.003 SIP and Trust Provider Hijacking
Related events
Common questions
- What does Windows event ID 4657 mean?
- Event 4657 is generated when a registry value is modified, created, or deleted, providing critical visibility into registry changes often used for persistence, privilege escalation, and configuration tampering. This event is essential for detecting malware establishing autorun persistence, attackers disabling security controls, and unauthorized system configuration modifications.
- Is event 4657 logged by default?
- No. It must be enabled before it is recorded. It is controlled by the "Registry" Advanced Audit Policy subcategory (Object Access). It also requires a SACL on the audited object.
- Where is event 4657 recorded?
- In the Security channel on the any host.
Decode a real event
Paste the XML and every value gets explained. Nothing leaves your browser.
Open decoderEvent 4657 is generated when a registry value is modified, created, or deleted, providing critical visibility into registry changes often used for persistence, privilege escalation, and configuration tampering.