| Technique | Modify Registry (T1112) |
| Tactic | Defense Impairment |
| Platforms | Windows |
Overview
Modify Registry (T1112) describes adversary interactions with the Windows Registry to achieve defense evasion, persistence, or execution. Attackers use registry modifications to disable security tooling, store encoded payloads, enable dangerous features like plaintext credential caching or Office macros, and suppress user alerts during privilege escalation — all without writing obvious files to disk.
Because the Windows Registry underpins nearly every aspect of OS and application configuration, malicious changes can silently undermine your entire defensive posture before a single alert fires. Every security team operating Windows endpoints needs reliable detection here — a missed registry modification can mean disabled AV, WDigest credential harvesting, or a persistent backdoor that survives reboots.
Attacker Perspective
Attackers modify the registry to quietly reconfigure Windows in ways that make their presence harder to detect and easier to sustain.
- Credential harvesting via WDigest: Attackers use
reg add HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest /v UseLogonCredential /t REG_DWORD /d 1to force Windows to cache plaintext credentials in LSASS memory, then dump them with Mimikatz after the next logon. - Disabling Windows Defender: Malware such as LockBit and BlackCat use
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender" /v DisableAntiSpyware /t REG_DWORD /d 1or modifyHKLM\SOFTWARE\Microsoft\Windows Defender\Featuresto kill real-time protection without touching defender binaries. - Enabling Office macros silently: Campaigns like ZLoader and BabyShark modify
HKCU\SOFTWARE\Microsoft\Office\to value\ \Security\VBAWarnings 1or4, disabling macro security dialogs so malicious documents execute without user prompts. - Suppressing UAC prompts: Attackers set
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\ConsentPromptBehaviorAdminto0to allow privilege escalation silently, or setEnableLUAto0to disable UAC entirely.
Registry modification is attractive precisely because it is a native Windows mechanism — it generates less suspicion than dropping executables, is frequently excluded from baseline alerts, and a single key change can neutralize an entire defensive control.
Detection Strategy
Required Telemetry
- Sysmon Event ID 13 (Registry Value Set) and Event ID 12 (Registry Key Create/Delete): Deploy Sysmon with a configuration that captures
RegistryEventfor target paths. Without Sysmon, registry telemetry from Windows native logging is extremely limited. Install Sysmon and configureRegistryEventrules in your sysmon config XML targeting the key paths listed below. - Windows Security Event ID 4657 (Registry Value Modified): Enable via Group Policy — Computer Configuration → Windows Settings → Security Settings → Advanced Audit Policy → Object Access → Audit Registry. You must also set a SACL (System Access Control List) on specific registry keys you want audited. This is granular but requires key-level configuration — prioritize the high-value keys listed in Key Indicators.
- Windows Security Event ID 4656 (Registry Object Handle Requested) and 4663 (Registry Object Accessed): Same audit policy as 4657. Enable these for targeted key monitoring but expect high volume — filter aggressively by
ObjectName. - Process Creation Event ID 4688 (Windows Security Log) or Sysmon Event ID 1: Captures
reg.execommand-line arguments. Enable via GPO: Computer Configuration → Windows Settings → Security Settings → Advanced Audit Policy → Detailed Tracking → Audit Process Creation. Also enable command-line auditing:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit\ProcessCreationIncludeCmdLine_Enabled = 1. - PowerShell Script Block Logging (Event ID 4104): Enable via GPO: Computer Configuration → Administrative Templates → Windows Components → Windows PowerShell → Turn on Script Block Logging → Enabled. This captures PowerShell registry cmdlets like
Set-ItemProperty,New-ItemProperty, andNew-Itemin the registry provider. - PowerShell Module Logging (Event ID 4103): Enable via the same GPO path: Turn on Module Logging → Enabled, module names =
*. Captures pipeline execution details for registry-touching PowerShell. - Windows Event ID 7045 (New Service Installed) and 4720/4728 (Account/Group Changes): Supplement registry detections — attackers who modify registry persistence keys often also install services or create accounts in the same session.
Key Indicators
- WDigest credential caching enabled: Sysmon Event ID 13, field
TargetObjectcontainsSYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest\UseLogonCredential, fieldDetails=DWORD (0x00000001). Any write to this value with data1is suspicious outside of a known remediation workflow. - Windows Defender disabled via registry: Sysmon Event ID 13,
TargetObjectcontainsSOFTWARE\Policies\Microsoft\Windows Defender\DisableAntiSpywareorSOFTWARE\Microsoft\Windows Defender\Features\TamperProtection,Details=0x00000001(for DisableAntiSpyware) or0x00000000(for TamperProtection). - Office macro security weakened: Sysmon Event ID 13,
TargetObjectends with\Security\VBAWarningsandDetailsis1,2, or4; orTargetObjectends with\Security\AccessVBOMset to1. Cross-reference with Event ID 4104 for PowerShell-based writes. - UAC suppression: Sysmon Event ID 13,
TargetObjectcontainsSOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\ConsentPromptBehaviorAdminset to0, orEnableLUAset to0. - Event log service disabled via MiniNt key: Sysmon Event ID 12 (key create),
TargetObject=SYSTEM\CurrentControlSet\Control\MiniNt. This key’s mere existence disables Windows event logging — creation is always suspicious. - reg.exe spawned with suspicious arguments: Sysmon Event ID 1 or Security Event ID 4688,
Imageends with\reg.exe,CommandLinecontainsaddand any of:WDigest,Windows Defender,MiniNt,Winlogon,VBAWarnings,ConsentPromptBehavior. - Suspicious parent process for reg.exe: Sysmon Event ID 1,
Imageends with\reg.exe,ParentImageis one of:\cmd.exespawned by\mshta.exe,\wscript.exe,\cscript.exe,\powershell.exe,\rundll32.exe, or any Office application. Legitimate admin use of reg.exe typically hasexplorer.exeor a management tool as parent. - PowerShell registry modification commands: Event ID 4104,
ScriptBlockTextcontainsSet-ItemPropertyorNew-ItemPropertycombined with any of the key paths above. Also watch forItemPropertycalls onHKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders. - Null-character prepended registry key names (hidden keys): Sysmon Event ID 12,
TargetObjectcontains a null byte (\x00) at the start of the key name. This is an explicit evasion technique (POWELIKS-style) and has essentially no legitimate use.
Detection Logic
Rule 1: reg.exe Adding Values to High-Risk Registry Paths
IF (process.name = "reg.exe" OR process.original_filename = "reg.exe") AND process.command_line CONTAINS " add " AND process.command_line CONTAINS_ANY ["WDigest", "Windows Defender", "MiniNt", "Winlogon", "VBAWarnings", "AccessVBOM", "ConsentPromptBehavior", "EnableLUA", "OOBE", "DisableAntiSpyware"] THEN alert HIGH
This catches the most common attacker pattern of directly invoking reg.exe to modify defense-impacting keys. Expected volume is low — reg.exe with these specific paths has minimal legitimate use outside of scripted IT management workflows. Expect 0–3 alerts per week in a typical enterprise; anything higher warrants baseline review.
Rule 2: Direct Registry Write to Credential or Defense Impairment Keys
IF event.id IN [13] AND source = "Sysmon" AND registry.key_path CONTAINS_ANY ["WDigest\UseLogonCredential", "DisableAntiSpyware", "TamperProtection", "VBAWarnings", "AccessVBOM", "MiniNt", "ConsentPromptBehaviorAdmin", "EnableLUA"] AND registry.value IN ["0x1", "0x0", "1", "0", "4"] THEN alert HIGH
This detects the registry change regardless of what process made it — catching attackers who use custom malware, WMI, or COM objects to write registry values without spawning reg.exe. Volume depends heavily on your environment’s software baseline; expect legitimate matches from endpoint management tools like SCCM or Intune that should be excluded by process name.
Rule 3: reg.exe or PowerShell Spawned by Suspicious Parent
IF (process.name IN ["reg.exe", "powershell.exe", "pwsh.exe"]) AND process.command_line CONTAINS_ANY ["add ", "Set-ItemProperty", "New-ItemProperty", "New-Item"] AND process.parent_name IN ["mshta.exe", "wscript.exe", "cscript.exe", "rundll32.exe", "winword.exe", "excel.exe", "outlook.exe", "msiexec.exe"] THEN alert CRITICAL
This is a high-precision rule catching registry modification initiated from script interpreters or Office applications — a strong signal of malicious document execution or living-off-the-land tradecraft. Expected volume is very low; treat every alert as requiring immediate triage.
Rule 4: PowerShell Script Block Writing to Defense-Related Registry Keys
IF event.id = 4104 AND source = "PowerShell" AND script_block_text CONTAINS_ANY ["Set-ItemProperty", "New-ItemProperty", "New-Item"] AND script_block_text CONTAINS_ANY ["WDigest", "Windows Defender", "VBAWarnings", "MiniNt", "ConsentPromptBehavior", "Winlogon", "SecurityProviders"] THEN alert HIGH
Catches PowerShell-based registry modification that bypasses process-level detection of reg.exe. Script block logging must be enabled for this rule to function. Volume is typically low unless your environment uses legitimate PowerShell-based endpoint management, in which case script author and signing status should be used as exclusion criteria.
Tuning Guidance
- Endpoint management tools (SCCM, Intune, Tanium, BigFix): These tools legitimately modify registry keys during software deployment and policy enforcement. Exclude by
process.parent_name IN ["CcmExec.exe", "TaniumClient.exe", "BESClient.exe"]or by the specific service account used. Validate the specific keys being modified match expected deployment activity before adding broad exclusions. - Antivirus and EDR agents updating their own configuration: Security tools frequently write to
SOFTWARE\Microsoft\Windows Defenderand related paths during updates or policy changes. Exclude by the vendor process name (e.g.,process.name = "MsMpEng.exe"orSenseCnfg.exe") but never exclude writes that setDisableAntiSpyware = 1regardless of process — this is a known technique to abuse legitimate process paths. - Software installers modifying Office security settings: Some enterprise application deployments legitimately configure Office macro trust records (e.g., adding known internal documents to TrustRecords). Exclude by scoping
TargetObjectto theTrustRecordssubkey only and correlating with a known software deployment window. Never exclude writes toVBAWarningsorAccessVBOMfrom this logic — those are always high risk. - IT administrators running reg.exe interactively: Admins occasionally run reg.exe manually for troubleshooting. Reduce noise by filtering on
user IN [named_admin_accounts]only after confirming those accounts have documented need. Add a suppression window tied to change management ticket timestamps where possible, rather than a permanent exclusion. - Group Policy preference deployments: GPO can write registry values that match your detection patterns. Identify the specific GPO-generated values in your environment and exclude by
process.name = "svchost.exe"withprocess.parent_name = "services.exe"only for GPO-related registry paths — never as a blanket svchost exclusion.
Community Sigma Rules — The following rules from the SigmaHQ community repository implement detection for this technique. Use Uncoder.io or pySigma to convert them to your SIEM’s query language.
When the Alert Fires: Investigation Steps
- Verify the alert is real: Pull the raw Sysmon Event ID 13 or Security Event ID 4657 from your SIEM and confirm the
TargetObjectvalue,Details(new value written), timestamp, and hostname match the alert exactly. Do not proceed based on SIEM-transformed fields alone — verify against the original event XML if possible. - Identify the affected host and user: Record the
hostname,user, andprocess.idfrom the event, then check if the account is privileged (Domain Admin, local Administrator, service account with elevated rights) using your identity provider or Active Directory query — privileged account involvement automatically raises severity. - Pull the full command-line and parent process chain: Using Sysmon Event ID 1 or Security Event ID 4688, query the 5-minute window around the alert for all process creation events on that host, filtered by the
process.idand itsparent.process.id. Reconstruct the full chain (e.g.,winword.exe → cmd.exe → reg.exe) to determine the initial execution vector. - Check for network connections and files written to disk: Query Sysmon Event ID 3 (Network Connect) and Event ID 11 (File Create) within 10 minutes of the registry modification on the same host. Look for outbound connections to non-corporate IP ranges and for new executables, scripts, or DLLs dropped in temp directories (
%TEMP%,%APPDATA%,C:\Windows\Temp). - Assess the specific registry change for immediate risk: Determine exactly what the modification does — use your registry key reference (see Key Indicators) to assess whether it enables credential harvesting (WDigest), disables AV (Defender keys), enables code execution (VBAWarnings), or suppresses UAC. If WDigest was enabled, treat credential compromise as assumed and escalate immediately without waiting for further confirmation.
- Look for lateral movement from this host: Query Windows Security Event ID 4624 (successful logon) and 4648 (explicit credential logon) for logons originating from the affected hostname in the 2-hour window after the registry modification. Also check Sysmon network events for SMB connections (port 445) or WMI activity from this host to other internal systems.
- Search for additional persistence mechanisms: On the affected host, query Sysmon Event IDs 12/13 for all registry writes in the session window, Event ID 4698 (Scheduled Task Created), Event ID 7045 (New Service Installed), and Event ID 4720 (User Account Created). Cross-correlate with file creation events in autorun locations (
Startupfolders,System32) to build a complete picture of attacker persistence before initiating containment.
Response Playbook
Containment
- Isolate the host from the network immediately but keep it powered on: Use your EDR console (CrowdStrike Network Containment, Defender for Endpoint Isolate, Carbon Black Quarantine) to isolate the host at the network layer while preserving volatile memory. Do not shut it down — live memory may contain injected shellcode, decrypted payloads, or active attacker sessions needed for forensics.
- Disable the affected user account: In Active Directory, run
Disable-ADAccount -Identity [username]or use the AD Users and Computers console. If the account is a service account, coordinate with the application owner before disabling — identify a maintenance window or failover path if needed. - Revoke active sessions and tokens: Force a logoff of the account on all systems using
query session /server:[hostname]andlogoff [sessionid]. If the environment uses Azure AD or Entra ID, revoke all refresh tokens viaRevoke-AzureADUserAllRefreshTokenor the Entra ID portal to invalidate SSO sessions that may persist despite password resets. - Block identified C2 IPs and domains: Submit any external IPs or domains identified in Sysmon network events to your firewall team and DNS filtering solution (e.g., Cisco Umbrella, Zscaler, Palo Alto NGFW) for immediate block. Tag them in your threat intel platform for cross-environment hunting.
- Kill the malicious process if still running: Using your EDR, terminate the identified malicious process by PID. If the process has injected into a legitimate process (e.g., explorer.exe, svchost.exe), prioritize host isolation over process kill to avoid triggering cleanup routines.
Eradication
- Revert malicious registry modifications: Using Sysmon Event ID 13 history and your investigation notes, manually revert each changed key to its legitimate value (e.g., set
UseLogonCredentialback to0, re-enableTamperProtection, resetVBAWarningsto2). Document every change made and validate the new values against your baseline configuration. - Remove identified persistence mechanisms: Delete any scheduled tasks, registry Run key entries, or services created during the attacker session. Use
schtasks /delete /tn [taskname] /ffor scheduled tasks andsc delete [servicename]for services. Verify via Autoruns (Sysinternals) run against the offline or isolated system. - Find and delete dropped payloads: Search the host for files created in the attacker’s session window using your EDR’s file timeline or Sysmon Event ID 11 history. Hash any found files and submit to VirusTotal or your internal sandboxing platform before deletion. Retain copies in an isolated quarantine store for potential legal or forensic use.
- Reset credentials for all involved accounts: Reset passwords for the affected user account and any accounts whose credentials may have been exposed (particularly if WDigest was enabled — assume all credentials cached on that host since the key change are compromised). If the host was a domain controller or jump host, escalate to a full domain-level credential review.
- Audit lateral movement targets for backdoors: For every internal host the attacker connected to (identified in step 6), run the same registry audit, persistence check, and file timeline analysis. Do not assume lateral movement targets are clean simply because no alerts fired there — the attacker may have been quieter on subsequent hops.
Recovery
- Re-image rather than remediate if confidence is low: If you cannot account for every action the attacker took — particularly if they had SYSTEM privileges, modified the MiniNt key (disabling event logging), or had dwell time exceeding 24 hours before detection — re-image the host from a known-good image rather than attempting manual cleanup. A clean OS is always more trustworthy than a remediated one.
- Verify cleanliness before reconnecting: Before removing network isolation, run a full EDR scan, validate all autorun locations with Autoruns, and confirm the reverted registry values are stable. Have your EDR generate a clean health attestation if supported (e.g., Defender for Endpoint Device Health).
- Re-enable the user account only after confirming no persistence remains: Conduct a final review of all persistence mechanisms on the host and any lateral movement targets before re-enabling the account. Brief the user on phishing or social engineering risk if the initial vector was a malicious document.
- Monitor the host and user for 72 hours post-remediation: Create a temporary high-sensitivity watchlist in your SIEM scoped to the affected hostname and username, lowering alert thresholds for all T1112-related rules for 72 hours. Attackers frequently re-enter environments through secondary footholds or reused credentials after initial remediation.
- Document and improve: Write a full timeline of the incident (initial registry change → discovery → containment → eradication) and share it with the detection engineering team. Update your Sysmon configuration and SIEM rules with any new key paths or process patterns observed. Close the incident ticket with IOCs tagged in your threat intel platform and schedule a lessons-learned review within 5 business days.
Stay Ahead
Get daily threat intelligence and detection playbooks.
Free. No account. No email. Follow in Feedly, Inoreader, or any RSS reader.