· 8 min read

TCP ACK Flood Mitigation: Detecting ACK, RST and FIN Floods

TCP ACK flood mitigation starts with recognizing the pattern: a large packet rate of small TCP segments carrying only the ACK, RST or FIN flag, aimed at hosts that have no matching connection. Flow data shows it as a pps spike with modest bps. The fix is to drop that traffic as early and as cheaply as possible, before conntrack and stateful firewalls have to process it.

These floods are popular because they are cheap to send and expensive to receive. A 40-byte packet costs the attacker almost nothing, but every packet forces a state lookup on your side.

Why ACK, RST and FIN floods hurt stateful devices

Stateless routers forward these packets at line rate. The trouble starts at the first stateful hop: a Linux host with conntrack, a firewall appliance, a load balancer or a NAT gateway.

If your box is already dropping packets with a full table, also check conntrack sizing and timeouts. This article focuses on keeping the junk out of conntrack in the first place.

Flow-based detection signals

You do not need packet capture to spot this. NetFlow v5/v9, IPFIX and sFlow all carry the fields you need.

What to look for

  1. pps up, bps flat. Per-destination pps rises 10x or more while bps barely moves. Average packet size sits around 40–60 bytes. 1 Mpps of 40-byte packets is only about 320 Mbps at L3, which looks harmless on an interface graph.
  2. TCP flags in flow records. In NetFlow/IPFIX the tcp_flags field is the cumulative OR of flags seen in the flow. A legitimate TCP flow that completes will show SYN, ACK, PSH and FIN together. Flood flows show: - ACK flood: 0x10 only - RST flood: 0x04 or 0x14 (RST+ACK) - FIN flood: 0x01 or 0x11 (FIN+ACK)
  3. One-packet flows. Many flows with exactly 1 packet and one of the flag values above are a strong signal.
  4. No reverse traffic. Inbound pps to a destination IP with no corresponding outbound data flows.
  5. Source diversity. Spoofed floods show a huge number of unique source IPs, often spread evenly across the address space. Reflected or botnet floods show more clustered sources.
  6. Port pattern. Random destination ports suggest hitting closed ports. A fixed port like 443 suggests the attacker wants to reach your application or load balancer.

Caveats

Example with nfdump (check filter syntax for your version):

nfdump -R /var/cache/nfdump -n 10 -s dstip/packets \
  'proto tcp and flags A and packets 1'

For automated detection, per-IP and per-prefix pps thresholds are the most reliable trigger, because bps thresholds will miss this attack class. NixMon ingests NetFlow v5/v9, IPFIX and sFlow and applies per-IP/prefix bps and pps thresholds, so a pps-based rule fires even when bandwidth looks normal. For tuning, see pps vs bps thresholds and hysteresis in our earlier threshold guide.

Host-level filtering with nftables

Drop what you can before conntrack, in the raw priority hook, and make conntrack strict for the rest.

sysctl -w net.netfilter.nf_conntrack_tcp_loose=0

With loose tracking off, an ACK without a known connection becomes INVALID instead of creating an entry. Caveats: connections established before the change, HA failover onto a cold node, and asymmetric routing can all break.

table inet tcpflood {
  set services { type inet_service; elements = { 22, 80, 443 } }
  set protected4 { type ipv4_addr; flags interval; elements = { 192.0.2.0/24 } }

  chain pre {
    type filter hook prerouting priority raw; policy accept;

    # impossible flag combinations
    tcp flags & (fin|syn) == fin|syn drop
    tcp flags & (syn|rst) == syn|rst drop
    tcp flags & (fin|syn|rst|psh|ack|urg) == 0 drop

    # TCP to closed ports, unless it looks like return traffic
    ip daddr @protected4 tcp dport != @services \
      tcp sport != { 53, 80, 443 } drop
  }

  chain input {
    type filter hook input priority filter; policy drop;
    ct state invalid drop
    tcp flags & rst == rst meter rstflood { ip saddr limit rate over 50/second } drop
    ct state established,related accept
    tcp dport @services ct state new accept
  }
}

Use the forward hook instead of input if this box routes traffic for VMs or customers. The legacy iptables equivalents:

iptables -t raw -A PREROUTING -p tcp --tcp-flags ALL NONE -j DROP
iptables -t raw -A PREROUTING -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
iptables -t raw -A PREROUTING -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
iptables -A INPUT -m conntrack --ctstate INVALID -j DROP

Common mistakes

Edge ACLs on routers

Router ACLs run in hardware on most platforms, so they are the cheapest place to drop closed-port traffic. They are stateless, so be careful.

Juniper (Junos):

firewall {
  family inet {
    filter PROTECT-TCP {
      term bad-flags {
        from {
          destination-address 192.0.2.0/24;
          protocol tcp;
          tcp-flags "(syn & fin) | (syn & rst) | !(fin|syn|rst|psh|ack|urg)";
        }
        then { count bad-flags; discard; }
      }
      term closed-ports {
        from {
          destination-address 192.0.2.0/24;
          protocol tcp;
          destination-port-except [ 22 80 443 ];
          source-port-except [ 53 80 443 ];
        }
        then { count closed-ports; discard; }
      }
      term rest { then accept; }
    }
  }
}

MikroTik RouterOS v7 (raw table, before connection tracking):

/ip firewall raw
add chain=prerouting protocol=tcp dst-address=192.0.2.10 dst-port=22,80,443 action=accept
add chain=prerouting protocol=tcp dst-address=192.0.2.10 src-port=53,80,443 action=accept
add chain=prerouting protocol=tcp dst-address=192.0.2.10 action=drop

Cisco IOS-XE: the established keyword matches ACK or RST, so it is not a flood filter. Use explicit port-based permits for service ports and a counted deny for the rest, and check counters to confirm the ACL is actually matching.

Always count matches first and confirm what you are dropping before switching to discard.

When ACLs are not enough: FlowSpec

If the attack targets an open port such as 443, port-based ACLs let it through. Match on destination, protocol, flags and packet length instead. With BGP FlowSpec you can push this to your edge routers from the detector. A conceptual rule (syntax differs per platform):

match destination 192.0.2.10/32; protocol tcp;
      destination-port =443; tcp-flags ack; packet-length >=40 <=60;
then  rate-limit 5000000   # or discard

Be careful here. Pure-ACK packets on port 443 are exactly what your legitimate clients send. A discard action will cut real users off. Prefer a rate-limit, or narrow the match with source prefixes, ports or a known-bad packet length. Test on one router first and watch your FlowSpec counters. For safety rules, see our FlowSpec guide.

RTBH is the last resort: it takes the victim IP offline for everyone, so it protects the rest of your network at the cost of that host.

When to escalate to a scrubbing tunnel

Escalate when:

A scrubbing provider keeps connection state and can drop packets that do not belong to any real session. NixGuard Edge is built for networks with their own ASN and at least one /24. Your prefixes are announced from the scrubbing edge, and clean traffic returns over a GRE tunnel with a BGP session inside. It can run always-on or on-demand, so you can trigger it from detection and keep stateless ACLs and FlowSpec for smaller events.

A practical order of operations

  1. Alert on per-IP pps, not only bps.
  2. Check flow flags, packet size and reverse traffic to classify the attack.
  3. Apply raw-table drops and strict conntrack on hosts.
  4. Push closed-port and bad-flag ACLs to the edge.
  5. Use a narrow FlowSpec rule with a rate limit for open-port floods.
  6. Move the prefix to scrubbing if stateless filtering fails.
  7. Review afterward: which signal fired first, and how long did mitigation take?

You can test flow-based pps detection for this attack class with the 15-day free trial, with no credit card required.

Frequently asked questions

How do I tell an ACK flood from normal traffic in NetFlow?

Look for per-destination pps spikes with small average packet size, many one-packet flows whose cumulative TCP flags are only ACK (0x10), and no matching outbound data flows. ACK-only packets alone are normal, since clients send them during downloads, so combine flags with pps, flow length and reverse traffic.

Why does an ACK flood fill the conntrack table?

With nf_conntrack_tcp_loose=1, which is the Linux default, an ACK without a prior SYN can create an ESTABLISHED conntrack entry with a very long timeout. Setting it to 0 makes such packets INVALID so they can be dropped without creating state.

Can I block RST and FIN packets with a firewall rule?

Not outright, because legitimate connections use both to close. Drop impossible flag combinations, drop INVALID state, apply per-source rate limits and filter closed ports. For floods on open ports, use a narrow FlowSpec rate limit or scrubbing.

When should I use FlowSpec instead of RTBH for this type of flood?

Use FlowSpec when the attack can be matched by protocol, flags, port or packet length and you want to keep the victim IP online. Use RTBH only when the attack threatens your wider network and no safe match exists. Use scrubbing when you need stateful filtering.

Detect pps-heavy TCP floods early: start your 15-day NixMon trial.Learn more