mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
netfilter: nf_tables: reject QUEUE/DROP verdict parameters
commitf342de4e2f
upstream. This reverts commite0abdadcc6
. 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:e0abdadcc6
("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e5888acbf1
commit
6653118b17
1 changed files with 6 additions and 10 deletions
|
@ -10871,16 +10871,10 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,
|
||||||
data->verdict.code = ntohl(nla_get_be32(tb[NFTA_VERDICT_CODE]));
|
data->verdict.code = ntohl(nla_get_be32(tb[NFTA_VERDICT_CODE]));
|
||||||
|
|
||||||
switch (data->verdict.code) {
|
switch (data->verdict.code) {
|
||||||
default:
|
case NF_ACCEPT:
|
||||||
switch (data->verdict.code & NF_VERDICT_MASK) {
|
case NF_DROP:
|
||||||
case NF_ACCEPT:
|
case NF_QUEUE:
|
||||||
case NF_DROP:
|
break;
|
||||||
case NF_QUEUE:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
fallthrough;
|
|
||||||
case NFT_CONTINUE:
|
case NFT_CONTINUE:
|
||||||
case NFT_BREAK:
|
case NFT_BREAK:
|
||||||
case NFT_RETURN:
|
case NFT_RETURN:
|
||||||
|
@ -10915,6 +10909,8 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,
|
||||||
|
|
||||||
data->verdict.chain = chain;
|
data->verdict.chain = chain;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
desc->len = sizeof(data->verdict);
|
desc->len = sizeof(data->verdict);
|
||||||
|
|
Loading…
Reference in a new issue