Commit d01855f3 authored by Florian Westphal's avatar Florian Westphal Committed by Dong Chenchen
Browse files

netfilter: nf_tables: reject QUEUE/DROP verdict parameters

mainline inclusion
from mainline-v6.8-rc2
commit f342de4e2f33e0e39165d8639387aa6c19dff660
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I90B2K
CVE: CVE-2024-1086

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f342de4e2f33e0e39165d8639387aa6c19dff660



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

This reverts commit e0abdadc.

core.c:nf_hook_slow assumes that the upper 16 bits of NF_DROP
verdicts contain a valid errno, i.e. -EPERM, -EHOSTUNREACH or similar,
or 0.

Due to the reverted commit, its possible to provide a positive
value, e.g. NF_ACCEPT (1), which results in use-after-free.

Its not clear to me why this commit was made.

NF_QUEUE is not used by nftables; "queue" rules in nftables
will result in use of "nft_queue" expression.

If we later need to allow specifiying errno values from userspace
(do not know why), this has to call NF_DROP_GETERR and check that
"err <= 0" holds true.

Fixes: e0abdadc ("netfilter: nf_tables: accept QUEUE/DROP verdict parameters")
Cc: stable@vger.kernel.org
Reported-by: default avatarNotselwyn <notselwyn@pwning.tech>
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>

Conflicts:
	net/netfilter/nf_tables_api.c

Signed-off-by: default avatarDong Chenchen <dongchenchen2@huawei.com>
parent 5bc2c7cb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment