CVE-2025-21731·Kernel vulnerability
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
- high
- Software
- Kernel
- Fixed in
- 6.13.2
- Published
- 2025-02-27
Affected versions
From: 6.13
Until: 6.13.2
Fixed in: 6.13.2
How to fix this CVE
Update your Linux kernel to version 6.13.2 or later to patch a use-after-free vulnerability in the NBD (Network Block Device) subsystem. This flaw allows a race condition between disconnect and reconfigure operations that can corrupt kernel memory. Systems using NBD for network block storage should prioritize this kernel upgrade.
sudo dnf update kernel kernel-develDefensia detects this vulnerability
How to check if you are affected
- Check kernel version: uname -r — systems running 6.13.0, 6.13.1, or 6.13.2 before the patch are vulnerable
- Verify NBD is loaded: lsmod | grep nbd — if NBD module is active, the system is potentially exposed to exploitation
- Search kernel logs for NBD errors: dmesg | grep -i 'nbd\|use.after.free\|uaf' — look for memory corruption or crash traces
- Confirm patch installation: uname -r should show 6.13.2 or later; verify with cat /proc/version
FAQ
What is CVE-2025-21731?
CVE-2025-21731 is a use-after-free vulnerability in the Linux kernel's NBD (Network Block Device) driver that occurs when disconnect and reconfigure operations race, allowing one thread to access freed memory and potentially execute arbitrary code with kernel privileges.
Is CVE-2025-21731 being actively exploited?
No, this vulnerability is not listed as actively exploited according to CISA's Known Exploited Vulnerabilities catalog, and no public exploit is currently available.
What versions of Kernel are affected by CVE-2025-21731?
Linux kernel versions 6.13.0, 6.13.1, and 6.13.2 (prior to the patch) are affected. The vulnerability was resolved in kernel 6.13.2 and later stable releases.
How do I check if my server is vulnerable to CVE-2025-21731?
Run uname -r to check your kernel version; if it returns 6.13.0, 6.13.1, or early 6.13.2 build, and NBD is loaded (lsmod | grep nbd), your system is vulnerable.
Does Defensia detect CVE-2025-21731?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If the Linux kernel is installed on a monitored server, CVE-2025-21731 will appear in your dashboard with remediation steps.
Related Kernel CVEs
References
- 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
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2025-21731. Free for 1 server.
Get started free