CVE-2021-47636
Severity CVSS v4.0:
Pending analysis
Type:
CWE-125
Out-of-bounds Read
Publication date:
26/02/2025
Last modified:
01/10/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
ubifs: Fix read out-of-bounds in ubifs_wbuf_write_nolock()<br />
<br />
Function ubifs_wbuf_write_nolock() may access buf out of bounds in<br />
following process:<br />
<br />
ubifs_wbuf_write_nolock():<br />
aligned_len = ALIGN(len, 8); // Assume len = 4089, aligned_len = 4096<br />
if (aligned_len avail) ... // Not satisfy<br />
if (wbuf->used) {<br />
ubifs_leb_write() // Fill some data in avail wbuf<br />
len -= wbuf->avail; // len is still not 8-bytes aligned<br />
aligned_len -= wbuf->avail;<br />
}<br />
n = aligned_len >> c->max_write_shift;<br />
if (n) {<br />
n lnum, buf + written,<br />
wbuf->offs, n);<br />
// n > len, read out of bounds less than 8(n-len) bytes<br />
}<br />
<br />
, which can be catched by KASAN:<br />
=========================================================<br />
BUG: KASAN: slab-out-of-bounds in ecc_sw_hamming_calculate+0x1dc/0x7d0<br />
Read of size 4 at addr ffff888105594ff8 by task kworker/u8:4/128<br />
Workqueue: writeback wb_workfn (flush-ubifs_0_0)<br />
Call Trace:<br />
kasan_report.cold+0x81/0x165<br />
nand_write_page_swecc+0xa9/0x160<br />
ubifs_leb_write+0xf2/0x1b0 [ubifs]<br />
ubifs_wbuf_write_nolock+0x421/0x12c0 [ubifs]<br />
write_head+0xdc/0x1c0 [ubifs]<br />
ubifs_jnl_write_inode+0x627/0x960 [ubifs]<br />
wb_workfn+0x8af/0xb80<br />
<br />
Function ubifs_wbuf_write_nolock() accepts that parameter &#39;len&#39; is not 8<br />
bytes aligned, the &#39;len&#39; represents the true length of buf (which is<br />
allocated in &#39;ubifs_jnl_xxx&#39;, eg. ubifs_jnl_write_inode), so<br />
ubifs_wbuf_write_nolock() must handle the length read from &#39;buf&#39; carefully<br />
to write leb safely.<br />
<br />
Fetch a reproducer in [Link].
Impact
Base Score 3.x
7.10
Severity 3.x
HIGH
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 2.6.27 (including) | 4.19.238 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.20 (including) | 5.4.189 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.5 (including) | 5.10.110 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.33 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 5.16.19 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.17 (including) | 5.17.2 (excluding) |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/07a209fadee7b53b46858538e1177597273862e4
- https://git.kernel.org/stable/c/3b7fb89135a20587d57f8877c02e25003e9edbdf
- https://git.kernel.org/stable/c/4f2262a334641e05f645364d5ade1f565c85f20b
- https://git.kernel.org/stable/c/5343575aa11c5d7044107d59d43f84aec01312b0
- https://git.kernel.org/stable/c/a7054aaf1909cf40489c0ec1b728fdcf79c751a6
- https://git.kernel.org/stable/c/b80ccbec0e4804436c382d7dd60e943c386ed83a
- https://git.kernel.org/stable/c/e09fa5318d51f522e1af4fbaf8f74999355980c8



