Commit eabcf73
committed
netfilter: nft_set_pipapo: fix improper element removal
jira LE-1907
cve CVE-2023-4004
Rebuild_History Non-Buildable kernel-5.14.0-284.30.1.el9_2
commit-author Florian Westphal <[email protected]>
commit 87b5a5c
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]>
(cherry picked from commit 87b5a5c)
Signed-off-by: Jonathan Maple <[email protected]>1 parent 787a649 commit eabcf73
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