- from: network
test: (?:^|\s)ip6?tables(?:-legacy|-nft)?\s+(?:\S+\s+)*?(?:-[a-zA-Z]*F[a-zA-Z]*|--flush)(?:\s|$)
description: "This flushes all firewall rules."
id: network:flush_iptables
severity: Critical
filters:
- type: NotMatches
value: '\s(?:-t|--table)(?:\s+|=)?(?:nat|mangle|raw|security)(?:\s|$)'
- from: network
test: (?:^|\s)ip6?tables(?:-legacy|-nft)?\s+(?:\S+\s+)*?(?:-X|--delete-chain)(?:\s|$)
description: "This deletes all custom firewall chains."
id: network:delete_custom_chains
severity: High
- from: network
test: (?:^|\s)ip6?tables(?:-legacy|-nft)?\s+(?:\S+\s+)*?(?:-t|--table)(?:\s+|=)?nat\s+(?:\S+\s+)*?(?:-[a-zA-Z]*F[a-zA-Z]*|--flush)(?:\s|$)
description: "This flushes all NAT rules."
id: network:flush_nat_rules
severity: High
- from: network
test: (?:^|\s)ufw\s+disable(\s|$)
description: "This disables the firewall."
id: network:disable_firewall
severity: Critical
- from: network
test: (?:^|\s)ufw\s+(?:--force\s+)?reset(?:\s|$)
description: "This resets the firewall: every rule is removed and the firewall is disabled."
id: network:force_reset_firewall
severity: Critical
- from: network
test: (?:^|\s)systemctl\s+stop\s+networking
description: "This stops the networking service."
id: network:stop_networking
severity: High
- from: network
test: (?:^|\s)systemctl\s+stop\s+NetworkManager
description: "This stops NetworkManager."
id: network:stop_network_manager
severity: High
- from: network
test: (?:^|\s)ifconfig\s+\w+\s+down
description: "This brings a network interface down."
id: network:bring_down_interface
severity: High
- from: network
test: (?:^|\s)ip\s+link\s+set\s+[\w-]+\s+down
description: "This brings a network interface down."
id: network:bring_down_interface_ip
severity: High
- from: network
test: (?:^|\s)route\s+del\s+default
description: "This deletes the default network route."
id: network:delete_default_route
severity: High
- from: network
test: (?:^|\s)nft\s+flush\s+ruleset
description: "Flushing all nftables rules removes all firewall protection."
id: network:flush_nftables
severity: Critical
- from: network
test: (?:^|\s)ip\s+route\s+flush
description: "Flushing the routing table causes immediate loss of network connectivity."
id: network:flush_routes
severity: Critical
- from: network
test: (?:^|\s)ip6?tables\s+(?:\S+\s+)*?(?:-P|--policy)\s+(?:INPUT|OUTPUT|FORWARD)\s+(?:DROP|REJECT)(?:\s|$)
description: "This sets the default firewall policy to DROP, which can cut off all traffic, including your SSH session."
id: network:iptables_default_drop
severity: High
- from: network
test: (?:^|\s)ip6?tables(?:-legacy|-nft)?\s+(?:\S+\s+)*?(?:-A|-I|--append|--insert)\s+INPUT\s+-j\s+(?:DROP|REJECT)(?:\s|$)
description: "This appends a catch-all DROP/REJECT rule to INPUT, dropping all incoming traffic including your SSH session."
id: network:iptables_drop_all_input
severity: High
- from: network
test: '(?:(?:^|\s)(?:ba|z|k|da)?sh\s+(?:-\S+\s+)*-i\b.*/dev/(?:tcp|udp)/|/dev/(?:tcp|udp)/\S+.*\s0>&1|(?:^|\s)(?:nc|ncat|netcat|nc\.traditional)\s+(?:\S+\s+)*?-[a-zA-Z]*[ec]\s*\S|(?:^|\s)socat\s+.*\b(?:exec|system):|\bpty\.spawn\(|\bsocket\.socket\(.*\.connect\()'
description: "This opens a reverse shell: it hands an interactive shell on this machine to whoever listens at the remote address."
id: network:reverse_shell
severity: High
- from: network
test: (?:^|\s)ip\s+(?:-\S+\s+)*(?:a|addr|address)\s+(?:flush|del)\s
description: "This removes the IP addresses of a network interface: the machine (and your SSH session) loses connectivity on it."
id: network:flush_addresses
severity: High
- from: network
test: (?:^|\s)ufw\s+(?:--\S+\s+)*default\s+(?:deny|reject)(?:\s+(?:incoming|in))?(?:\s|$)
description: "This makes the firewall refuse all incoming connections by default, including SSH unless a rule allows it."
id: network:ufw_default_deny
severity: High
alternative: "ufw allow OpenSSH"
alternative_info: "Allow SSH first (then set the default policy), so the session that changes the firewall is not cut off."
- from: network
test: '(?i)(?:^|\s)(?:netsh(?:\.exe)?\s+advfirewall\s+set\s+\S+\s+state\s+off|netsh(?:\.exe)?\s+firewall\s+set\s+opmode\s+(?:mode=)?disable|Set-NetFirewallProfile\s+(?:\S+\s+)*?-Enabled[:\s]+(?:False|0)\b)'
description: "This turns the Windows firewall off, leaving every port open."
id: network:disable_firewall_windows
severity: Critical