Patch "netfilter: nfnetlink_cthelper: Add missing permission checks" has been added to the 4.4-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
netfilter: nfnetlink_cthelper: Add missing permission checks
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
netfilter-nfnetlink_cthelper-add-missing-permission-checks.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
4b380c42f7d00a395feede754f0bc2292eebe6e5Mon Sep 17 00:00:00 2001
From: Kevin Cernekee <[email protected]>
Date: Sun, 3 Dec 2017 12:12:45 -0800
Subject: netfilter: nfnetlink_cthelper: Add missing permission checks
From: Kevin Cernekee <[email protected]>
commit 4b380c42f7d00a395feede754f0bc2292eebe6e5 upstream.
The capability check in nfnetlink_rcv() verifies that the caller has CAP_NET_ADMIN in the namespace that "owns" the netlink socket. However, nfnl_cthelper_list 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:
$ nfct helper list
nfct v1.4.4: netlink error: Operation not permitted
$ vpnns -- nfct helper list
{
.name = ftp,
.queuenum = 0,
.l3protonum = 2,
.l4protonum = 6,
.priv_data_len = 24,
.status = enabled,
};Add capable() checks in nfnetlink_cthelper, as this is cleaner than trying to generalize the solution.
--- net/netfilter/nfnetlink_cthelper.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/netfilter/nfnetlink_cthelper.c +10 -0
@@ -17,6 +17,7 @@#include <linux/types.h> #include <linux/list.h> #include <linux/errno.h> +#include <linux/capability.h> #include <net/netlink.h> #include <net/sock.h>
@@ -392,6 +393,9 @@ nfnl_cthelper_new(struct sock *nfnl, strstruct nfnl_cthelper *nlcth;int ret =0 ; +if (!capable (CAP_NET_ADMIN )) +return -EPERM ; +if (!tb[NFCTH_NAME ] || !tb[NFCTH_TUPLE ])return -EINVAL ;
@@ -595,6 +599,9 @@ nfnl_cthelper_get(struct sock *nfnl, strstruct nfnl_cthelper *nlcth;bool tuple_set = false; +if (!capable (CAP_NET_ADMIN )) +return -EPERM ; +if (nlh->nlmsg_flags &NLM_F_DUMP ) {struct netlink_dump_control c = { .dump = nfnl_cthelper_dump_table,
@@ -661,6 +668,9 @@ nfnl_cthelper_del(struct sock *nfnl, strstruct nfnl_cthelper *nlcth, *n;int j =0 , ret; +if (!capable (CAP_NET_ADMIN )) +return -EPERM ; +if (tb[NFCTH_NAME ]) helper_name =nla_data (tb[NFCTH_NAME ]);
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/netfilter-xt_osf-add-missing-permission-checks.patch queue-4.4/netfilter-nfnetlink_cthelper-add-missing-permission-checks.patch