diff options
| -rw-r--r-- | patches/cve/4.9.x.scc | 1 | ||||
| -rw-r--r-- | patches/cve/CVE-2018-1068-netfilter-ebtables-CONFIG_COMPAT-don-t-trust-userlan.patch | 62 |
2 files changed, 63 insertions, 0 deletions
diff --git a/patches/cve/4.9.x.scc b/patches/cve/4.9.x.scc index fd6f5c7..51591c7 100644 --- a/patches/cve/4.9.x.scc +++ b/patches/cve/4.9.x.scc | |||
| @@ -4,3 +4,4 @@ patch CVE-2017-8824-dccp-CVE-2017-8824-use-after-free-in-DCCP-code.patch | |||
| 4 | 4 | ||
| 5 | #CVEs fixed in 4.9.88: | 5 | #CVEs fixed in 4.9.88: |
| 6 | patch CVE-2018-1065-netfilter-add-back-stackpointer-size-checks.patch | 6 | patch CVE-2018-1065-netfilter-add-back-stackpointer-size-checks.patch |
| 7 | patch CVE-2018-1068-netfilter-ebtables-CONFIG_COMPAT-don-t-trust-userlan.patch | ||
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..7723764 --- /dev/null +++ b/patches/cve/CVE-2018-1068-netfilter-ebtables-CONFIG_COMPAT-don-t-trust-userlan.patch | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | From b71812168571fa55e44cdd0254471331b9c4c4c6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Florian Westphal <fw@strlen.de> | ||
| 3 | Date: Mon, 19 Feb 2018 01:24:15 +0100 | ||
| 4 | Subject: [PATCH] netfilter: ebtables: CONFIG_COMPAT: don't trust userland | ||
| 5 | offsets | ||
| 6 | |||
| 7 | We need to make sure the offsets are not out of range of the | ||
| 8 | total size. | ||
| 9 | Also check that they are in ascending order. | ||
| 10 | |||
| 11 | The WARN_ON triggered by syzkaller (it sets panic_on_warn) is | ||
| 12 | changed to also bail out, no point in continuing parsing. | ||
| 13 | |||
| 14 | Briefly tested with simple ruleset of | ||
| 15 | -A INPUT --limit 1/s' --log | ||
| 16 | plus jump to custom chains using 32bit ebtables binary. | ||
| 17 | |||
| 18 | CVE: CVE-2018-1068 | ||
| 19 | Upstream-Status: Backport | ||
| 20 | |||
| 21 | Reported-by: <syzbot+845a53d13171abf8bf29@syzkaller.appspotmail.com> | ||
| 22 | Signed-off-by: Florian Westphal <fw@strlen.de> | ||
| 23 | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> | ||
| 24 | Signed-off-by: Andreas Wellving <andreas.wellving@enea.com> | ||
| 25 | --- | ||
| 26 | net/bridge/netfilter/ebtables.c | 13 ++++++++++++- | ||
| 27 | 1 file changed, 12 insertions(+), 1 deletion(-) | ||
| 28 | |||
| 29 | diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c | ||
| 30 | index 61f8787..254ef9f 100644 | ||
| 31 | --- a/net/bridge/netfilter/ebtables.c | ||
| 32 | +++ b/net/bridge/netfilter/ebtables.c | ||
| 33 | @@ -2060,7 +2060,9 @@ static int ebt_size_mwt(struct compat_ebt_entry_mwt *match32, | ||
| 34 | if (match_kern) | ||
| 35 | match_kern->match_size = ret; | ||
| 36 | |||
| 37 | - WARN_ON(type == EBT_COMPAT_TARGET && size_left); | ||
| 38 | + if (WARN_ON(type == EBT_COMPAT_TARGET && size_left)) | ||
| 39 | + return -EINVAL; | ||
| 40 | + | ||
| 41 | match32 = (struct compat_ebt_entry_mwt *) buf; | ||
| 42 | } | ||
| 43 | |||
| 44 | @@ -2116,6 +2118,15 @@ static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base, | ||
| 45 | * | ||
| 46 | * offsets are relative to beginning of struct ebt_entry (i.e., 0). | ||
| 47 | */ | ||
| 48 | + for (i = 0; i < 4 ; ++i) { | ||
| 49 | + if (offsets[i] >= *total) | ||
| 50 | + return -EINVAL; | ||
| 51 | + if (i == 0) | ||
| 52 | + continue; | ||
| 53 | + if (offsets[i-1] > offsets[i]) | ||
| 54 | + return -EINVAL; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | for (i = 0, j = 1 ; j < 4 ; j++, i++) { | ||
| 58 | struct compat_ebt_entry_mwt *match32; | ||
| 59 | unsigned int size; | ||
| 60 | -- | ||
| 61 | |||
| 62 | |||
