CVE-2025-21731
nbd: don't allow reconnect after disconnect
Check your servers for CVE-2025-21731
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2025-21731 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
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) nbd_genl_disconnect() flush all recv_work() and release the initial reference:
nbd_genl_disconnect nbd_disconnect_and_put nbd_disconnect flush_workqueue(nbd->recv_workq) if (test_and_clear_bit(NBD_RT_HAS_CONFIG_REF, ...)) nbd_config_put -> due to step 1), reference is still not zero
3) nbd_genl_reconfigure() queue recv_work() again;
nbd_genl_reconfigure config = nbd_get_config_unlocked(nbd) if (!config) -> succeed if (!test_bit(NBD_RT_BOUND, ...)) -> succeed nbd_reconnect_socket queue_work(nbd->recv_workq, &args->work)
4) step 1) release the reference;
5) Finially, recv_work() will trigger UAF:
recv_work nbd_config_put(nbd) -> nbd_config is freed atomic_dec(&config->recv_threads) -> UAF
Fix the problem by clearing NBD_RT_BOUND in nbd_genl_disconnect(), so that nbd_genl_reconfigure() will fail.
Severity (CVSS)
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Attack vector
- local: the attacker needs local access, or a user has to open a prepared file
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- low: the attacker needs an ordinary user account
- User interaction
- none: nobody has to click or open anything
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality high, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 0.24%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 16.2% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 27 Feb 2025):
- Exploitation
- none: CISA did not find evidence of exploitation or a public proof of concept
- Automatable
- no: each attack takes manual steps
- Technical impact
- total: full control of the component or of its data
Weakness
- CWE-416 Use After Free
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from b7aa3d39385dc2d95899f9e379623fef446a2acd, before e70a578487a47d7cf058904141e586684d1c3381 affected from b7aa3d39385dc2d95899f9e379623fef446a2acd, before 6bef6222a3f6c7adb6396f77f25a3579d821b09a affected from b7aa3d39385dc2d95899f9e379623fef446a2acd, before e3be8862d73cac833e0fb7602636c19c6cb94b11 affected from b7aa3d39385dc2d95899f9e379623fef446a2acd, before e7343fa33751cb07c1c56b666bf37cfca357130e affected from b7aa3d39385dc2d95899f9e379623fef446a2acd, before d208d2c52b652913b5eefc8ca434b0d6b757f68f affected from b7aa3d39385dc2d95899f9e379623fef446a2acd, before a8ee6ecde2b7bfb58c8a3afe8a9d2b848f580739 affected from b7aa3d39385dc2d95899f9e379623fef446a2acd, before 9793bd5ae4bdbdb2dde401a3cab94a6bfd05e302 affected from b7aa3d39385dc2d95899f9e379623fef446a2acd, before 844b8cdc681612ff24df62cdefddeab5772fadf1
Other versions: unaffected
|
| Linux |
affected 4.12 unaffected before 4.12 unaffected from 5.4.291 up to and including 5.4.* unaffected from 5.10.235 up to and including 5.10.* unaffected from 5.15.179 up to and including 5.15.* unaffected from 6.1.129 up to and including 6.1.* unaffected from 6.6.76 up to and including 6.6.* unaffected from 6.12.13 up to and including 6.12.* unaffected from 6.13.2 up to and including 6.13.* unaffected 6.14 and later
Other versions: affected
|
Is my server affected?
This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:
uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2025-21731 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2025-21731
With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2025-21731
trivy image --scanners vuln IMAGE | grep CVE-2025-21731
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Other references
- https://git.kernel.org/stable/c/e70a578487a47d7cf058904141e586684d1c3381 git.kernel.org
- https://git.kernel.org/stable/c/6bef6222a3f6c7adb6396f77f25a3579d821b09a git.kernel.org
- https://git.kernel.org/stable/c/e3be8862d73cac833e0fb7602636c19c6cb94b11 git.kernel.org
- https://git.kernel.org/stable/c/e7343fa33751cb07c1c56b666bf37cfca357130e git.kernel.org
- https://git.kernel.org/stable/c/d208d2c52b652913b5eefc8ca434b0d6b757f68f git.kernel.org
- https://git.kernel.org/stable/c/a8ee6ecde2b7bfb58c8a3afe8a9d2b848f580739 git.kernel.org
- https://git.kernel.org/stable/c/9793bd5ae4bdbdb2dde401a3cab94a6bfd05e302 git.kernel.org
- https://git.kernel.org/stable/c/844b8cdc681612ff24df62cdefddeab5772fadf1 git.kernel.org
- https://lists.debian.org/debian-lts-announce/2025/05/msg00030.html lists.debian.org
- https://lists.debian.org/debian-lts-announce/2025/03/msg00028.html lists.debian.org
- https://cert-portal.siemens.com/productcert/html/ssa-019113.html cert-portal.siemens.com
- https://cert-portal.siemens.com/productcert/html/ssa-457936.html cert-portal.siemens.com
- https://cert-portal.siemens.com/productcert/html/ssa-784472.html cert-portal.siemens.com
Source: the record CVE-2025-21731 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse