Commit 1f63a4b
committed
netfilter: nftables: exthdr: fix 4-byte stack OOB write
jira VULN-8151
cve CVE-2023-52628
commit-author Florian Westphal <fw@strlen.de>
commit fd94d9d
If priv->len is a multiple of 4, then dst[len / 4] can write past
the destination array which leads to stack corruption.
This construct is necessary to clean the remainder of the register
in case ->len is NOT a multiple of the register size, so make it
conditional just like nft_payload.c does.
The bug was added in 4.1 cycle and then copied/inherited when
tcp/sctp and ip option support was added.
Bug reported by Zero Day Initiative project (ZDI-CAN-21950,
ZDI-CAN-21951, ZDI-CAN-21961).
Fixes: 49499c3 ("netfilter: nf_tables: switch registers to 32 bit addressing")
Fixes: 935b7f6 ("netfilter: nft_exthdr: add TCP option matching")
Fixes: 133dc20 ("netfilter: nft_exthdr: Support SCTP chunks")
Fixes: dbb5281 ("netfilter: nf_tables: add support for matching IPv4 options")
Signed-off-by: Florian Westphal <fw@strlen.de>
(cherry picked from commit fd94d9d)
Signed-off-by: Brett Mastbergen <bmastbergen@ciq.com>1 parent c2fde08 commit 1f63a4b
1 file changed
+14
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
38 | 46 | | |
39 | 47 | | |
40 | 48 | | |
| |||
56 | 64 | | |
57 | 65 | | |
58 | 66 | | |
59 | | - | |
60 | | - | |
| 67 | + | |
61 | 68 | | |
62 | 69 | | |
63 | 70 | | |
| |||
153 | 160 | | |
154 | 161 | | |
155 | 162 | | |
156 | | - | |
157 | | - | |
| 163 | + | |
158 | 164 | | |
159 | 165 | | |
160 | 166 | | |
| |||
210 | 216 | | |
211 | 217 | | |
212 | 218 | | |
213 | | - | |
| 219 | + | |
| 220 | + | |
214 | 221 | | |
215 | 222 | | |
216 | 223 | | |
| |||
335 | 342 | | |
336 | 343 | | |
337 | 344 | | |
338 | | - | |
339 | | - | |
340 | | - | |
| 345 | + | |
| 346 | + | |
341 | 347 | | |
342 | 348 | | |
343 | 349 | | |
| |||
0 commit comments