CVE-2025-21731

Source
https://cve.org/CVERecord?id=CVE-2025-21731
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-21731.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2025-21731
Downstream
Related
Published
2025-02-27T02:07:35.927Z
Modified
2026-04-02T12:45:12.179665Z
Severity
  • 7.8 (High) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H CVSS Calculator
Summary
nbd: don't allow reconnect after disconnect
Details

In the Linux kernel, the following vulnerability has been resolved:

nbd: don't allow reconnect after disconnect

Following process can cause nbd_config UAF:

1) grab nbd_config temporarily;

2) nbdgenldisconnect() flush all recv_work() and release the initial reference:

nbdgenldisconnect nbddisconnectandput nbddisconnect flushworkqueue(nbd->recvworkq) if (testandclearbit(NBDRTHASCONFIGREF, ...)) nbdconfig_put -> due to step 1), reference is still not zero

3) nbdgenlreconfigure() queue recv_work() again;

nbdgenlreconfigure config = nbdgetconfigunlocked(nbd) if (!config) -> succeed if (!testbit(NBDRTBOUND, ...)) -> succeed nbdreconnectsocket queuework(nbd->recvworkq, &args->work)

4) step 1) release the reference;

5) Finially, recv_work() will trigger UAF:

recvwork nbdconfigput(nbd) -> nbdconfig is freed atomicdec(&config->recvthreads) -> UAF

Fix the problem by clearing NBDRTBOUND in nbdgenldisconnect(), so that nbdgenlreconfigure() will fail.

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/21xxx/CVE-2025-21731.json",
    "cna_assigner": "Linux"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
b7aa3d39385dc2d95899f9e379623fef446a2acd
Fixed
e70a578487a47d7cf058904141e586684d1c3381
Fixed
6bef6222a3f6c7adb6396f77f25a3579d821b09a
Fixed
e3be8862d73cac833e0fb7602636c19c6cb94b11
Fixed
e7343fa33751cb07c1c56b666bf37cfca357130e
Fixed
d208d2c52b652913b5eefc8ca434b0d6b757f68f
Fixed
a8ee6ecde2b7bfb58c8a3afe8a9d2b848f580739
Fixed
9793bd5ae4bdbdb2dde401a3cab94a6bfd05e302
Fixed
844b8cdc681612ff24df62cdefddeab5772fadf1

Database specific

source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-21731.json"