Commit fb82489
committed
netfilter: nft_set_pipapo: fix improper element removal
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2225277
Upstream Status: commit 87b5a5c
CVE: CVE-2023-4004
commit 87b5a5c
Author: Florian Westphal <[email protected]>
Date: Wed Jul 19 21:08:21 2023 +0200
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: 3c4287f ("nf_tables: Add set type for arbitrary concatenation of ranges")
Reported-by: lonial con <[email protected]>
Reviewed-by: Stefano Brivio <[email protected]>
Signed-off-by: Florian Westphal <[email protected]>
Signed-off-by: Phil Sutter <[email protected]>1 parent 0a772d5 commit fb82489
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1908 | 1908 | | |
1909 | 1909 | | |
1910 | 1910 | | |
1911 | | - | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
1912 | 1916 | | |
1913 | 1917 | | |
1914 | 1918 | | |
| |||
0 commit comments