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", "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 = ["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 = [
 24    "winlogbeat-*",
 25    "logs-endpoint.events.process-*",
 26    "logs-windows.forwarded*",
 27    "logs-windows.sysmon_operational-*",
 28    "endgame-*",
 29    "logs-system.security*",
 30    "logs-m365_defender.event-*",
 31    "logs-sentinel_one_cloud_funnel.*",
 32    "logs-crowdstrike.fdr*",
 33]
 34language = "eql"
 35license = "Elastic License v2"
 36name = "Windows Firewall Disabled via PowerShell"
 37note = """## Triage and analysis
 38
 39### Investigating Windows Firewall Disabled via PowerShell
 40
 41Windows 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.
 42
 43Attackers can disable the Windows firewall or its rules to enable lateral movement and command and control activity.
 44
 45This rule identifies patterns related to disabling the Windows firewall or its rules using the `Set-NetFirewallProfile` PowerShell cmdlet.
 46
 47#### Possible investigation steps
 48
 49- 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.
 50- Identify the user account that performed the action and whether it should perform this kind of action.
 51- Contact the account owner and confirm whether they are aware of this activity.
 52- Investigate other alerts associated with the user/host during the past 48 hours.
 53- Inspect the host for suspicious or abnormal behavior in the alert timeframe.
 54
 55### False positive analysis
 56
 57- This mechanism can be used legitimately. Check whether the user is an administrator and is legitimately performing troubleshooting.
 58- In case of an allowed benign true positive (B-TP), assess adding rules to allow needed traffic and re-enable the firewall.
 59
 60### Response and remediation
 61
 62- Initiate the incident response process based on the outcome of the triage.
 63- Isolate the involved hosts to prevent further post-compromise behavior.
 64- Re-enable the firewall with its desired configurations.
 65- 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.
 66- Review the privileges assigned to the involved users to ensure that the least privilege principle is being followed.
 67- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 68- 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).
 69"""
 70references = [
 71    "https://docs.microsoft.com/en-us/powershell/module/netsecurity/set-netfirewallprofile?view=windowsserver2019-ps",
 72    "https://www.tutorialspoint.com/how-to-get-windows-firewall-profile-settings-using-powershell",
 73    "http://powershellhelp.space/commands/set-netfirewallrule-psv5.php",
 74    "http://woshub.com/manage-windows-firewall-powershell/",
 75]
 76risk_score = 47
 77rule_id = "f63c8e3c-d396-404f-b2ea-0379d3942d73"
 78severity = "medium"
 79tags = [
 80    "Domain: Endpoint",
 81    "OS: Windows",
 82    "Use Case: Threat Detection",
 83    "Tactic: Defense Evasion",
 84    "Tactic: Execution",
 85    "Resources: Investigation Guide",
 86    "Data Source: Elastic Endgame",
 87    "Data Source: Elastic Defend",
 88    "Data Source: System",
 89    "Data Source: Microsoft Defender for Endpoint",
 90    "Data Source: Sysmon",
 91    "Data Source: SentinelOne",
 92    "Data Source: Crowdstrike",
 93]
 94timestamp_override = "event.ingested"
 95type = "eql"
 96
 97query = '''
 98process where host.os.type == "windows" and event.type == "start" and
 99  (
100    process.name : ("powershell.exe", "pwsh.exe", "powershell_ise.exe") or
101    ?process.pe.original_file_name in ("powershell.exe", "pwsh.dll", "powershell_ise.exe")
102  ) and
103  process.args : "*Set-NetFirewallProfile*" and
104  process.args : "*-Enabled*" and process.args : "*False*" and
105  process.args : ("*-All*", "*Public*", "*Domain*", "*Private*")
106'''
107
108
109[[rule.threat]]
110framework = "MITRE ATT&CK"
111[[rule.threat.technique]]
112id = "T1562"
113name = "Impair Defenses"
114reference = "https://attack.mitre.org/techniques/T1562/"
115[[rule.threat.technique.subtechnique]]
116id = "T1562.004"
117name = "Disable or Modify System Firewall"
118reference = "https://attack.mitre.org/techniques/T1562/004/"
119
120
121
122[rule.threat.tactic]
123id = "TA0005"
124name = "Defense Evasion"
125reference = "https://attack.mitre.org/tactics/TA0005/"
126[[rule.threat]]
127framework = "MITRE ATT&CK"
128[[rule.threat.technique]]
129id = "T1059"
130name = "Command and Scripting Interpreter"
131reference = "https://attack.mitre.org/techniques/T1059/"
132[[rule.threat.technique.subtechnique]]
133id = "T1059.001"
134name = "PowerShell"
135reference = "https://attack.mitre.org/techniques/T1059/001/"
136
137
138
139[rule.threat.tactic]
140id = "TA0002"
141name = "Execution"
142reference = "https://attack.mitre.org/tactics/TA0002/"

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

References

Related rules

to-top