T1562.004

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.

Microsoft Sentinel / Defender
kusto
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
high severity high confidence

Data Sources

Process: Process Creation Command: Command Execution Firewall: Firewall Rule Modification Firewall: Firewall Disable

Required Tables

DeviceProcessEvents

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)

Unlock Pro Content

Get the full detection package for T1562.004 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections