Windows Firewall Disabled via PowerShell
Identifies when the Windows Firewall is disabled using PowerShell cmdlets, which can help attackers evade network constraints, like internet and network lateral communication restrictions.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2021/10/15"
3integration = ["endpoint", "windows"]
4maturity = "production"
5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
6min_stack_version = "8.3.0"
7updated_date = "2023/06/22"
8
9[rule]
10author = ["Austin Songer"]
11description = """
12Identifies when the Windows Firewall is disabled using PowerShell cmdlets, which can help attackers evade network
13constraints, like internet and network lateral communication restrictions.
14"""
15false_positives = [
16 """
17 Windows Firewall can be disabled by a system administrator. Verify whether the user identity, user agent, and/or
18 hostname should be making changes in your environment. Windows Profile being disabled by unfamiliar users should be
19 investigated. If known behavior is causing false positives, it can be exempted from the rule.
20 """,
21]
22from = "now-9m"
23index = ["logs-endpoint.events.*", "winlogbeat-*", "logs-windows.*", "endgame-*"]
24language = "eql"
25license = "Elastic License v2"
26name = "Windows Firewall Disabled via PowerShell"
27note = """## Triage and analysis
28
29### Investigating Windows Firewall Disabled via PowerShell
30
31Windows Defender Firewall is a native component that provides host-based, two-way network traffic filtering for a device and blocks unauthorized network traffic flowing into or out of the local device.
32
33Attackers can disable the Windows firewall or its rules to enable lateral movement and command and control activity.
34
35This rule identifies patterns related to disabling the Windows firewall or its rules using the `Set-NetFirewallProfile` PowerShell cmdlet.
36
37#### Possible investigation steps
38
39- 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.
40- Identify the user account that performed the action and whether it should perform this kind of action.
41- Contact the account owner and confirm whether they are aware of this activity.
42- Investigate other alerts associated with the user/host during the past 48 hours.
43- Inspect the host for suspicious or abnormal behavior in the alert timeframe.
44
45### False positive analysis
46
47- This mechanism can be used legitimately. Check whether the user is an administrator and is legitimately performing troubleshooting.
48- In case of an allowed benign true positive (B-TP), assess adding rules to allow needed traffic and re-enable the firewall.
49
50### Response and remediation
51
52- Initiate the incident response process based on the outcome of the triage.
53- Isolate the involved hosts to prevent further post-compromise behavior.
54- Re-enable the firewall with its desired configurations.
55- 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.
56- Review the privileges assigned to the involved users to ensure that the least privilege principle is being followed.
57- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
58- 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).
59
60## Setup
61
62If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2, events will not define `event.ingested` and default fallback for EQL rules was not added until 8.2, so you will need to add a custom pipeline to populate `event.ingested` to @timestamp for this rule to work.
63"""
64references = [
65 "https://docs.microsoft.com/en-us/powershell/module/netsecurity/set-netfirewallprofile?view=windowsserver2019-ps",
66 "https://www.tutorialspoint.com/how-to-get-windows-firewall-profile-settings-using-powershell",
67 "http://powershellhelp.space/commands/set-netfirewallrule-psv5.php",
68 "http://woshub.com/manage-windows-firewall-powershell/",
69]
70risk_score = 47
71rule_id = "f63c8e3c-d396-404f-b2ea-0379d3942d73"
72severity = "medium"
73tags = [
74 "Domain: Endpoint",
75 "OS: Windows",
76 "Use Case: Threat Detection",
77 "Tactic: Defense Evasion",
78 "Resources: Investigation Guide",
79 "Data Source: Elastic Endgame",
80 "Data Source: Elastic Defend"
81]
82timestamp_override = "event.ingested"
83type = "eql"
84
85query = '''
86process where host.os.type == "windows" and event.action == "start" and
87 (process.name : ("powershell.exe", "pwsh.exe", "powershell_ise.exe") or process.pe.original_file_name == "PowerShell.EXE") and
88 process.args : "*Set-NetFirewallProfile*" and
89 (process.args : "*-Enabled*" and process.args : "*False*") and
90 (process.args : "*-All*" or process.args : ("*Public*", "*Domain*", "*Private*"))
91'''
92
93
94[[rule.threat]]
95framework = "MITRE ATT&CK"
96[[rule.threat.technique]]
97id = "T1562"
98name = "Impair Defenses"
99reference = "https://attack.mitre.org/techniques/T1562/"
100[[rule.threat.technique.subtechnique]]
101id = "T1562.004"
102name = "Disable or Modify System Firewall"
103reference = "https://attack.mitre.org/techniques/T1562/004/"
104
105
106
107[rule.threat.tactic]
108id = "TA0005"
109name = "Defense Evasion"
110reference = "https://attack.mitre.org/tactics/TA0005/"
Triage and analysis
Investigating Windows Firewall Disabled via PowerShell
Windows Defender Firewall is a native component that provides host-based, two-way network traffic filtering for a device and blocks unauthorized network traffic flowing into or out of the local device.
Attackers can disable the Windows firewall or its rules to enable lateral movement and command and control activity.
This rule identifies patterns related to disabling the Windows firewall or its rules using the Set-NetFirewallProfile
PowerShell cmdlet.
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.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Inspect the host for suspicious or abnormal behavior in the alert timeframe.
False positive analysis
- This mechanism can be used legitimately. Check whether the user is an administrator and is legitimately performing troubleshooting.
- In case of an allowed benign true positive (B-TP), assess adding rules to allow needed traffic and re-enable the firewall.
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.
- Re-enable the firewall with its desired configurations.
- 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.
- Review the privileges assigned to the involved users 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).
Setup
If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2, events will not define event.ingested
and default fallback for EQL rules was not added until 8.2, so you will need to add a custom pipeline to populate event.ingested
to @timestamp for this rule to work.
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
- Code Signing Policy Modification Through Registry