Disabling Windows Defender Security Settings via PowerShell
Identifies use of the Set-MpPreference PowerShell command to disable or weaken certain Windows Defender settings.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2021/07/07"
3integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel"]
4maturity = "production"
5updated_date = "2024/10/15"
6min_stack_version = "8.14.0"
7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
8
9[rule]
10author = ["Elastic"]
11description = "Identifies use of the Set-MpPreference PowerShell command to disable or weaken certain Windows Defender settings."
12false_positives = ["Planned Windows Defender configuration changes."]
13from = "now-9m"
14index = [
15 "winlogbeat-*",
16 "logs-endpoint.events.process-*",
17 "logs-windows.forwarded*",
18 "logs-windows.sysmon_operational-*",
19 "endgame-*",
20 "logs-system.security*",
21 "logs-m365_defender.event-*",
22 "logs-sentinel_one_cloud_funnel.*",
23]
24language = "eql"
25license = "Elastic License v2"
26name = "Disabling Windows Defender Security Settings via PowerShell"
27note = """## Triage and analysis
28
29### Investigating Disabling Windows Defender Security Settings via PowerShell
30
31Microsoft 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.
32
33This rule monitors the execution of commands that can tamper the Windows Defender antivirus features.
34
35#### Possible investigation steps
36
37- 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.
38- Validate the activity is not related to planned patches, updates, network administrator activity, or legitimate software installations.
39- Identify the user account that performed the action and whether it should perform this kind of action.
40- Contact the account owner and confirm whether they are aware of this activity.
41- Investigate other alerts associated with the user/host during the past 48 hours.
42- Examine the command line to determine which action was executed. Based on that, examine exceptions, antivirus state, sample submission, etc.
43
44### False positive analysis
45
46- 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.
47
48### Related rules
49
50- Windows Defender Disabled via Registry Modification - 2ffa1f1e-b6db-47fa-994b-1512743847eb
51- Microsoft Windows Defender Tampering - fe794edd-487f-4a90-b285-3ee54f2af2d3
52
53### Response and remediation
54
55- Initiate the incident response process based on the outcome of the triage.
56- Isolate the involved hosts to prevent further post-compromise behavior.
57- 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.
58- Based on the command line, take actions to restore the appropriate Windows Defender antivirus configurations.
59- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
60- Review the privileges assigned to the user to ensure that the least privilege principle is being followed.
61- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
62- 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).
63"""
64references = [
65 "https://docs.microsoft.com/en-us/powershell/module/defender/set-mppreference?view=windowsserver2019-ps",
66 "https://www.elastic.co/security-labs/operation-bleeding-bear",
67 "https://www.elastic.co/security-labs/invisible-miners-unveiling-ghostengine"
68]
69risk_score = 47
70rule_id = "c8cccb06-faf2-4cd5-886e-2c9636cfcb87"
71severity = "medium"
72tags = [
73 "Domain: Endpoint",
74 "OS: Windows",
75 "Use Case: Threat Detection",
76 "Tactic: Defense Evasion",
77 "Tactic: Execution",
78 "Resources: Investigation Guide",
79 "Data Source: Elastic Endgame",
80 "Data Source: Elastic Defend",
81 "Data Source: System",
82 "Data Source: Microsoft Defender for Endpoint",
83 "Data Source: Sysmon",
84 "Data Source: SentinelOne",
85]
86timestamp_override = "event.ingested"
87type = "eql"
88
89query = '''
90process where host.os.type == "windows" and event.type == "start" and
91 (
92 process.name : ("powershell.exe", "pwsh.exe", "powershell_ise.exe") or
93 ?process.pe.original_file_name in ("powershell.exe", "pwsh.dll", "powershell_ise.exe")
94 ) and
95 process.args : "Set-MpPreference" and process.args : ("-Disable*", "Disabled", "NeverSend", "-Exclusion*")
96'''
97
98
99[[rule.threat]]
100framework = "MITRE ATT&CK"
101[[rule.threat.technique]]
102id = "T1562"
103name = "Impair Defenses"
104reference = "https://attack.mitre.org/techniques/T1562/"
105[[rule.threat.technique.subtechnique]]
106id = "T1562.001"
107name = "Disable or Modify Tools"
108reference = "https://attack.mitre.org/techniques/T1562/001/"
109
110
111
112[rule.threat.tactic]
113id = "TA0005"
114name = "Defense Evasion"
115reference = "https://attack.mitre.org/tactics/TA0005/"
116[[rule.threat]]
117framework = "MITRE ATT&CK"
118[[rule.threat.technique]]
119id = "T1059"
120name = "Command and Scripting Interpreter"
121reference = "https://attack.mitre.org/techniques/T1059/"
122[[rule.threat.technique.subtechnique]]
123id = "T1059.001"
124name = "PowerShell"
125reference = "https://attack.mitre.org/techniques/T1059/001/"
126
127
128
129[rule.threat.tactic]
130id = "TA0002"
131name = "Execution"
132reference = "https://attack.mitre.org/tactics/TA0002/"
Triage and analysis
Investigating Disabling Windows Defender Security Settings via PowerShell
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 execution of commands that can tamper the Windows Defender antivirus 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 the command line to determine which action was executed. Based on that, examine exceptions, antivirus state, sample submission, etc.
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.
Related rules
- Windows Defender Disabled via Registry Modification - 2ffa1f1e-b6db-47fa-994b-1512743847eb
- Microsoft Windows Defender Tampering - fe794edd-487f-4a90-b285-3ee54f2af2d3
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.
- Based on the command line, 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
- Clearing Windows Console History
- Execution from Unusual Directory - Command Line
- Microsoft Build Engine Started by an Office Application
- Suspicious MS Office Child Process
- Windows Firewall Disabled via PowerShell