Detection rule
Firewall Disabled via Netsh.EXE
Overview
Detects netsh commands that turns off the Windows firewall
- Rule id
57c4bf16-227f-4394-8ec7-1b745ee061c3- ATT&CK techniques
- T1686.003 Disable or Modify System Firewall: Windows Host Firewall
- Severity
- Medium
- Confidence
- Low
- Origin
- SigmaHQ (community)
- SigmaHQ status
test- Used in defense packs
- qilin, safepay
Validation
- ExperimentalSyntax checked only. Not yet tested on events.
- Test-data validatedMatched positive test events and ignored near-miss events. Not yet run in a production SIEM.
- SIEM-validatedRun in a real SIEM, with a recorded result.
2 of 2 positive test events matched; 2 of 2 near-miss events were correctly ignored. Community rule reused unmodified from SigmaHQ. OffSet7 converted it and tested it on synthetic events.
Detection logic and queries
Queries are shown exactly as generated. Test them in your environment before you deploy them.
Sigma
Sigma (YAML) · 57c4bf16-227f-4394-8ec7-1b745ee061c3
title: Firewall Disabled via Netsh.EXE
id: 57c4bf16-227f-4394-8ec7-1b745ee061c3
status: test
description: Detects netsh commands that turns off the Windows firewall
references:
- https://www.winhelponline.com/blog/enable-and-disable-windows-firewall-quickly-using-command-line/
- https://app.any.run/tasks/210244b9-0b6b-4a2c-83a3-04bd3175d017/
- https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1562.004/T1562.004.md#atomic-test-1---disable-microsoft-defender-firewall
author: Fatih Sirin
date: 2019-11-01
modified: 2023-02-13
tags:
- attack.defense-impairment
- attack.t1686.003
- attack.s0108
logsource:
category: process_creation
product: windows
detection:
selection_img:
- Image|endswith: '\netsh.exe'
- OriginalFileName: 'netsh.exe'
selection_cli_1:
# Example: netsh firewall set opmode disable
CommandLine|contains|all:
- 'firewall'
- 'set'
- 'opmode'
- 'disable'
selection_cli_2:
# Example: netsh advfirewall set currentprofile state off
CommandLine|contains|all:
- 'advfirewall'
- 'set'
- 'state'
- 'off'
condition: selection_img and 1 of selection_cli_*
falsepositives:
- Legitimate administration activity
level: mediumQRadar AQL
IBM QRadar AQL (hunting query)Hunting query
Hunting search for the Log Activity tab or the API. It is not a QRadar rule.
AQL search for the Log Activity tab or the API. It is NOT a deployable QRadar rule: real-time detection in QRadar is a CRE (Custom Rule Engine) rule, for which this build only writes a design specification (qradar_cre).
SELECT * FROM events WHERE devicetype=12 AND ((LOWER("Process Path") LIKE '%\netsh.exe' OR LOWER("Process Name") LIKE '%\netsh.exe') OR Filename='netsh.exe') AND ((LOWER(Command) LIKE '%firewall%' AND LOWER(Command) LIKE '%set%' AND LOWER(Command) LIKE '%opmode%' AND LOWER(Command) LIKE '%disable%') OR (LOWER(Command) LIKE '%advfirewall%' AND LOWER(Command) LIKE '%set%' AND LOWER(Command) LIKE '%state%' AND LOWER(Command) LIKE '%off%'))QRadar CRE
Design for the QRadar Rule Wizard. It is not importable and has not been tested in QRadar.
- Rule name
OffSet7: Firewall Disabled via Netsh.EXE- Rule type
- Event rule (Local)
- Log source types
- Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1
Building blocks
BB:OffSet7:Firewall Disabled via Netsh EXE:selection_img(match)Any of the groups matches (OR): build one BB per group and a parent BB "when an event matches any of" them.Process Path / Process Nameends with:\netsh.exeFilenameis equal to (case-insensitive):netsh.exe
BB:OffSet7:Firewall Disabled via Netsh EXE:selection_cli_1(match)All test lines must match (AND).Commandcontains:firewall,set,opmode,disable
BB:OffSet7:Firewall Disabled via Netsh EXE:selection_cli_2(match)All test lines must match (AND).Commandcontains:advfirewall,set,state,off
Main rule, option A (building blocks)
- when the event(s) were detected by one or more of these log source types:
Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1 - when an event matches the condition built from these building blocks:
BB:OffSet7:Firewall Disabled via Netsh EXE:selection_img AND (ANY of [BB:OffSet7:Firewall Disabled via Netsh EXE:selection_cli_1, BB:OffSet7:Firewall Disabled via Netsh EXE:selection_cli_2])
Main rule, option B (AQL filter test)
- when the event matches this AQL filter query:
devicetype=12 AND ((LOWER("Process Path") LIKE '%\netsh.exe' OR LOWER("Process Name") LIKE '%\netsh.exe') OR Filename='netsh.exe') AND ((LOWER(Command) LIKE '%firewall%' AND LOWER(Command) LIKE '%set%' AND LOWER(Command) LIKE '%opmode%' AND LOWER(Command) LIKE '%disable%') OR (LOWER(Command) LIKE '%advfirewall%' AND LOWER(Command) LIKE '%set%' AND LOWER(Command) LIKE '%state%' AND LOWER(Command) LIKE '%off%'))
Rule response
- Severity 5, credibility 6, relevance 7
- Ensure the detected event is part of an offense; index offense on Log Source (host) and annotate with the rule title and OffSet7 rule id
- Respond no more than once per 30 minutes per Log Source (tune per environment)
Limitations
- QRadar AQL LIKE / CRE string tests are case-sensitive unless the property is lower-cased; the AQL option uses LOWER() where the backend applied it.
Splunk
Splunk SPLSearch
Search for Splunk with Windows/Sysmon field names. A scheduled search or ES correlation search also needs a schedule, time range, throttling and an adaptive response, set in your environment.
(Image="*\\netsh.exe" OR OriginalFileName="netsh.exe") ((CommandLine="*firewall*" CommandLine="*set*" CommandLine="*opmode*" CommandLine="*disable*") OR (CommandLine="*advfirewall*" CommandLine="*set*" CommandLine="*state*" CommandLine="*off*"))Splunk savedsearches.conf stanzaScheduled search template
Template stanza. Review schedule, alert actions and index/sourcetype for your environment before enabling.
[default]
dispatch.earliest_time = -30d
dispatch.latest_time = now
[Firewall Disabled via Netsh.EXE]
description = Detects netsh commands that turns off the Windows firewall
search = (Image="*\\netsh.exe" OR OriginalFileName="netsh.exe") ((CommandLine="*firewall*" CommandLine="*set*" CommandLine="*opmode*" CommandLine="*disable*") OR (CommandLine="*advfirewall*" CommandLine="*set*" CommandLine="*state*" CommandLine="*off*"))Microsoft Sentinel
Microsoft Sentinel KQL (ASIM)Hunting query
Hunting query over ASIM-normalized tables. An analytics rule also needs a schedule, entity mapping and alert grouping.
imProcessCreate
| where (TargetProcessName endswith "\\netsh.exe" or TargetProcessFileOriginalName =~ "netsh.exe") and ((TargetProcessCommandLine contains "firewall" and TargetProcessCommandLine contains "set" and TargetProcessCommandLine contains "opmode" and TargetProcessCommandLine contains "disable") or (TargetProcessCommandLine contains "advfirewall" and TargetProcessCommandLine contains "set" and TargetProcessCommandLine contains "state" and TargetProcessCommandLine contains "off"))Defender XDR
Microsoft Defender XDR KQLHunting query
Advanced hunting query. A custom detection rule also needs a frequency, impacted entities and actions.
DeviceProcessEvents
| where (FolderPath endswith "\\netsh.exe" or ProcessVersionInfoOriginalFileName =~ "netsh.exe") and ((ProcessCommandLine contains "firewall" and ProcessCommandLine contains "set" and ProcessCommandLine contains "opmode" and ProcessCommandLine contains "disable") or (ProcessCommandLine contains "advfirewall" and ProcessCommandLine contains "set" and ProcessCommandLine contains "state" and ProcessCommandLine contains "off"))Elastic
Elastic Lucene (ECS)Hunting query
Lucene query over ECS fields (Winlogbeat/Elastic Agent Windows mappings). A detection rule also needs an index pattern, schedule and actions.
(process.executable:*\\netsh.exe OR process.pe.original_file_name:netsh.exe) AND ((process.command_line:*firewall* AND process.command_line:*set* AND process.command_line:*opmode* AND process.command_line:*disable*) OR (process.command_line:*advfirewall* AND process.command_line:*set* AND process.command_line:*state* AND process.command_line:*off*))Elastic EQL (ECS)Hunting query
EQL query over ECS fields. Usable in an Elastic Security EQL rule after review; index pattern and schedule are set per environment.
any where (process.executable:"*\\netsh.exe" or process.pe.original_file_name:"netsh.exe") and ((process.command_line:"*firewall*" and process.command_line:"*set*" and process.command_line:"*opmode*" and process.command_line:"*disable*") or (process.command_line:"*advfirewall*" and process.command_line:"*set*" and process.command_line:"*state*" and process.command_line:"*off*"))Elastic ES|QL (ECS)Hunting query
ES|QL query over ECS fields; the FROM clause uses * and must be narrowed to your indices.
from * metadata _id, _index, _version | where (ends_with(process.executable, "\\netsh.exe") or process.pe.original_file_name=="netsh.exe") and (process.command_line like "*firewall*" and process.command_line like "*set*" and process.command_line like "*opmode*" and process.command_line like "*disable*" or process.command_line like "*advfirewall*" and process.command_line like "*set*" and process.command_line like "*state*" and process.command_line like "*off*")Required telemetry
- Log source
product: windows · category: process_creation- Fields used
CommandLineImageOriginalFileName
False positives
- Legitimate administration activity
Investigation and response
No OffSet7 investigation guidance has been written for this rule yet. Start from the false positives above and the ATT&CK technique pages.
References
- https://www.winhelponline.com/blog/enable-and-disable-windows-firewall-quickly-using-command-line/
- https://app.any.run/tasks/210244b9-0b6b-4a2c-83a3-04bd3175d017/
- https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1562.004/T1562.004.md#atomic-test-1---disable-microsoft-defender-firewall
Author and attribution
- Author
- Fatih Sirin
- Source
- SigmaHQ ·
rules/windows/process_creation/proc_creation_win_netsh_fw_disable.yml - Upstream commit
9688134317a2- Licence
- Detection Rule License (DRL) 1.1
Version history
- Version 1Imported from SigmaHQ
- OffSet7 build · SigmaHQ
9688134317a2