diff options
author | Andreas Wellving <andreas.wellving@enea.com> | 2019-05-21 15:51:30 +0200 |
---|---|---|
committer | Adrian Mangeac <Adrian.Mangeac@enea.com> | 2019-05-21 17:25:02 +0200 |
commit | 746a703f7ca5294893c4071d707d07da388f4ffd (patch) | |
tree | b19ff454f77078bcd1e74119bbee9e17e2be4cae | |
parent | 6c89eabc04466ab2e6caf65a227f3a91837fcb5e (diff) | |
download | enea-kernel-cache-746a703f7ca5294893c4071d707d07da388f4ffd.tar.gz |
netfilter: CVE-2017-17448
netfilter: nfnetlink_cthelper: Add missing permission checks
Reference:
https://nvd.nist.gov/vuln/detail/CVE-2017-17448
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.14.y&id=671624872144abc37bc5e8f3b27987890f6e87f3
Change-Id: I0c5a268e8eebe939c25c22930afb2e98279bdbab
Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
-rw-r--r-- | patches/cve/CVE-2017-17448-netfilter-nfnetlink_cthelper-Add-missing-permission-.patch | 86 |
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 @@ | |||
1 | From 671624872144abc37bc5e8f3b27987890f6e87f3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Kevin Cernekee <cernekee@chromium.org> | ||
3 | Date: Sun, 3 Dec 2017 12:12:45 -0800 | ||
4 | Subject: [PATCH] netfilter: nfnetlink_cthelper: Add missing permission checks | ||
5 | |||
6 | commit 4b380c42f7d00a395feede754f0bc2292eebe6e5 upstream. | ||
7 | |||
8 | The capability check in nfnetlink_rcv() verifies that the caller | ||
9 | has CAP_NET_ADMIN in the namespace that "owns" the netlink socket. | ||
10 | However, nfnl_cthelper_list is shared by all net namespaces on the | ||
11 | system. An unprivileged user can create user and net namespaces | ||
12 | in which he holds CAP_NET_ADMIN to bypass the netlink_net_capable() | ||
13 | check: | ||
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 | |||
27 | Add capable() checks in nfnetlink_cthelper, as this is cleaner than | ||
28 | trying to generalize the solution. | ||
29 | |||
30 | CVE: CVE-2017-17448 | ||
31 | Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.14.y&id=671624872144abc37bc5e8f3b27987890f6e87f3] | ||
32 | |||
33 | Signed-off-by: Kevin Cernekee <cernekee@chromium.org> | ||
34 | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> | ||
35 | Acked-by: Michal Kubecek <mkubecek@suse.cz> | ||
36 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | ||
37 | Signed-off-by: Andreas Wellving <andreas.wellving@enea.com> | ||
38 | --- | ||
39 | net/netfilter/nfnetlink_cthelper.c | 10 ++++++++++ | ||
40 | 1 file changed, 10 insertions(+) | ||
41 | |||
42 | diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c | ||
43 | index 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 | -- | ||
85 | 2.20.1 | ||
86 | |||