In compliance with RFC5961, the network stack send challenge ACK in response to spurious SYN packets, since commit 0c228e833c88 ("tcp: Restore RFC5961-compliant behavior for SYN packets"). This pose a problem for netfilter conntrack in state LAST_ACK, because this challenge ACK is (falsely) seen as ACKing last FIN, causing a false state transition (into TIME_WAIT). The challenge ACK is hard to distinguish from real last ACK. Thus, solution introduce a flag that tracks the potential for seeing a challenge ACK, in case a SYN packet is let through and current state is LAST_ACK. When conntrack transition LAST_ACK to TIME_WAIT happens, this flag is used for determining if we are expecting a challenge ACK. Scapy based reproducer script avail here: https://github.com/netoptimizer/network-testing/blob/master/scapy/tcp_hacks_3WHS_LAST_ACK.py
Showing the changes to include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -42,6 +42,9 @@ enum tcp_conntrack { · 41 unmodified lines | ||
| 42 | 42 | /* The field td_maxack has been set */ |
| 43 | 43 | #define IP_CT_TCP_FLAG_MAXACK_SET 0x20 |
| 44 | 44 | |
| 45 | +/* Marks possibility for expected RFC5961 challenge ACK */ | |
| 46 | +#define IP_CT_EXP_CHALLENGE_ACK 0x40 | |
| 47 | + | |
| 45 | 48 | struct nf_ct_tcp_flags { |
| 46 | 49 | __u8 flags; |
| 47 | 50 | __u8 mask; |