diff options
author | Florian Westphal <fw@strlen.de> | 2023-07-19 21:08:21 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2023-07-20 12:27:34 +0200 |
commit | 87b5a5c209405cb6b57424cdfa226a6dbd349232 (patch) | |
tree | 4f8252af84f6e9c441ee396a1284c4b4591da588 /net/socket.c | |
parent | 314c82841602a111c04a7210c21dc77e0d560242 (diff) | |
download | linux-stable-87b5a5c209405cb6b57424cdfa226a6dbd349232.tar.gz linux-stable-87b5a5c209405cb6b57424cdfa226a6dbd349232.tar.bz2 linux-stable-87b5a5c209405cb6b57424cdfa226a6dbd349232.zip |
netfilter: nft_set_pipapo: fix improper element removal
end key should be equal to start unless NFT_SET_EXT_KEY_END is present.
Its possible to add elements that only have a start key
("{ 1.0.0.0 . 2.0.0.0 }") without an internval end.
Insertion treats this via:
if (nft_set_ext_exists(ext, NFT_SET_EXT_KEY_END))
end = (const u8 *)nft_set_ext_key_end(ext)->data;
else
end = start;
but removal side always uses nft_set_ext_key_end().
This is wrong and leads to garbage remaining in the set after removal
next lookup/insert attempt will give:
BUG: KASAN: slab-use-after-free in pipapo_get+0x8eb/0xb90
Read of size 1 at addr ffff888100d50586 by task nft-pipapo_uaf_/1399
Call Trace:
kasan_report+0x105/0x140
pipapo_get+0x8eb/0xb90
nft_pipapo_insert+0x1dc/0x1710
nf_tables_newsetelem+0x31f5/0x4e00
..
Fixes: 3c4287f62044 ("nf_tables: Add set type for arbitrary concatenation of ranges")
Reported-by: lonial con <kongln9170@gmail.com>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'net/socket.c')
0 files changed, 0 insertions, 0 deletions