Bug 190102 - [tcp] net.inet.tcp.drop_synfin=1 no longer works on FreeBSD 10+ [regression]
Summary: [tcp] net.inet.tcp.drop_synfin=1 no longer works on FreeBSD 10+ [regression]
Status: Closed Works As Intended
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 10.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-net (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-22 12:50 UTC by Mark Felder
Modified: 2014-11-04 14:11 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Felder freebsd_committer freebsd_triage 2014-05-22 12:50:01 UTC
net.inet.tcp.drop_synfin=1 no longer works on FreeBSD 10+

How-To-Repeat: Run this scan on identically configured FreeBSD 9 and FreeBSD 10 servers


nmap -v -v --scanflags SYNFIN -P0 <target>


FreeBSD 9 servers will report "filtered" which is correct. FreeBSD 10
servers will report "open", which means it is vulnerable to this attack
to bypass the firewall.

The firewall in use on these machines is pf. It is possible to block
SYN/FIN on pf as well, but our standard deployment is the sysctl method.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2014-05-22 22:00:27 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-net

Over to maintainer(s).
Comment 2 Eygene Ryabinkin freebsd_committer freebsd_triage 2014-05-29 06:46:45 UTC
I assume that your pf(4) is enabled during these tests, you have
"scrub" statements in the ruleset and removing "scrub" will restore
the expected behaviour on 10.x?

I am slightly amused that on 9.x with "scrub" you're getting the
expected behaviour, because clearing FIN bit for SYN packets was
the standard behaviour of pf since approximately at least 10 years,
  http://svnweb.freebsd.org/base/vendor-sys/pf/dist/sys/contrib/pf/net/pf_norm.c?view=markup&pathrev=126258#l1242

Can you show relevant parts of the pf.conf from both machines
and output from 'pfctl -s rules' if you are sure that both machines
are configured identically pf-wise?

Thanks!
-- 
Eygene Ryabinkin                                        ,,,^..^,,,
[ Life's unfair - but root password helps!           | codelabs.ru ]
[ 82FE 06BC D497 C0DE 49EC  4FF0 16AF 9EAE 8152 ECFB | freebsd.org ]
Comment 3 Hiren Panchasara 2014-05-29 07:52:51 UTC
On Wed, May 28, 2014 at 10:46 PM, Eygene Ryabinkin <rea@freebsd.org> wrote:
> I assume that your pf(4) is enabled during these tests, you have
> "scrub" statements in the ruleset and removing "scrub" will restore
> the expected behaviour on 10.x?

I can confirm that I see exactly what you are saying on a stable/10 box.

cheers,
Hiren
Comment 4 Eygene Ryabinkin freebsd_committer freebsd_triage 2014-05-29 09:00:05 UTC
Wed, May 28, 2014 at 11:52:51PM -0700, hiren panchasara wrote:
> On Wed, May 28, 2014 at 10:46 PM, Eygene Ryabinkin <rea@freebsd.org> wrote:
> > I assume that your pf(4) is enabled during these tests, you have
> > "scrub" statements in the ruleset and removing "scrub" will restore
> > the expected behaviour on 10.x?
> 
> I can confirm that I see exactly what you are saying on a stable/10 box.


I had found 2 flavors of 9.x boxen: 9.1/9.2 that behave like 10.x and
some 9.0 that are dropping SYN|FIN even in the presence of "scrub".
The trouble is that the latter boxes are in full production, so I need
some time to try to reproduce that on the text box.
-- 
Eygene Ryabinkin                                        ,,,^..^,,,
[ Life's unfair - but root password helps!           | codelabs.ru ]
[ 82FE 06BC D497 C0DE 49EC  4FF0 16AF 9EAE 8152 ECFB | freebsd.org ]
Comment 5 Mark Felder freebsd_committer freebsd_triage 2014-05-29 13:25:31 UTC
The test box in particular is using pf and does not have any scrub 
statements in pf.conf. The dropping of SYN+FIN worked for us in 9.1 and 
older just by setting net.inet.tcp.drop_synfin=1. We skipped 9.2 for the 
most part, so I don't have any experience with its behavior in 
production.
Comment 6 Mark Felder freebsd_committer freebsd_triage 2014-11-04 14:11:20 UTC
Closing this. 

There was an off-list discussion where some sensitive information was exchanged to further evaluate this situation. After some testing mistakes on both ends were resolved we concluded that the behavior is correct and manual attempts to invoke this bug were unsuccessful. It seems the remote scanning service we were using was possibly triggering a bug of its own.