Disable Windows Firewall Rules via Netsh

Identifies use of the netsh.exe to disable or weaken the local firewall. Attackers will use this command line tool to disable the firewall during troubleshooting or to enable network mobility.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2020/02/18"
 3integration = ["endpoint", "windows", "system"]
 4maturity = "production"
 5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
 6min_stack_version = "8.3.0"
 7updated_date = "2024/03/28"
 8
 9[rule]
10author = ["Elastic"]
11description = """
12Identifies use of the netsh.exe to disable or weaken the local firewall. Attackers will use this command line tool to
13disable the firewall during troubleshooting or to enable network mobility.
14"""
15from = "now-9m"
16index = ["winlogbeat-*", "logs-endpoint.events.process-*", "logs-windows.*", "endgame-*", "logs-system.security*"]
17language = "eql"
18license = "Elastic License v2"
19name = "Disable Windows Firewall Rules via Netsh"
20note = """## Triage and analysis
21
22### Investigating Disable Windows Firewall Rules via Netsh
23
24The Windows Defender Firewall is a native component which provides host-based, two-way network traffic filtering for a device, and blocks unauthorized network traffic flowing into or out of the local device.
25
26Attackers can disable the Windows firewall or its rules to enable lateral movement and command and control activity.
27
28This rule identifies patterns related to disabling the Windows firewall or its rules using the `netsh.exe` utility.
29
30#### Possible investigation steps
31
32- Identify the user account that performed the action and whether it should perform this kind of action.
33- Contact the user to check if they are aware of the operation.
34- 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.
35- Investigate other alerts associated with the user/host during the past 48 hours.
36
37### False positive analysis
38
39- This mechanism can be used legitimately. Check whether the user is an administrator and is legitimately performing troubleshooting.
40- In case of an allowed benign true positive (B-TP), assess adding rules to allow needed traffic and re-enable the firewall.
41
42### Response and remediation
43
44- Initiate the incident response process based on the outcome of the triage.
45- Isolate the involved hosts to prevent further post-compromise behavior.
46- Review the privileges assigned to the involved users to ensure that the least privilege principle is being followed.
47- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
48- 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).
49"""
50risk_score = 47
51rule_id = "4b438734-3793-4fda-bd42-ceeada0be8f9"
52setup = """## Setup
53
54If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
55events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
56Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
57`event.ingested` to @timestamp.
58For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
59"""
60severity = "medium"
61tags = [
62    "Domain: Endpoint",
63    "OS: Windows",
64    "Use Case: Threat Detection",
65    "Tactic: Defense Evasion",
66    "Resources: Investigation Guide",
67    "Data Source: Elastic Endgame",
68    "Data Source: Elastic Defend"
69]
70timestamp_override = "event.ingested"
71type = "eql"
72
73query = '''
74process where host.os.type == "windows" and event.type == "start" and
75  process.name : "netsh.exe" and
76  (
77    (process.args : "disable" and process.args : "firewall" and process.args : "set") or
78    (process.args : "advfirewall" and process.args : "off" and process.args : "state")
79  )
80'''
81
82
83[[rule.threat]]
84framework = "MITRE ATT&CK"
85[[rule.threat.technique]]
86id = "T1562"
87name = "Impair Defenses"
88reference = "https://attack.mitre.org/techniques/T1562/"
89[[rule.threat.technique.subtechnique]]
90id = "T1562.004"
91name = "Disable or Modify System Firewall"
92reference = "https://attack.mitre.org/techniques/T1562/004/"
93
94
95
96[rule.threat.tactic]
97id = "TA0005"
98name = "Defense Evasion"
99reference = "https://attack.mitre.org/tactics/TA0005/"

Triage and analysis

Investigating Disable Windows Firewall Rules via Netsh

The Windows Defender Firewall is a native component which 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 netsh.exe utility.

Possible investigation steps

  • Identify the user account that performed the action and whether it should perform this kind of action.
  • Contact the user to check if they are aware of the operation.
  • 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.
  • Investigate other alerts associated with the user/host during the past 48 hours.

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

Related rules

to-top