T1562.013 Elastic Security · Elastic

Detect Disable or Modify Network Device Firewall in Elastic Security

Adversaries may disable network device-based firewall mechanisms entirely or add, delete, or modify particular rules in order to bypass controls limiting network usage. Modifying or disabling a network firewall may enable adversary C2 communications, lateral movement, and/or data exfiltration that would otherwise not be allowed. For example, adversaries may add new network firewall rules to allow access to all internal network subnets without restrictions. Adversaries may gain access to the firewall management console via Valid Accounts or by exploiting a vulnerability. In some cases, threat actors may target firewalls that have been exposed to the internet. This technique was used by APT38 to create firewall exemptions on specific ports, and by threat actors exploiting Fortinet FortiGate vulnerabilities (CVE-2024-55591) to modify firewall rules before deploying LockBit ransomware.

MITRE ATT&CK

Tactic
Defense Evasion
Technique
T1562 Impair Defenses
Sub-technique
T1562.013 Disable or Modify Network Device Firewall
Canonical reference
https://attack.mitre.org/techniques/T1562/013/

Elastic Detection Query

Elastic Security (Elastic)
eql
any where (
  (event.category == "process" and event.type == "start" and (
    process.command_line like~ "*netsh advfirewall*" or
    process.command_line like~ "*netsh firewall*" or
    process.command_line like~ "*Set-NetFirewallProfile*" or
    process.command_line like~ "*New-NetFirewallRule*" or
    process.command_line like~ "*Remove-NetFirewallRule*" or
    process.command_line like~ "*Disable-NetFirewallRule*" or
    process.command_line like~ "*Set-NetFirewallRule*" or
    process.command_line like~ "*iptables -F*" or
    process.command_line like~ "*iptables -P INPUT ACCEPT*" or
    process.command_line like~ "*iptables -P FORWARD ACCEPT*" or
    process.command_line like~ "*iptables -D*" or
    process.command_line like~ "*ufw disable*" or
    process.command_line like~ "*firewall-cmd*--add-port*" or
    process.command_line like~ "*nft flush ruleset*" or
    process.command_line like~ "*nft delete*"
  ))
  or
  (event.category == "process" and event.type == "start" and
    process.name in ("netsh.exe", "powershell.exe", "pwsh.exe", "iptables", "ip6tables", "ufw", "nft", "firewall-cmd") and (
      process.command_line like~ "*state off*" or
      process.command_line like~ "*allprofiles state off*" or
      process.command_line like~ "*Enabled False*" or
      process.command_line like~ "*action=allow*" or
      process.command_line like~ "*permit any*" or
      process.command_line like~ "*-j ACCEPT*"
    )
  )
)
high severity high confidence

Detects attempts to disable or modify host-based and network device firewalls via command-line utilities including netsh, PowerShell firewall cmdlets, iptables, ufw, nft, and firewall-cmd. Covers T1562.013 behavior used by APT38 and ransomware actors exploiting Fortinet FortiGate vulnerabilities.

Data Sources

Endpoint process telemetry (EDR/Elastic Agent)Windows Security logsLinux auditd / syslog

Required Tables

logs-endpoint.events.process-*logs-system.security-*logs-auditd_manager.auditd-*

False Positives & Tuning

  • IT administrators running authorized firewall configuration scripts via GPO or Ansible/Chef/Puppet automation
  • Software installations (e.g., AV/EDR, VPN clients) that add inbound/outbound rules as part of setup
  • DevOps pipelines running firewall-cmd or iptables to open application ports during container or VM provisioning
Download portable Sigma rule (.yml)

Other platforms for T1562.013


Testing Methodology

Validate this detection against 4 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.

  1. Test 1Disable Windows Firewall via netsh

    Expected signal: Sysmon Event ID 1: Process Create with Image=netsh.exe, CommandLine='advfirewall set allprofiles state off'. Windows Firewall Event ID 2003: Profile changed (all profiles disabled). Security Event ID 4688 with command line auditing. DeviceProcessEvents in MDE.

  2. Test 2Add Allow-Any Inbound Firewall Rule via netsh

    Expected signal: Sysmon Event ID 1: Process Create with CommandLine containing 'add rule' and 'action=allow'. Windows Firewall Event ID 2004: New rule added. DeviceProcessEvents in MDE with full command line details.

  3. Test 3Flush Linux iptables Rules

    Expected signal: Syslog and/or Sysmon for Linux process creation events for iptables with -F, -P INPUT ACCEPT, and -P FORWARD ACCEPT arguments. Linux audit events (SYSCALL) for the iptables binary execution. The network exposure is immediate.

  4. Test 4Disable UFW Firewall on Linux

    Expected signal: Syslog entry for 'ufw disable' command. Process creation event for the ufw binary. Systemd journal entry for the ufw service state change. Sysmon for Linux (if installed) Event ID 1 for process creation.

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections