Skip to content

Commit 2ad5c3e

Browse files
committed
netfilter: nft_ct: fix l3num expectations with inet pseudo family
CVE: CVE-2024-26673 JIRA: https://issues.redhat.com/browse/RHEL-31345 Upstream Status: commit 9999378 commit 9999378 Author: Florian Westphal <fw@strlen.de> Date: Fri Mar 1 13:38:15 2024 +0100 netfilter: nft_ct: fix l3num expectations with inet pseudo family Following is rejected but should be allowed: table inet t { ct expectation exp1 { [..] l3proto ip Valid combos are: table ip t, l3proto ip table ip6 t, l3proto ip6 table inet t, l3proto ip OR l3proto ip6 Disallow inet pseudeo family, the l3num must be a on-wire protocol known to conntrack. Retain NFPROTO_INET case to make it clear its rejected intentionally rather as oversight. Fixes: 8059918 ("netfilter: nft_ct: sanitize layer 3 and 4 protocol number in custom expectations") Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Phil Sutter <psutter@redhat.com>
1 parent 30b009d commit 2ad5c3e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

net/netfilter/nft_ct.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,14 +1193,13 @@ static int nft_ct_expect_obj_init(const struct nft_ctx *ctx,
11931193
switch (priv->l3num) {
11941194
case NFPROTO_IPV4:
11951195
case NFPROTO_IPV6:
1196-
if (priv->l3num != ctx->family)
1197-
return -EINVAL;
1196+
if (priv->l3num == ctx->family || ctx->family == NFPROTO_INET)
1197+
break;
11981198

1199-
fallthrough;
1200-
case NFPROTO_INET:
1201-
break;
1199+
return -EINVAL;
1200+
case NFPROTO_INET: /* tuple.src.l3num supports NFPROTO_IPV4/6 only */
12021201
default:
1203-
return -EOPNOTSUPP;
1202+
return -EAFNOSUPPORT;
12041203
}
12051204

12061205
priv->l4proto = nla_get_u8(tb[NFTA_CT_EXPECT_L4PROTO]);

0 commit comments

Comments
 (0)