Disable or Modify System Firewall
Adversaries may disable or modify system firewalls in order to bypass controls limiting network usage. Changes could be disabling the entire mechanism as well as adding, deleting, or modifying particular rules. This can be done via command-line tools (netsh, iptables, ufw, pfctl), editing Windows Registry keys, or through the Windows Control Panel. On ESXi, firewall rules may be modified via esxcli. Adversaries may add new firewall rules for RDP on non-standard ports or open all traffic to enable C2, lateral movement, and data exfiltration.
What is T1686 Disable or Modify System Firewall?
Disable or Modify System Firewall (T1686) maps to the Defense Impairment tactic — the adversary is trying to break security mechanisms, pipelines, and tooling so defenders can’t see or trust what’s happening in MITRE ATT&CK.
This page provides production-ready detection logic for Disable or Modify System Firewall, covering the data sources and telemetry it touches: Process: Process Creation, Command: Command Execution, Firewall: Firewall Rule Modification, Firewall: Firewall Disable. The queries below are rated high severity at high confidence, and ship for 7 SIEM platforms — KQL, SPL, Elastic, QRadar, Sumo, YARA-L, LogScale.
MITRE ATT&CK
- Tactic
- Defense Impairment
- Technique
- T1686 Disable or Modify System Firewall
- Canonical reference
- https://attack.mitre.org/techniques/T1686/
let FirewallCommands = dynamic(["netsh advfirewall set", "netsh advfirewall firewall add", "netsh advfirewall firewall delete", "netsh firewall set opmode disable", "Set-NetFirewallProfile -Enabled False", "Set-NetFirewallProfile -All -Enabled False", "New-NetFirewallRule", "Remove-NetFirewallRule", "iptables -F", "iptables -X", "iptables -P INPUT ACCEPT", "iptables -P FORWARD ACCEPT", "ufw disable", "pfctl -d", "esxcli network firewall set"]);
DeviceProcessEvents
| where Timestamp > ago(24h)
| where ProcessCommandLine has_any (FirewallCommands)
| extend FirewallAction = case(
ProcessCommandLine has "set allprofiles state off" or ProcessCommandLine has "opmode disable" or ProcessCommandLine has "-Enabled False" or ProcessCommandLine has "ufw disable" or ProcessCommandLine has "pfctl -d", "Firewall Disabled",
ProcessCommandLine has "firewall add" or ProcessCommandLine has "New-NetFirewallRule", "Rule Added",
ProcessCommandLine has "firewall delete" or ProcessCommandLine has "Remove-NetFirewallRule", "Rule Deleted",
ProcessCommandLine has "iptables -F" or ProcessCommandLine has "iptables -X", "IPTables Flushed",
ProcessCommandLine has "iptables -P" and ProcessCommandLine has "ACCEPT", "IPTables Policy Set to ACCEPT",
"Other Modification")
| extend RuleDetail = extract(@"(?:rule\s+name=|--dport\s+)(\"?[^\"\s]+\"?)", 1, ProcessCommandLine)
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine, FirewallAction, RuleDetail, InitiatingProcessFileName, InitiatingProcessCommandLine
| sort by Timestamp desc Detects system firewall disablement and rule modification across Windows (netsh, PowerShell NetFirewall cmdlets), Linux (iptables, ufw), macOS (pfctl), and ESXi (esxcli). Classifies the action type (disabled, rule added/deleted, policy flushed) for triage prioritization.
Data Sources
Required Tables
False Positives
- System administrators legitimately configuring firewall rules for new application deployments
- Automated deployment tools (Ansible, Puppet, Chef) that manage firewall rules as part of infrastructure-as-code
- Network troubleshooting where firewall is temporarily disabled and re-enabled within a change window
- Application installers that add firewall exceptions during setup (e.g., SQL Server, IIS)
Sigma rule & cross-platform mapping
The detection logic for Disable or Modify System Firewall (T1686) above is provided in a vendor-neutral
form so you can deploy it on any SIEM. The same logic is shipped here as native
KQL (Microsoft Sentinel / Defender), SPL (Splunk), Elastic (Elastic Security (EQL)), QRadar (IBM QRadar (AQL)), Sumo (Sumo Logic CSE), YARA-L (Google Chronicle / SecOps), LogScale (CrowdStrike LogScale (CQL)) queries. In Sigma terms, this detection targets the
following logsource:
logsource:
category: process_creation
product: windows Browse the community-maintained Sigma rules for this technique:
Platform-specific guides for T1686
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1 Disable Windows Firewall All Profiles
Expected signal: Sysmon Event ID 1: netsh.exe process creation. Windows Firewall Event ID 2003: Firewall profile changed. Each profile state change generates a separate event.
- Test 2 Add Firewall Rule for RDP on Non-Standard Port
Expected signal: Sysmon Event ID 1: netsh.exe with 'firewall add rule'. Windows Firewall Event ID 2004: A rule has been added.
- Test 3 Flush IPTables Rules on Linux
Expected signal: Auditd execve syscall records for iptables. Syslog entries for iptables commands. MDE DeviceProcessEvents if MDE for Linux is deployed.
Response Playbook
Triage
- Determine what exactly changed — was the entire firewall disabled, or was a specific rule added/deleted/modified?
- If a rule was added: examine the port, protocol, and direction — does it align with a known service or is it unusual (e.g., opening RDP on a non-standard port)?
- Check the user context and whether this change has a corresponding change ticket
- Look for temporal correlation with other suspicious activity — was the firewall change preceded by initial access or followed by lateral movement?
- On Linux: check if iptables was flushed entirely (iptables -F) — this removes all rules including defensive ones
Containment
- Re-enable the firewall immediately if it was disabled entirely: netsh advfirewall set allprofiles state on
- Remove unauthorized firewall rules: netsh advfirewall firewall delete rule name="<malicious_rule>"
- On Linux: restore iptables rules from backup: iptables-restore < /etc/iptables.rules.backup
- Block any newly exposed ports at the network perimeter firewall
- If C2 traffic was enabled: identify and block the destination IPs/domains at proxy and DNS level
Evidence Collection
- Windows Firewall Event IDs: 2003 (profile changed), 2004 (rule added), 2005 (rule modified), 2006 (rule deleted)
- Sysmon Event ID 1: Process creation for netsh.exe, powershell.exe with firewall commands
- Registry: HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy — firewall policy configuration
- Linux: /etc/iptables/rules.v4 or /etc/sysconfig/iptables — saved firewall rules
- Linux: iptables -L -n -v output to capture current rule state
Escalation Criteria
- ! Entire firewall disabled on a production server or domain controller
- ! Firewall rule added allowing inbound connections on RDP (3389) or SSH (22) from any source
- ! IPTables flushed on a Linux server exposed to the internet
- ! Firewall modification followed by detection of external C2 connections or lateral movement
- ! Multiple hosts showing simultaneous firewall changes (automated malware behavior)
Investigation Guide
Forensic Artifacts
- >
Windows Firewall Event Log: Microsoft-Windows-Windows Firewall With Advanced Security/Firewall - >
Registry: HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\EnableFirewall - >
Registry: HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\EnableFirewall - >
Linux: /etc/iptables/rules.v4, /etc/sysconfig/iptables — persistent rules - >
Linux: /var/log/ufw.log — UFW firewall log - >
Prefetch: NETSH.EXE-*.pf — netsh execution timestamps
Tuning Guidance
Build allowlists for known firewall management processes and accounts. Infrastructure-as-code tools (Ansible, Puppet) typically run under specific service accounts. Application installers that add firewall rules should be baselined. Focus high-severity alerts on complete firewall disablement and rule additions that open broad access. Consider separate alerts for inbound vs outbound rule changes.
Hunting Queries
Hunt for netsh firewall modifications across the environment. Baseline legitimate firewall management and investigate anomalies.
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName =~ "netsh.exe"
| where ProcessCommandLine has "advfirewall"
| summarize Count=count(), Actions=make_set(ProcessCommandLine) by DeviceName, AccountName
| sort by Count desc index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 Image="*\\netsh.exe" CommandLine="*advfirewall*"
| stats count, values(CommandLine) as Actions by host, User
| sort - count Atomic Red Team Tests
Disables Windows Firewall for all profiles (Domain, Private, Public) using netsh. This is commonly done by ransomware and malware to enable lateral movement.
Command
netsh advfirewall set allprofiles state off Cleanup
netsh advfirewall set allprofiles state on Expected Telemetry
Sysmon Event ID 1: netsh.exe process creation. Windows Firewall Event ID 2003: Firewall profile changed. Each profile state change generates a separate event.
Expected Detection
KQL: FirewallAction='Firewall Disabled'. SPL: FirewallAction='Firewall Disabled' or EventCode=2003.
Adds a Windows Firewall rule allowing inbound TCP on port 4444. This simulates adversaries opening ports for RDP or C2 on non-standard ports. Used by Conti group.
Command
netsh advfirewall firewall add rule name="df00tech-test" dir=in action=allow protocol=TCP localport=4444 Cleanup
netsh advfirewall firewall delete rule name="df00tech-test" Expected Telemetry
Sysmon Event ID 1: netsh.exe with 'firewall add rule'. Windows Firewall Event ID 2004: A rule has been added.
Expected Detection
KQL: FirewallAction='Rule Added'. SPL: FirewallAction='Rule Added' or EventCode=2004.
Flushes all iptables rules and sets default policies to ACCEPT, effectively disabling the Linux firewall. This removes all defensive network filtering.
Command
iptables -F && iptables -X && iptables -P INPUT ACCEPT && iptables -P FORWARD ACCEPT && iptables -P OUTPUT ACCEPT Cleanup
iptables-restore < /etc/iptables/rules.v4 Expected Telemetry
Auditd execve syscall records for iptables. Syslog entries for iptables commands. MDE DeviceProcessEvents if MDE for Linux is deployed.
Expected Detection
KQL: FirewallAction='IPTables Flushed'. SPL: FirewallAction='IPTables Flushed' or 'IPTables Accept All'.