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