Disable Windows Firewall Rules via Netshedit

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.

Rule type: eql

Rule indices:

  • winlogbeat-*
  • logs-endpoint.events.*
  • logs-windows.*

Severity: medium

Risk score: 47

Runs every: 5 minutes

Searches indices from: now-9m (Date Math format, see also Additional look-back time)

Maximum alerts per execution: 100

Tags:

  • Elastic
  • Host
  • Windows
  • Threat Detection
  • Defense Evasion

Version: 14 (version history)

Added (Elastic Stack release): 7.6.0

Last modified (Elastic Stack release): 8.4.0

Rule authors: Elastic

Rule license: Elastic License v2

Investigation guideedit

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

Rule queryedit

process where event.type in ("start", "process_started") and
process.name : "netsh.exe" and (process.args : "disable" and
process.args : "firewall" and process.args : "set") or (process.args
: "advfirewall" and process.args : "off" and process.args : "state")

Threat mappingedit

Framework: MITRE ATT&CKTM

Rule version historyedit

Version 14 (8.4.0 release)
  • Formatting only
Version 12 (8.3.0 release)
  • Formatting only
Version 11 (8.2.0 release)
  • Formatting only
Version 10 (7.16.0 release)
  • Formatting only
Version 9 (7.13.0 release)
  • Updated query, changed from:

    event.category:process and event.type:(start or process_started) and
    process.name:netsh.exe and process.args:(disable and firewall and set)
    or process.args:(advfirewall and off and state)
Version 8 (7.12.0 release)
  • Formatting only
Version 7 (7.11.2 release)
  • Formatting only
Version 6 (7.11.0 release)
  • Formatting only
Version 5 (7.10.0 release)
  • Formatting only
Version 4 (7.9.1 release)
  • Formatting only
Version 3 (7.9.0 release)
  • Updated query, changed from:

    event.action:"Process Create (rule: ProcessCreate)" and
    process.name:netsh.exe and process.args:(disable and firewall and set)
    or process.args:(advfirewall and off and state)
Version 2 (7.7.0 release)
  • Updated query, changed from:

    event.action:"Process Create (rule: ProcessCreate)" and
    process.name:"netsh.exe" and process.args:("firewall" and "set" and
    "disable") or process.args:("advfirewall" and "state" and "off")