|
|
ad1123 |
From: Joel Savitz <jsavitz@redhat.com>
|
|
|
ad1123 |
Subject: [KPATCH 7.9] netfilter: x_tables: kpatch fixes for CVE-2021-22555
|
|
|
ad1123 |
Date: Wed, 28 Jul 2021 12:03:15 -0400
|
|
|
ad1123 |
|
|
|
ad1123 |
Kernels:
|
|
|
ad1123 |
3.10.0-1160.el7
|
|
|
ad1123 |
3.10.0-1160.2.1.el7
|
|
|
ad1123 |
3.10.0-1160.2.2.el7
|
|
|
ad1123 |
3.10.0-1160.6.1.el7
|
|
|
ad1123 |
3.10.0-1160.11.1.el7
|
|
|
ad1123 |
3.10.0-1160.15.2.el7
|
|
|
ad1123 |
3.10.0-1160.21.1.el7
|
|
|
ad1123 |
3.10.0-1160.24.1.el7
|
|
|
ad1123 |
3.10.0-1160.25.1.el7
|
|
|
ad1123 |
3.10.0-1160.31.1.el7
|
|
|
ad1123 |
3.10.0-1160.36.2.el7
|
|
|
ad1123 |
|
|
|
ad1123 |
Changes since last build:
|
|
|
ad1123 |
arches: x86_64 ppc64le
|
|
|
ad1123 |
arp_tables.o: changed function: translate_compat_table
|
|
|
ad1123 |
ip6_tables.o: changed function: translate_compat_table
|
|
|
ad1123 |
ip_tables.o: changed function: translate_compat_table
|
|
|
ad1123 |
x_tables.o: changed function: xt_compat_match_from_user
|
|
|
ad1123 |
x_tables.o: changed function: xt_compat_target_from_user
|
|
|
ad1123 |
---------------------------
|
|
|
ad1123 |
|
|
|
ad1123 |
Kernels:
|
|
|
ad1123 |
3.10.0-1160.el7
|
|
|
ad1123 |
3.10.0-1160.2.1.el7
|
|
|
ad1123 |
3.10.0-1160.2.2.el7
|
|
|
ad1123 |
3.10.0-1160.6.1.el7
|
|
|
ad1123 |
3.10.0-1160.11.1.el7
|
|
|
ad1123 |
3.10.0-1160.15.2.el7
|
|
|
ad1123 |
3.10.0-1160.21.1.el7
|
|
|
ad1123 |
3.10.0-1160.24.1.el7
|
|
|
ad1123 |
3.10.0-1160.25.1.el7
|
|
|
ad1123 |
3.10.0-1160.31.1.el7
|
|
|
ad1123 |
3.10.0-1160.36.2.el7
|
|
|
ad1123 |
|
|
|
ad1123 |
Modifications: none
|
|
|
ad1123 |
|
|
|
ad1123 |
Z-MR: https://gitlab.com/redhat/rhel/src/kernel/rhel-7/-/merge_requests/201
|
|
|
ad1123 |
KT0 test PASS: https://beaker.engineering.redhat.com/jobs/5642298
|
|
|
ad1123 |
for scratch build: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=38448253
|
|
|
ad1123 |
|
|
|
ad1123 |
commit 06215319786b979bed0f5eb3138de0506db9d39f
|
|
|
ad1123 |
Author: Florian Westphal <fwestpha@redhat.com>
|
|
|
ad1123 |
Date: Fri Jul 9 11:42:55 2021 +0200
|
|
|
ad1123 |
|
|
|
ad1123 |
netfilter: x_tables: fix compat match/target pad out-of-bound write
|
|
|
ad1123 |
|
|
|
ad1123 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1980489
|
|
|
ad1123 |
Upstream Status: commit b29c457a65114
|
|
|
ad1123 |
CVE: CVE-2021-22555
|
|
|
ad1123 |
|
|
|
ad1123 |
commit b29c457a6511435960115c0f548c4360d5f4801d
|
|
|
ad1123 |
Author: Florian Westphal <fw@strlen.de>
|
|
|
ad1123 |
Date: Wed Apr 7 21:38:57 2021 +0200
|
|
|
ad1123 |
|
|
|
ad1123 |
netfilter: x_tables: fix compat match/target pad out-of-bound write
|
|
|
ad1123 |
|
|
|
ad1123 |
xt_compat_match/target_from_user doesn't check that zeroing the area
|
|
|
ad1123 |
to start of next rule won't write past end of allocated ruleset blob.
|
|
|
ad1123 |
|
|
|
ad1123 |
Remove this code and zero the entire blob beforehand.
|
|
|
ad1123 |
|
|
|
ad1123 |
Reported-by: syzbot+cfc0247ac173f597aaaa@syzkaller.appspotmail.com
|
|
|
ad1123 |
Reported-by: Andy Nguyen <theflow@google.com>
|
|
|
ad1123 |
Fixes: 9fa492cdc160c ("[NETFILTER]: x_tables: simplify compat API")
|
|
|
ad1123 |
Signed-off-by: Florian Westphal <fw@strlen.de>
|
|
|
ad1123 |
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
ad1123 |
|
|
|
ad1123 |
Signed-off-by: Florian Westphal <fwestpha@redhat.com>
|
|
|
ad1123 |
|
|
|
ad1123 |
Signed-off-by: Joel Savitz <jsavitz@redhat.com>
|
|
|
ad1123 |
Acked-by: Joe Lawrence <joe.lawrence@redhat.com>
|
|
|
ad1123 |
Acked-by: Artem Savkov <asavkov@redhat.com>
|
|
|
ad1123 |
Acked-by: Yannick Cote <ycote@redhat.com>
|
|
|
ad1123 |
---
|
|
|
ad1123 |
net/ipv4/netfilter/arp_tables.c | 2 ++
|
|
|
ad1123 |
net/ipv4/netfilter/ip_tables.c | 2 ++
|
|
|
ad1123 |
net/ipv6/netfilter/ip6_tables.c | 2 ++
|
|
|
ad1123 |
net/netfilter/x_tables.c | 10 ++--------
|
|
|
ad1123 |
4 files changed, 8 insertions(+), 8 deletions(-)
|
|
|
ad1123 |
|
|
|
ad1123 |
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
|
|
|
ad1123 |
index 602d92697038..66ad3b4e194c 100644
|
|
|
ad1123 |
--- a/net/ipv4/netfilter/arp_tables.c
|
|
|
ad1123 |
+++ b/net/ipv4/netfilter/arp_tables.c
|
|
|
ad1123 |
@@ -1364,6 +1364,8 @@ static int translate_compat_table(struct xt_table_info **pinfo,
|
|
|
ad1123 |
if (!newinfo)
|
|
|
ad1123 |
goto out_unlock;
|
|
|
ad1123 |
|
|
|
ad1123 |
+ memset(newinfo->entries, 0, size);
|
|
|
ad1123 |
+
|
|
|
ad1123 |
newinfo->number = compatr->num_entries;
|
|
|
ad1123 |
for (i = 0; i < NF_ARP_NUMHOOKS; i++) {
|
|
|
ad1123 |
newinfo->hook_entry[i] = info->hook_entry[i];
|
|
|
ad1123 |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
|
|
|
ad1123 |
index 3559f7ffa430..d9de653be67e 100644
|
|
|
ad1123 |
--- a/net/ipv4/netfilter/ip_tables.c
|
|
|
ad1123 |
+++ b/net/ipv4/netfilter/ip_tables.c
|
|
|
ad1123 |
@@ -1622,6 +1622,8 @@ translate_compat_table(struct net *net,
|
|
|
ad1123 |
if (!newinfo)
|
|
|
ad1123 |
goto out_unlock;
|
|
|
ad1123 |
|
|
|
ad1123 |
+ memset(newinfo->entries, 0, size);
|
|
|
ad1123 |
+
|
|
|
ad1123 |
newinfo->number = compatr->num_entries;
|
|
|
ad1123 |
for (i = 0; i < NF_INET_NUMHOOKS; i++) {
|
|
|
ad1123 |
newinfo->hook_entry[i] = compatr->hook_entry[i];
|
|
|
ad1123 |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
|
|
|
ad1123 |
index 1772a1797e79..d112bfc86aac 100644
|
|
|
ad1123 |
--- a/net/ipv6/netfilter/ip6_tables.c
|
|
|
ad1123 |
+++ b/net/ipv6/netfilter/ip6_tables.c
|
|
|
ad1123 |
@@ -1626,6 +1626,8 @@ translate_compat_table(struct net *net,
|
|
|
ad1123 |
if (!newinfo)
|
|
|
ad1123 |
goto out_unlock;
|
|
|
ad1123 |
|
|
|
ad1123 |
+ memset(newinfo->entries, 0, size);
|
|
|
ad1123 |
+
|
|
|
ad1123 |
newinfo->number = compatr->num_entries;
|
|
|
ad1123 |
for (i = 0; i < NF_INET_NUMHOOKS; i++) {
|
|
|
ad1123 |
newinfo->hook_entry[i] = compatr->hook_entry[i];
|
|
|
ad1123 |
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
|
|
|
ad1123 |
index 76e40ff48b10..affd08ce7df8 100644
|
|
|
ad1123 |
--- a/net/netfilter/x_tables.c
|
|
|
ad1123 |
+++ b/net/netfilter/x_tables.c
|
|
|
ad1123 |
@@ -564,7 +564,7 @@ void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
|
|
|
ad1123 |
{
|
|
|
ad1123 |
const struct xt_match *match = m->u.kernel.match;
|
|
|
ad1123 |
struct compat_xt_entry_match *cm = (struct compat_xt_entry_match *)m;
|
|
|
ad1123 |
- int pad, off = xt_compat_match_offset(match);
|
|
|
ad1123 |
+ int off = xt_compat_match_offset(match);
|
|
|
ad1123 |
u_int16_t msize = cm->u.user.match_size;
|
|
|
ad1123 |
char name[sizeof(m->u.user.name)];
|
|
|
ad1123 |
|
|
|
ad1123 |
@@ -574,9 +574,6 @@ void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
|
|
|
ad1123 |
match->compat_from_user(m->data, cm->data);
|
|
|
ad1123 |
else
|
|
|
ad1123 |
memcpy(m->data, cm->data, msize - sizeof(*cm));
|
|
|
ad1123 |
- pad = XT_ALIGN(match->matchsize) - match->matchsize;
|
|
|
ad1123 |
- if (pad > 0)
|
|
|
ad1123 |
- memset(m->data + match->matchsize, 0, pad);
|
|
|
ad1123 |
|
|
|
ad1123 |
msize += off;
|
|
|
ad1123 |
m->u.user.match_size = msize;
|
|
|
ad1123 |
@@ -913,7 +910,7 @@ void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr,
|
|
|
ad1123 |
{
|
|
|
ad1123 |
const struct xt_target *target = t->u.kernel.target;
|
|
|
ad1123 |
struct compat_xt_entry_target *ct = (struct compat_xt_entry_target *)t;
|
|
|
ad1123 |
- int pad, off = xt_compat_target_offset(target);
|
|
|
ad1123 |
+ int off = xt_compat_target_offset(target);
|
|
|
ad1123 |
u_int16_t tsize = ct->u.user.target_size;
|
|
|
ad1123 |
char name[sizeof(t->u.user.name)];
|
|
|
ad1123 |
|
|
|
ad1123 |
@@ -923,9 +920,6 @@ void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr,
|
|
|
ad1123 |
target->compat_from_user(t->data, ct->data);
|
|
|
ad1123 |
else
|
|
|
ad1123 |
memcpy(t->data, ct->data, tsize - sizeof(*ct));
|
|
|
ad1123 |
- pad = XT_ALIGN(target->targetsize) - target->targetsize;
|
|
|
ad1123 |
- if (pad > 0)
|
|
|
ad1123 |
- memset(t->data + target->targetsize, 0, pad);
|
|
|
ad1123 |
|
|
|
ad1123 |
tsize += off;
|
|
|
ad1123 |
t->u.user.target_size = tsize;
|
|
|
ad1123 |
--
|
|
|
ad1123 |
2.27.0
|
|
|
ad1123 |
|
|
|
ad1123 |
|