Windows Defender Exclusions Added via PowerShell
Identifies modifications to the Windows Defender configuration settings using PowerShell to add exclusions at the folder directory or process level.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2021/07/20"
3integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
4maturity = "production"
5updated_date = "2026/05/04"
6
7[rule]
8author = ["Elastic"]
9description = """
10Identifies modifications to the Windows Defender configuration settings using PowerShell to add exclusions at the folder
11directory or process level.
12"""
13from = "now-9m"
14index = [
15 "endgame-*",
16 "logs-crowdstrike.fdr*",
17 "logs-endpoint.events.process-*",
18 "logs-m365_defender.event-*",
19 "logs-sentinel_one_cloud_funnel.*",
20 "logs-system.security*",
21 "logs-windows.forwarded*",
22 "logs-windows.sysmon_operational-*",
23 "winlogbeat-*",
24]
25language = "eql"
26license = "Elastic License v2"
27name = "Windows Defender Exclusions Added via PowerShell"
28note = """## Triage and analysis
29
30### Investigating Windows Defender Exclusions Added via PowerShell
31
32Microsoft Windows Defender is an antivirus product built into Microsoft Windows. Since this software product is used to prevent and stop malware, it's important to monitor what specific exclusions are made to the product's configuration settings. These can often be signs of an adversary or malware trying to bypass Windows Defender's capabilities. One of the more notable [examples](https://www.cyberbit.com/blog/endpoint-security/latest-trickbot-variant-has-new-tricks-up-its-sleeve/) was observed in 2018 where Trickbot incorporated mechanisms to disable Windows Defender to avoid detection.
33
34#### Possible investigation steps
35
36- 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.
37- Identify the user account that performed the action and whether it should perform this kind of action.
38- Contact the account owner and confirm whether they are aware of this activity.
39- Examine the exclusion in order to determine the intent behind it.
40- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
41- If the exclusion specifies a suspicious file or path, retrieve the file(s) and determine if malicious:
42 - Use a private sandboxed malware analysis system to perform analysis.
43 - Observe and collect information about the following activities:
44 - Attempts to contact external domains and addresses.
45 - File and registry access, modification, and creation activities.
46 - Service creation and launch activities.
47 - Scheduled task creation.
48 - Use the PowerShell Get-FileHash cmdlet to get the files' SHA-256 hash values.
49 - Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
50
51### False positive analysis
52
53- This rule has a high chance to produce false positives due to how often network administrators legitimately configure exclusions. In order to validate the activity further, review the specific exclusion and its intent. There are many legitimate reasons for exclusions, so it's important to gain context.
54
55### Related rules
56
57- Windows Defender Disabled via Registry Modification - 2ffa1f1e-b6db-47fa-994b-1512743847eb
58- Disabling Windows Defender Security Settings via PowerShell - c8cccb06-faf2-4cd5-886e-2c9636cfcb87
59
60### Response and remediation
61
62- Initiate the incident response process based on the outcome of the triage.
63- Isolate the involved host to prevent further post-compromise behavior.
64- If the triage identified malware, search the environment for additional compromised hosts.
65 - Implement temporary network rules, procedures, and segmentation to contain the malware.
66 - Stop suspicious processes.
67 - Immediately block the identified indicators of compromise (IoCs).
68 - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
69- Remove and block malicious artifacts identified during triage.
70- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
71- Exclusion lists for antimalware capabilities should always be routinely monitored for review.
72- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
73- 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).
74"""
75
76setup = """## Setup
77
78This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
79
80Setup instructions: https://ela.st/install-elastic-defend
81
82### Additional data sources
83
84This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
85
86- [CrowdStrike](https://ela.st/crowdstrike-integration)
87- [Microsoft Defender XDR](https://ela.st/m365-defender)
88- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
89- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
90- [Windows Process Creation Logs](https://ela.st/audit-process-creation)
91"""
92
93references = [
94 "https://www.bitdefender.com/files/News/CaseStudies/study/400/Bitdefender-PR-Whitepaper-MosaicLoader-creat5540-en-EN.pdf",
95 "https://www.elastic.co/security-labs/elastic-security-uncovers-blister-malware-campaign",
96 "https://www.elastic.co/security-labs/operation-bleeding-bear",
97 "https://www.elastic.co/security-labs/invisible-miners-unveiling-ghostengine",
98]
99risk_score = 47
100rule_id = "2c17e5d7-08b9-43b2-b58a-0270d65ac85b"
101severity = "medium"
102tags = [
103 "Domain: Endpoint",
104 "OS: Windows",
105 "Use Case: Threat Detection",
106 "Tactic: Defense Evasion",
107 "Resources: Investigation Guide",
108 "Data Source: Elastic Endgame",
109 "Data Source: Elastic Defend",
110 "Data Source: Windows Security Event Logs",
111 "Data Source: Microsoft Defender XDR",
112 "Data Source: Sysmon",
113 "Data Source: SentinelOne",
114 "Data Source: Crowdstrike",
115]
116timestamp_override = "event.ingested"
117type = "eql"
118
119query = '''
120process where host.os.type == "windows" and event.type == "start" and
121 (process.name : ("powershell.exe", "pwsh.exe", "powershell_ise.exe") or ?process.pe.original_file_name in ("PowerShell.EXE", "pwsh.dll", "powershell_ise.EXE")) and
122 process.args : ("*Add-MpPreference*", "*Set-MpPreference*") and
123 process.args : ("*-Exclusion*")
124'''
125
126
127[[rule.threat]]
128framework = "MITRE ATT&CK"
129[[rule.threat.technique]]
130id = "T1562"
131name = "Impair Defenses"
132reference = "https://attack.mitre.org/techniques/T1562/"
133[[rule.threat.technique.subtechnique]]
134id = "T1562.001"
135name = "Disable or Modify Tools"
136reference = "https://attack.mitre.org/techniques/T1562/001/"
137
138[[rule.threat.technique.subtechnique]]
139id = "T1562.006"
140name = "Indicator Blocking"
141reference = "https://attack.mitre.org/techniques/T1562/006/"
142
143
144
145[rule.threat.tactic]
146id = "TA0005"
147name = "Defense Evasion"
148reference = "https://attack.mitre.org/tactics/TA0005/"
149[[rule.threat]]
150framework = "MITRE ATT&CK"
151[[rule.threat.technique]]
152id = "T1059"
153name = "Command and Scripting Interpreter"
154reference = "https://attack.mitre.org/techniques/T1059/"
155[[rule.threat.technique.subtechnique]]
156id = "T1059.001"
157name = "PowerShell"
158reference = "https://attack.mitre.org/techniques/T1059/001/"
159
160
161
162[rule.threat.tactic]
163id = "TA0002"
164name = "Execution"
165reference = "https://attack.mitre.org/tactics/TA0002/"
Triage and analysis
Investigating Windows Defender Exclusions Added via PowerShell
Microsoft Windows Defender is an antivirus product built into Microsoft Windows. Since this software product is used to prevent and stop malware, it's important to monitor what specific exclusions are made to the product's configuration settings. These can often be signs of an adversary or malware trying to bypass Windows Defender's capabilities. One of the more notable examples was observed in 2018 where Trickbot incorporated mechanisms to disable Windows Defender to avoid detection.
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.
- 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.
- Examine the exclusion in order to determine the intent behind it.
- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
- If the exclusion specifies a suspicious file or path, retrieve the file(s) and determine if malicious:
- Use a private sandboxed malware analysis system to perform analysis.
- Observe and collect information about the following activities:
- Attempts to contact external domains and addresses.
- File and registry access, modification, and creation activities.
- Service creation and launch activities.
- Scheduled task creation.
- Observe and collect information about the following activities:
- Use the PowerShell Get-FileHash cmdlet to get the files' SHA-256 hash values.
- Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
- Use a private sandboxed malware analysis system to perform analysis.
False positive analysis
- This rule has a high chance to produce false positives due to how often network administrators legitimately configure exclusions. In order to validate the activity further, review the specific exclusion and its intent. There are many legitimate reasons for exclusions, so it's important to gain context.
Related rules
- 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 host to prevent further post-compromise behavior.
- If the triage identified malware, search the environment for additional compromised hosts.
- Implement temporary network rules, procedures, and segmentation to contain the malware.
- Stop suspicious processes.
- Immediately block the identified indicators of compromise (IoCs).
- Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Remove and block malicious artifacts identified during triage.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Exclusion lists for antimalware capabilities should always be routinely monitored for review.
- 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
- Adding Hidden File Attribute via Attrib
- Clearing Windows Console History
- Clearing Windows Event Logs
- Code Signing Policy Modification Through Built-in tools
- Command Execution via ForFiles