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 = "2024/11/02"
  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 = """
 12Identifies modifications to the Windows Defender configuration settings using PowerShell to add exclusions at the folder
 13directory or process level.
 14"""
 15from = "now-9m"
 16index = [
 17    "winlogbeat-*",
 18    "logs-endpoint.events.process-*",
 19    "logs-windows.forwarded*",
 20    "logs-windows.sysmon_operational-*",
 21    "endgame-*",
 22    "logs-system.security*",
 23    "logs-m365_defender.event-*",
 24    "logs-sentinel_one_cloud_funnel.*",
 25    "logs-crowdstrike.fdr*",
 26]
 27language = "eql"
 28license = "Elastic License v2"
 29name = "Windows Defender Exclusions Added via PowerShell"
 30note = """## Triage and analysis
 31
 32### Investigating Windows Defender Exclusions Added via PowerShell
 33
 34Microsoft 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.
 35
 36#### Possible investigation steps
 37
 38- 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.
 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- Examine the exclusion in order to determine the intent behind it.
 42- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
 43- If the exclusion specifies a suspicious file or path, retrieve the file(s) and determine if malicious:
 44  - Use a private sandboxed malware analysis system to perform analysis.
 45    - Observe and collect information about the following activities:
 46      - Attempts to contact external domains and addresses.
 47      - File and registry access, modification, and creation activities.
 48      - Service creation and launch activities.
 49      - Scheduled task creation.
 50  - Use the PowerShell Get-FileHash cmdlet to get the files' SHA-256 hash values.
 51    - Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
 52
 53### False positive analysis
 54
 55- 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.
 56
 57### Related rules
 58
 59- Windows Defender Disabled via Registry Modification - 2ffa1f1e-b6db-47fa-994b-1512743847eb
 60- Disabling Windows Defender Security Settings via PowerShell - c8cccb06-faf2-4cd5-886e-2c9636cfcb87
 61
 62### Response and remediation
 63
 64- Initiate the incident response process based on the outcome of the triage.
 65- Isolate the involved host to prevent further post-compromise behavior.
 66- If the triage identified malware, search the environment for additional compromised hosts.
 67  - Implement temporary network rules, procedures, and segmentation to contain the malware.
 68  - Stop suspicious processes.
 69  - Immediately block the identified indicators of compromise (IoCs).
 70  - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
 71- Remove and block malicious artifacts identified during triage.
 72- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 73- Exclusion lists for antimalware capabilities should always be routinely monitored for review.
 74- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 75- 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).
 76"""
 77references = [
 78    "https://www.bitdefender.com/files/News/CaseStudies/study/400/Bitdefender-PR-Whitepaper-MosaicLoader-creat5540-en-EN.pdf",
 79    "https://www.elastic.co/security-labs/elastic-security-uncovers-blister-malware-campaign",
 80    "https://www.elastic.co/security-labs/operation-bleeding-bear",
 81    "https://www.elastic.co/security-labs/invisible-miners-unveiling-ghostengine"
 82]
 83risk_score = 47
 84rule_id = "2c17e5d7-08b9-43b2-b58a-0270d65ac85b"
 85severity = "medium"
 86tags = [
 87    "Domain: Endpoint",
 88    "OS: Windows",
 89    "Use Case: Threat Detection",
 90    "Tactic: Defense Evasion",
 91    "Resources: Investigation Guide",
 92    "Data Source: Elastic Endgame",
 93    "Data Source: Elastic Defend",
 94    "Data Source: System",
 95    "Data Source: Microsoft Defender for Endpoint",
 96    "Data Source: Sysmon",
 97    "Data Source: SentinelOne",
 98    "Data Source: Crowdstrike",
 99]
100timestamp_override = "event.ingested"
101type = "eql"
102
103query = '''
104process where host.os.type == "windows" and event.type == "start" and
105 (process.name : ("powershell.exe", "pwsh.exe", "powershell_ise.exe") or ?process.pe.original_file_name in ("powershell.exe", "pwsh.dll", "powershell_ise.exe")) and
106  process.args : ("*Add-MpPreference*", "*Set-MpPreference*") and
107  process.args : ("*-Exclusion*")
108'''
109
110
111[[rule.threat]]
112framework = "MITRE ATT&CK"
113[[rule.threat.technique]]
114id = "T1562"
115name = "Impair Defenses"
116reference = "https://attack.mitre.org/techniques/T1562/"
117[[rule.threat.technique.subtechnique]]
118id = "T1562.001"
119name = "Disable or Modify Tools"
120reference = "https://attack.mitre.org/techniques/T1562/001/"
121
122[[rule.threat.technique.subtechnique]]
123id = "T1562.006"
124name = "Indicator Blocking"
125reference = "https://attack.mitre.org/techniques/T1562/006/"
126
127
128
129[rule.threat.tactic]
130id = "TA0005"
131name = "Defense Evasion"
132reference = "https://attack.mitre.org/tactics/TA0005/"
133[[rule.threat]]
134framework = "MITRE ATT&CK"
135[[rule.threat.technique]]
136id = "T1059"
137name = "Command and Scripting Interpreter"
138reference = "https://attack.mitre.org/techniques/T1059/"
139[[rule.threat.technique.subtechnique]]
140id = "T1059.001"
141name = "PowerShell"
142reference = "https://attack.mitre.org/techniques/T1059/001/"
143
144
145
146[rule.threat.tactic]
147id = "TA0002"
148name = "Execution"
149reference = "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.
    • 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.

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.
  • 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

to-top