CVE-2025-21731
Severity CVSS v4.0:
Pending analysis
Type:
CWE-416
Use After Free
Publication date:
27/02/2025
Last modified:
24/03/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
nbd: don&#39;t allow reconnect after disconnect<br />
<br />
Following process can cause nbd_config UAF:<br />
<br />
1) grab nbd_config temporarily;<br />
<br />
2) nbd_genl_disconnect() flush all recv_work() and release the<br />
initial reference:<br />
<br />
nbd_genl_disconnect<br />
nbd_disconnect_and_put<br />
nbd_disconnect<br />
flush_workqueue(nbd->recv_workq)<br />
if (test_and_clear_bit(NBD_RT_HAS_CONFIG_REF, ...))<br />
nbd_config_put<br />
-> due to step 1), reference is still not zero<br />
<br />
3) nbd_genl_reconfigure() queue recv_work() again;<br />
<br />
nbd_genl_reconfigure<br />
config = nbd_get_config_unlocked(nbd)<br />
if (!config)<br />
-> succeed<br />
if (!test_bit(NBD_RT_BOUND, ...))<br />
-> succeed<br />
nbd_reconnect_socket<br />
queue_work(nbd->recv_workq, &args->work)<br />
<br />
4) step 1) release the reference;<br />
<br />
5) Finially, recv_work() will trigger UAF:<br />
<br />
recv_work<br />
nbd_config_put(nbd)<br />
-> nbd_config is freed<br />
atomic_dec(&config->recv_threads)<br />
-> UAF<br />
<br />
Fix the problem by clearing NBD_RT_BOUND in nbd_genl_disconnect(), so<br />
that nbd_genl_reconfigure() will fail.
Impact
Base Score 3.x
7.80
Severity 3.x
HIGH
Vulnerable products and versions
CPE | From | Up to |
---|---|---|
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.12 (including) | 5.4.291 (excluding) |
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.5 (including) | 5.10.235 (excluding) |
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.179 (excluding) |
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 6.1.129 (excluding) |
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.6.76 (excluding) |
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.12.13 (excluding) |
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.13 (including) | 6.13.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/6bef6222a3f6c7adb6396f77f25a3579d821b09a
- https://git.kernel.org/stable/c/844b8cdc681612ff24df62cdefddeab5772fadf1
- https://git.kernel.org/stable/c/9793bd5ae4bdbdb2dde401a3cab94a6bfd05e302
- https://git.kernel.org/stable/c/a8ee6ecde2b7bfb58c8a3afe8a9d2b848f580739
- https://git.kernel.org/stable/c/d208d2c52b652913b5eefc8ca434b0d6b757f68f
- https://git.kernel.org/stable/c/e3be8862d73cac833e0fb7602636c19c6cb94b11
- https://git.kernel.org/stable/c/e70a578487a47d7cf058904141e586684d1c3381
- https://git.kernel.org/stable/c/e7343fa33751cb07c1c56b666bf37cfca357130e