]> git.itanic.dy.fi Git - linux-stable/commit
netfilter: nf_tables: reject QUEUE/DROP verdict parameters
authorFlorian Westphal <fw@strlen.de>
Sat, 20 Jan 2024 21:50:04 +0000 (22:50 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 24 Jan 2024 19:02:39 +0000 (20:02 +0100)
commitf342de4e2f33e0e39165d8639387aa6c19dff660
tree1c2ffb712170efefbf421192b3a73bf17526524e
parentb462579b2b86a8f5230543cadd3a4836be27baf7
netfilter: nf_tables: reject QUEUE/DROP verdict parameters

This reverts commit e0abdadcc6e1.

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: e0abdadcc6e1 ("netfilter: nf_tables: accept QUEUE/DROP verdict parameters")
Cc: stable@vger.kernel.org
Reported-by: Notselwyn <notselwyn@pwning.tech>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c