summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Wellving <andreas.wellving@enea.com>2019-05-21 16:42:42 +0200
committerAdrian Mangeac <Adrian.Mangeac@enea.com>2019-05-22 10:09:48 +0200
commitcbe6c19507c9b0706413e0cd0446a69a703ba0e7 (patch)
tree88f969a82fabd6538fe600c3d2148ebb6a267a4b
parent1f4f2d504a82f7868c473800cf710ae15c3a3840 (diff)
downloadenea-kernel-cache-cbe6c19507c9b0706413e0cd0446a69a703ba0e7.tar.gz
netfilter: CVE-2018-1068
netfilter: ebtables: CONFIG_COMPAT: don't trust userland Reference: https://nvd.nist.gov/vuln/detail/CVE-2018-1068 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.14.y&id=eaa06bfba8eabd44ce952758046492eebc973bbe Change-Id: I3773b4d4b302614d928989b6ca6df2423e3c41db Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
-rw-r--r--patches/cve/CVE-2018-1068-netfilter-ebtables-CONFIG_COMPAT-don-t-trust-userlan.patch65
1 files changed, 65 insertions, 0 deletions
diff --git a/patches/cve/CVE-2018-1068-netfilter-ebtables-CONFIG_COMPAT-don-t-trust-userlan.patch b/patches/cve/CVE-2018-1068-netfilter-ebtables-CONFIG_COMPAT-don-t-trust-userlan.patch
new file mode 100644
index 0000000..041f71c
--- /dev/null
+++ b/patches/cve/CVE-2018-1068-netfilter-ebtables-CONFIG_COMPAT-don-t-trust-userlan.patch
@@ -0,0 +1,65 @@
1From eaa06bfba8eabd44ce952758046492eebc973bbe Mon Sep 17 00:00:00 2001
2From: Florian Westphal <fw@strlen.de>
3Date: Mon, 19 Feb 2018 01:24:15 +0100
4Subject: [PATCH] netfilter: ebtables: CONFIG_COMPAT: don't trust userland
5 offsets
6
7commit b71812168571fa55e44cdd0254471331b9c4c4c6 upstream.
8
9We need to make sure the offsets are not out of range of the
10total size.
11Also check that they are in ascending order.
12
13The WARN_ON triggered by syzkaller (it sets panic_on_warn) is
14changed to also bail out, no point in continuing parsing.
15
16Briefly tested with simple ruleset of
17-A INPUT --limit 1/s' --log
18plus jump to custom chains using 32bit ebtables binary.
19
20CVE: CVE-2018-1068
21Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.14.y&id=eaa06bfba8eabd44ce952758046492eebc973bbe]
22
23Reported-by: <syzbot+845a53d13171abf8bf29@syzkaller.appspotmail.com>
24Signed-off-by: Florian Westphal <fw@strlen.de>
25Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
26Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
28---
29 net/bridge/netfilter/ebtables.c | 13 ++++++++++++-
30 1 file changed, 12 insertions(+), 1 deletion(-)
31
32diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
33index 3b3dcf719e07..16eb99458df4 100644
34--- a/net/bridge/netfilter/ebtables.c
35+++ b/net/bridge/netfilter/ebtables.c
36@@ -2053,7 +2053,9 @@ static int ebt_size_mwt(struct compat_ebt_entry_mwt *match32,
37 if (match_kern)
38 match_kern->match_size = ret;
39
40- WARN_ON(type == EBT_COMPAT_TARGET && size_left);
41+ if (WARN_ON(type == EBT_COMPAT_TARGET && size_left))
42+ return -EINVAL;
43+
44 match32 = (struct compat_ebt_entry_mwt *) buf;
45 }
46
47@@ -2109,6 +2111,15 @@ static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base,
48 *
49 * offsets are relative to beginning of struct ebt_entry (i.e., 0).
50 */
51+ for (i = 0; i < 4 ; ++i) {
52+ if (offsets[i] >= *total)
53+ return -EINVAL;
54+ if (i == 0)
55+ continue;
56+ if (offsets[i-1] > offsets[i])
57+ return -EINVAL;
58+ }
59+
60 for (i = 0, j = 1 ; j < 4 ; j++, i++) {
61 struct compat_ebt_entry_mwt *match32;
62 unsigned int size;
63--
642.20.1
65