Microsoft Windows Defender Tampering

Identifies when one or more features on Microsoft Defender are disabled. Adversaries may disable or tamper with Microsoft Defender features to evade detection and conceal malicious behavior.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2021/10/18"
  3integration = ["endpoint", "windows"]
  4maturity = "production"
  5updated_date = "2024/06/27"
  6
  7[rule]
  8author = ["Austin Songer"]
  9description = """
 10Identifies when one or more features on Microsoft Defender are disabled. Adversaries may disable or tamper with
 11Microsoft Defender features to evade detection and conceal malicious behavior.
 12"""
 13false_positives = ["Legitimate Windows Defender configuration changes"]
 14from = "now-9m"
 15index = ["winlogbeat-*", "logs-endpoint.events.registry-*", "logs-windows.sysmon_operational-*"]
 16language = "eql"
 17license = "Elastic License v2"
 18name = "Microsoft Windows Defender Tampering"
 19note = """## Triage and analysis
 20
 21### Investigating Microsoft Windows Defender Tampering
 22
 23Microsoft Windows Defender is an antivirus product built into Microsoft Windows, which makes it popular across multiple environments. Disabling it is a common step in threat actor playbooks.
 24
 25This rule monitors the registry for modifications that disable Windows Defender features.
 26
 27#### Possible investigation steps
 28
 29- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
 30- Validate the activity is not related to planned patches, updates, network administrator activity, or legitimate software installations.
 31- Identify the user account that performed the action and whether it should perform this kind of action.
 32- Contact the account owner and confirm whether they are aware of this activity.
 33- Investigate other alerts associated with the user/host during the past 48 hours.
 34- Examine which features have been disabled, and check if this operation is done under change management and approved according to the organization's policy.
 35
 36### False positive analysis
 37
 38- This mechanism can be used legitimately. Analysts can dismiss the alert if the administrator is aware of the activity, the configuration is justified (for example, it is being used to deploy other security solutions or troubleshooting), and no other suspicious activity has been observed.
 39
 40### Related rules
 41
 42- Windows Defender Disabled via Registry Modification - 2ffa1f1e-b6db-47fa-994b-1512743847eb
 43- Disabling Windows Defender Security Settings via PowerShell - c8cccb06-faf2-4cd5-886e-2c9636cfcb87
 44
 45### Response and remediation
 46
 47- Initiate the incident response process based on the outcome of the triage.
 48- Isolate the involved hosts to prevent further post-compromise behavior.
 49- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
 50- Take actions to restore the appropriate Windows Defender antivirus configurations.
 51- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 52- Review the privileges assigned to the user to ensure that the least privilege principle is being followed.
 53- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 54- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
 55"""
 56references = [
 57    "https://thedfirreport.com/2021/10/18/icedid-to-xinglocker-ransomware-in-24-hours/",
 58    "https://www.tenforums.com/tutorials/32236-enable-disable-microsoft-defender-pua-protection-windows-10-a.html",
 59    "https://www.tenforums.com/tutorials/104025-turn-off-core-isolation-memory-integrity-windows-10-a.html",
 60    "https://www.tenforums.com/tutorials/105533-enable-disable-windows-defender-exploit-protection-settings.html",
 61    "https://www.tenforums.com/tutorials/123792-turn-off-tamper-protection-microsoft-defender-antivirus.html",
 62    "https://www.tenforums.com/tutorials/51514-turn-off-microsoft-defender-periodic-scanning-windows-10-a.html",
 63    "https://www.tenforums.com/tutorials/3569-turn-off-real-time-protection-microsoft-defender-antivirus.html",
 64    "https://www.tenforums.com/tutorials/99576-how-schedule-scan-microsoft-defender-antivirus-windows-10-a.html",
 65]
 66risk_score = 47
 67rule_id = "fe794edd-487f-4a90-b285-3ee54f2af2d3"
 68setup = """## Setup
 69
 70If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
 71events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
 72Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
 73`event.ingested` to @timestamp.
 74For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
 75"""
 76severity = "medium"
 77tags = [
 78    "Domain: Endpoint",
 79    "OS: Windows",
 80    "Use Case: Threat Detection",
 81    "Tactic: Defense Evasion",
 82    "Resources: Investigation Guide",
 83    "Data Source: Elastic Defend",
 84    "Data Source: Sysmon",
 85]
 86timestamp_override = "event.ingested"
 87type = "eql"
 88
 89query = '''
 90registry where host.os.type == "windows" and event.type in ("creation", "change") and
 91 process.executable != null and 
 92  not process.executable :
 93              ("?:\\Windows\\system32\\svchost.exe", 
 94               "?:\\Windows\\CCM\\CcmExec.exe", 
 95               "?:\\Windows\\System32\\DeviceEnroller.exe", 
 96               "?:\\Program Files (x86)\\Trend Micro\\Security Agent\\tmuninst.exe") and 
 97  (registry.path : "HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\PUAProtection" and
 98  registry.data.strings : ("0", "0x00000000")) or
 99  (registry.path : "HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender Security Center\\App and Browser protection\\DisallowExploitProtectionOverride" and
100  registry.data.strings : ("0", "0x00000000")) or
101  (registry.path : "HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\DisableAntiSpyware" and
102  registry.data.strings : ("1", "0x00000001")) or
103  (registry.path : "HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Features\\TamperProtection" and
104  registry.data.strings : ("0", "0x00000000")) or
105  (registry.path : "HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\\DisableRealtimeMonitoring" and
106  registry.data.strings : ("1", "0x00000001")) or
107  (registry.path : "HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\\DisableIntrusionPreventionSystem" and
108  registry.data.strings : ("1", "0x00000001")) or
109  (registry.path : "HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\\DisableScriptScanning" and
110  registry.data.strings : ("1", "0x00000001")) or
111  (registry.path : "HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Windows Defender Exploit Guard\\Controlled Folder Access\\EnableControlledFolderAccess" and
112  registry.data.strings : ("0", "0x00000000")) or
113  (registry.path : "HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\\DisableIOAVProtection" and
114  registry.data.strings : ("1", "0x00000001")) or
115  (registry.path : "HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Reporting\\DisableEnhancedNotifications" and
116  registry.data.strings : ("1", "0x00000001")) or
117  (registry.path : "HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\SpyNet\\DisableBlockAtFirstSeen" and
118  registry.data.strings : ("1", "0x00000001")) or
119  (registry.path : "HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\SpyNet\\SpynetReporting" and
120  registry.data.strings : ("0", "0x00000000")) or
121  (registry.path : "HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\SpyNet\\SubmitSamplesConsent" and
122  registry.data.strings : ("0", "0x00000000")) or
123  (registry.path : "HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows Defender\\Real-Time Protection\\DisableBehaviorMonitoring" and
124  registry.data.strings : ("1", "0x00000001"))
125'''
126
127
128[[rule.threat]]
129framework = "MITRE ATT&CK"
130[[rule.threat.technique]]
131id = "T1112"
132name = "Modify Registry"
133reference = "https://attack.mitre.org/techniques/T1112/"
134
135[[rule.threat.technique]]
136id = "T1562"
137name = "Impair Defenses"
138reference = "https://attack.mitre.org/techniques/T1562/"
139
140
141[rule.threat.tactic]
142id = "TA0005"
143name = "Defense Evasion"
144reference = "https://attack.mitre.org/tactics/TA0005/"

Triage and analysis

Investigating Microsoft Windows Defender Tampering

Microsoft Windows Defender is an antivirus product built into Microsoft Windows, which makes it popular across multiple environments. Disabling it is a common step in threat actor playbooks.

This rule monitors the registry for modifications that disable Windows Defender features.

Possible investigation steps

  • Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
  • Validate the activity is not related to planned patches, updates, network administrator activity, or legitimate software installations.
  • Identify the user account that performed the action and whether it should perform this kind of action.
  • Contact the account owner and confirm whether they are aware of this activity.
  • Investigate other alerts associated with the user/host during the past 48 hours.
  • Examine which features have been disabled, and check if this operation is done under change management and approved according to the organization's policy.

False positive analysis

  • This mechanism can be used legitimately. Analysts can dismiss the alert if the administrator is aware of the activity, the configuration is justified (for example, it is being used to deploy other security solutions or troubleshooting), and no other suspicious activity has been observed.
  • Windows Defender Disabled via Registry Modification - 2ffa1f1e-b6db-47fa-994b-1512743847eb
  • Disabling Windows Defender Security Settings via PowerShell - c8cccb06-faf2-4cd5-886e-2c9636cfcb87

Response and remediation

  • Initiate the incident response process based on the outcome of the triage.
  • Isolate the involved hosts to prevent further post-compromise behavior.
  • Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
  • Take actions to restore the appropriate Windows Defender antivirus configurations.
  • Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
  • Review the privileges assigned to the user to ensure that the least privilege principle is being followed.
  • Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
  • Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).

References

Related rules

to-top