netfilter: xt_osf: Add missing permission checks
authorKevin Cernekee <cernekee@chromium.org>
Tue, 5 Dec 2017 23:42:41 +0000 (15:42 -0800)
committerPeter Michael Green <plugwash@raspbian.org>
Wed, 7 Feb 2018 23:32:32 +0000 (23:32 +0000)
commite67ee7457bf80de7f749b883a6743d838fb8eae4
tree3cedaa1c67cb4aa6ebd8a4e0f9de9d2e01a99df8
parent0e943c11df1add73082bdc8a6f0a9134b5706216
netfilter: xt_osf: Add missing permission checks

The capability check in nfnetlink_rcv() verifies that the caller
has CAP_NET_ADMIN in the namespace that "owns" the netlink socket.
However, xt_osf_fingers is shared by all net namespaces on the
system.  An unprivileged user can create user and net namespaces
in which he holds CAP_NET_ADMIN to bypass the netlink_net_capable()
check:

    vpnns -- nfnl_osf -f /tmp/pf.os

    vpnns -- nfnl_osf -f /tmp/pf.os -d

These non-root operations successfully modify the systemwide OS
fingerprint list.  Add new capable() checks so that they can't.

Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name netfilter-xt_osf-add-missing-permission-checks.patch
net/netfilter/xt_osf.c