# CVE-2025-21731: nbd: don't allow reconnect after disconnect

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.34% (percentile 20, 2026-11-26)
- **CWE:** CWE-416
- **Published:** 2025-02-27T02:07:35.927Z
- **Modified:** 2026-11-10T13:17:34.093Z

## Who should check

- Anyone running Linux \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< e70a578487a47d7cf058904141e586684d1c3381; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< 6bef6222a3f6c7adb6396f77f25a3579d821b09a; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< e3be8862d73cac833e0fb7602636c19c6cb94b11; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< e7343fa33751cb07c1c56b666bf37cfca357130e; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< d208d2c52b652913b5eefc8ca434b0d6b757f68f; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< a8ee6ecde2b7bfb58c8a3afe8a9d2b848f580739; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< 9793bd5ae4bdbdb2dde401a3cab94a6bfd05e302; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< 844b8cdc681612ff24df62cdefddeab5772fadf1
- Anyone running Linux 4.12

## 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.

## Affected and fixed versions

- Linux: \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< e70a578487a47d7cf058904141e586684d1c3381; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< 6bef6222a3f6c7adb6396f77f25a3579d821b09a; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< e3be8862d73cac833e0fb7602636c19c6cb94b11; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< e7343fa33751cb07c1c56b666bf37cfca357130e; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< d208d2c52b652913b5eefc8ca434b0d6b757f68f; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< a8ee6ecde2b7bfb58c8a3afe8a9d2b848f580739; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< 9793bd5ae4bdbdb2dde401a3cab94a6bfd05e302; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< 844b8cdc681612ff24df62cdefddeab5772fadf1 (cvelist)
- Linux: 4.12 (cvelist)

## Mitigation

- Upgrade Linux to 844b8cdc681612ff24df62cdefddeab5772fadf1 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2025-21731. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-21731.md
Affected: Linux >= b7aa3d39385dc2d95899f9e379623fef446a2acd, < e70a578487a47d7cf058904141e586684d1c3381; >= b7aa3d39385dc2d95899f9e379623fef446a2acd, < 6bef6222a3f6c7adb6396f77f25a3579d821b09a; >= b7aa3d39385dc2d95899f9e379623fef446a2acd, < e3be8862d73cac833e0fb7602636c19c6cb94b11; >= b7aa3d39385dc2d95899f9e…
Fixed in: Linux 6bef6222a3f6c7adb6396f77f25a3579d821b09a, Linux 9793bd5ae4bdbdb2dde401a3cab94a6bfd05e302, Linux 844b8cdc681612ff24df62cdefddeab5772fadf1

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2025-21731 being exploited?

There is no confirmed exploitation: CVE-2025-21731 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.34% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2025-21731?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2025-21731?

Linux \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< e70a578487a47d7cf058904141e586684d1c3381; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< 6bef6222a3f6c7adb6396f77f25a3579d821b09a; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< e3be8862d73cac833e0fb7602636c19c6cb94b11; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< e7343fa33751cb07c1c56b666bf37cfca357130e; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< d208d2c52b652913b5eefc8ca434b0d6b757f68f; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< a8ee6ecde2b7bfb58c8a3afe8a9d2b848f580739; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< 9793bd5ae4bdbdb2dde401a3cab94a6bfd05e302; \>= b7aa3d39385dc2d95899f9e379623fef446a2acd, \< 844b8cdc681612ff24df62cdefddeab5772fadf1; Linux 4.12.

### Is there a fix for CVE-2025-21731?

Yes. Fixed in Linux 6bef6222a3f6c7adb6396f77f25a3579d821b09a, Linux 9793bd5ae4bdbdb2dde401a3cab94a6bfd05e302, Linux 844b8cdc681612ff24df62cdefddeab5772fadf1. Upgrade Linux to 844b8cdc681612ff24df62cdefddeab5772fadf1 or later.

### How do I check if I'm affected by CVE-2025-21731?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/e70a578487a47d7cf058904141e586684d1c3381>
- patch: <https://git.kernel.org/stable/c/6bef6222a3f6c7adb6396f77f25a3579d821b09a>
- patch: <https://git.kernel.org/stable/c/e3be8862d73cac833e0fb7602636c19c6cb94b11>
- patch: <https://git.kernel.org/stable/c/e7343fa33751cb07c1c56b666bf37cfca357130e>
- patch: <https://git.kernel.org/stable/c/d208d2c52b652913b5eefc8ca434b0d6b757f68f>
- patch: <https://git.kernel.org/stable/c/a8ee6ecde2b7bfb58c8a3afe8a9d2b848f580739>
- patch: <https://git.kernel.org/stable/c/9793bd5ae4bdbdb2dde401a3cab94a6bfd05e302>
- patch: <https://git.kernel.org/stable/c/844b8cdc681612ff24df62cdefddeab5772fadf1>
- other: <https://lists.debian.org/debian-lts-announce/2025/05/msg00030.html>
- other: <https://lists.debian.org/debian-lts-announce/2025/03/msg00028.html>
- other: <https://cert-portal.siemens.com/productcert/html/ssa-019113.html>
- other: <https://cert-portal.siemens.com/productcert/html/ssa-457936.html>
- other: <https://cert-portal.siemens.com/productcert/html/ssa-784472.html>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2025-21731>

HTML: <https://flawdb.com/CVE-2025-21731> · JSON: <https://flawdb.com/api/v1/entries/CVE-2025-21731>
