summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--patches/cve/CVE-2017-17448-netfilter-nfnetlink_cthelper-Add-missing-permission-.patch86
1 files changed, 86 insertions, 0 deletions
diff --git a/patches/cve/CVE-2017-17448-netfilter-nfnetlink_cthelper-Add-missing-permission-.patch b/patches/cve/CVE-2017-17448-netfilter-nfnetlink_cthelper-Add-missing-permission-.patch
new file mode 100644
index 0000000..97ffc00
--- /dev/null
+++ b/patches/cve/CVE-2017-17448-netfilter-nfnetlink_cthelper-Add-missing-permission-.patch
@@ -0,0 +1,86 @@
1From 671624872144abc37bc5e8f3b27987890f6e87f3 Mon Sep 17 00:00:00 2001
2From: Kevin Cernekee <cernekee@chromium.org>
3Date: Sun, 3 Dec 2017 12:12:45 -0800
4Subject: [PATCH] netfilter: nfnetlink_cthelper: Add missing permission checks
5
6commit 4b380c42f7d00a395feede754f0bc2292eebe6e5 upstream.
7
8The capability check in nfnetlink_rcv() verifies that the caller
9has CAP_NET_ADMIN in the namespace that "owns" the netlink socket.
10However, nfnl_cthelper_list is shared by all net namespaces on the
11system. An unprivileged user can create user and net namespaces
12in which he holds CAP_NET_ADMIN to bypass the netlink_net_capable()
13check:
14
15 $ nfct helper list
16 nfct v1.4.4: netlink error: Operation not permitted
17 $ vpnns -- nfct helper list
18 {
19 .name = ftp,
20 .queuenum = 0,
21 .l3protonum = 2,
22 .l4protonum = 6,
23 .priv_data_len = 24,
24 .status = enabled,
25 };
26
27Add capable() checks in nfnetlink_cthelper, as this is cleaner than
28trying to generalize the solution.
29
30CVE: CVE-2017-17448
31Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.14.y&id=671624872144abc37bc5e8f3b27987890f6e87f3]
32
33Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
34Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
35Acked-by: Michal Kubecek <mkubecek@suse.cz>
36Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
37Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
38---
39 net/netfilter/nfnetlink_cthelper.c | 10 ++++++++++
40 1 file changed, 10 insertions(+)
41
42diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c
43index 41628b393673..d33ce6d5ebce 100644
44--- a/net/netfilter/nfnetlink_cthelper.c
45+++ b/net/netfilter/nfnetlink_cthelper.c
46@@ -17,6 +17,7 @@
47 #include <linux/types.h>
48 #include <linux/list.h>
49 #include <linux/errno.h>
50+#include <linux/capability.h>
51 #include <net/netlink.h>
52 #include <net/sock.h>
53
54@@ -407,6 +408,9 @@ static int nfnl_cthelper_new(struct net *net, struct sock *nfnl,
55 struct nfnl_cthelper *nlcth;
56 int ret = 0;
57
58+ if (!capable(CAP_NET_ADMIN))
59+ return -EPERM;
60+
61 if (!tb[NFCTH_NAME] || !tb[NFCTH_TUPLE])
62 return -EINVAL;
63
64@@ -611,6 +615,9 @@ static int nfnl_cthelper_get(struct net *net, struct sock *nfnl,
65 struct nfnl_cthelper *nlcth;
66 bool tuple_set = false;
67
68+ if (!capable(CAP_NET_ADMIN))
69+ return -EPERM;
70+
71 if (nlh->nlmsg_flags & NLM_F_DUMP) {
72 struct netlink_dump_control c = {
73 .dump = nfnl_cthelper_dump_table,
74@@ -678,6 +685,9 @@ static int nfnl_cthelper_del(struct net *net, struct sock *nfnl,
75 struct nfnl_cthelper *nlcth, *n;
76 int j = 0, ret;
77
78+ if (!capable(CAP_NET_ADMIN))
79+ return -EPERM;
80+
81 if (tb[NFCTH_NAME])
82 helper_name = nla_data(tb[NFCTH_NAME]);
83
84--
852.20.1
86