Detection rules › Sigma

Flush Iptables Ufw Chain

Status
test
Severity
medium
Log source
product linux, category process_creation
Author
Joseliyo Sanchez, @Joseliyo_Jstnk
Source
github.com/SigmaHQ/sigma

Detect use of iptables to flush all firewall rules, tables and chains and allow all network traffic

MITRE ATT&CK coverage

TacticTechniques
Defense ImpairmentT1686 Disable or Modify System Firewall

Event coverage

Rule body yaml

title: Flush Iptables Ufw Chain
id: 3be619f4-d9ec-4ea8-a173-18fdd01996ab
status: test
description: Detect use of iptables to flush all firewall rules, tables and chains and allow all network traffic
references:
    - https://blogs.blackberry.com/
    - https://www.cyberciti.biz/tips/linux-iptables-how-to-flush-all-rules.html
    - https://twitter.com/Joseliyo_Jstnk/status/1620131033474822144
author: Joseliyo Sanchez, @Joseliyo_Jstnk
date: 2023-01-18
tags:
    - attack.defense-impairment
    - attack.t1686
logsource:
    product: linux
    category: process_creation
detection:
    selection_img:
        Image|endswith:
            - '/iptables'
            - '/xtables-legacy-multi'
            - '/iptables-legacy-multi'
            - '/ip6tables'
            - '/ip6tables-legacy-multi'
    selection_params:
        CommandLine|contains:
            - '-F'
            - '-Z'
            - '-X'
    selection_ufw:
        CommandLine|contains:
            - 'ufw-logging-deny'
            - 'ufw-logging-allow'
            - 'ufw6-logging-deny'
            - 'ufw6-logging-allow'
            # - 'ufw-reject-output'
            # - 'ufw-track-inputt'
    condition: all of selection_*
falsepositives:
    - Network administrators
level: medium

Stages and Predicates

Stage 0: condition

all of selection_*

Stage 1: selection_img

selection_img:
    Image|endswith:
        - '/iptables'
        - '/xtables-legacy-multi'
        - '/iptables-legacy-multi'
        - '/ip6tables'
        - '/ip6tables-legacy-multi'

Stage 2: selection_params

selection_params:
    CommandLine|contains:
        - '-F'
        - '-Z'
        - '-X'

Stage 3: selection_ufw

selection_ufw:
    CommandLine|contains:
        - 'ufw-logging-deny'
        - 'ufw-logging-allow'
        - 'ufw6-logging-deny'
        - 'ufw6-logging-allow'

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
CommandLinematch
  • -F
  • -X
  • -Z
  • ufw-logging-allow
  • ufw-logging-deny
  • ufw6-logging-allow
  • ufw6-logging-deny
Imageends_with
  • /ip6tables
  • /ip6tables-legacy-multi
  • /iptables
  • /iptables-legacy-multi
  • /xtables-legacy-multi