block invalid combinations of TCP flags
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ufw |
Invalid
|
Wishlist
|
Unassigned | ||
ufw (Ubuntu) |
Invalid
|
Wishlist
|
Unassigned |
Bug Description
UFW may want to DROP or REJECT packets with impossible combinations of TCP flags.
Following this man page information:
--tcp-flags [!] mask comp
Match when the TCP flags are as specified. The first argument
is the flags which we should examine, written as a comma-sepa‐
rated list, and the second argument is a comma-separated list of
flags which must be set. Flags are: SYN ACK FIN RST URG PSH ALL
NONE. Hence the command
will only match packets with the SYN flag set, and the ACK, FIN
and RST flags unset.
I've been using these rules with UFW and haven't noticed any problems:
-A ufw-before-input -p TCP --tcp-flags ALL FIN,URG,PSH -j DROP
-A ufw-before-input -p TCP --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP
-A ufw-before-input -p TCP --tcp-flags SYN,RST SYN,RST -j DROP
-A ufw-before-input -p TCP --tcp-flags SYN,FIN SYN,FIN -j DROP
-A ufw-before-input -p TCP --tcp-flags SYN,ACK NONE -j DROP
-A ufw-before-input -p TCP --tcp-flags RST,FIN RST,FIN -j DROP
-A ufw-before-input -p TCP --tcp-flags SYN,URG SYN,URG -j DROP
-A ufw-before-input -p TCP --tcp-flags ALL SYN,PSH -j DROP
-A ufw-before-input -p TCP --tcp-flags ALL SYN,ACK,PSH -j DROP
Changed in ufw: | |
importance: | Undecided → Wishlist |
Changed in ufw: | |
status: | New → Confirmed |
Changed in ufw (Ubuntu): | |
status: | New → Confirmed |
importance: | Undecided → Wishlist |
Changed in ufw: | |
status: | Confirmed → Triaged |
Changed in ufw (Ubuntu): | |
milestone: | none → ubuntu-10.04 |
status: | Confirmed → Triaged |
I figured I would put forth a patch to implement the simplest starting ground. Established connections aren't overly protected by this (there are some easy things to do), but a basic bad flags scan will be blocked.