Commit e25c7a75 authored by Wander Lairson Costa's avatar Wander Lairson Costa Committed by Liu Jian
Browse files

netfilter: nfnetlink_osf: avoid OOB read

stable inclusion
from stable-v5.10.195
commit 780f60dde29692c42091602fee9c25e9e391f3dc
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I86MTP
CVE: CVE-2023-39189

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=780f60dde29692c42091602fee9c25e9e391f3dc



---------------------------

[ Upstream commit f4f8a780 ]

The opt_num field is controlled by user mode and is not currently
validated inside the kernel. An attacker can take advantage of this to
trigger an OOB read and potentially leak information.

BUG: KASAN: slab-out-of-bounds in nf_osf_match_one+0xbed/0xd10 net/netfilter/nfnetlink_osf.c:88
Read of size 2 at addr ffff88804bc64272 by task poc/6431

CPU: 1 PID: 6431 Comm: poc Not tainted 6.0.0-rc4 #1
Call Trace:
 nf_osf_match_one+0xbed/0xd10 net/netfilter/nfnetlink_osf.c:88
 nf_osf_find+0x186/0x2f0 net/netfilter/nfnetlink_osf.c:281
 nft_osf_eval+0x37f/0x590 net/netfilter/nft_osf.c:47
 expr_call_ops_eval net/netfilter/nf_tables_core.c:214
 nft_do_chain+0x2b0/0x1490 net/netfilter/nf_tables_core.c:264
 nft_do_chain_ipv4+0x17c/0x1f0 net/netfilter/nft_chain_filter.c:23
 [..]

Also add validation to genre, subtype and version fields.

Fixes: 11eeef41 ("netfilter: passive OS fingerprint xtables match")
Reported-by: default avatarLucas Leong <wmliang@infosec.exchange>
Signed-off-by: default avatarWander Lairson Costa <wander@redhat.com>
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarLiu Jian <liujian56@huawei.com>
parent 22cb1432
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment