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

Published Feb 27, 2025
·
Updated

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

nbd: don't allow reconnect after disconnect

Following process can cause nbdconfig UAF:

1) grab nbdconfig temporarily;

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

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

3) nbdgenlreconfigure() queue recvwork() 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, recvwork() 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.

Affected Software

11 affected componentsFixes available
Linux Kernel
Linux Linux kernel>=4.12<5.4.291
Linux Linux kernel>=5.5<5.10.235
Linux Linux kernel>=5.11<5.15.179
Linux Linux kernel>=5.16<6.1.129
Linux Linux kernel>=6.2<6.6.76
Linux Linux kernel>=6.7<6.12.13
Linux Linux kernel>=6.13<6.13.2
Microsoft cbl2 kernel 5.15.180.1-1
Microsoft cbl2 kernel 5.15.176.3-3
Microsoft cbl2 kernel 5.15.176.3-3

Event History

Feb 27, 2025
CVE Published
via MITRE·02:07 AM
Data Sourced
via MITRE·02:07 AM
Description
Data Sourced
via NVD·02:15 AM
RemedyDescriptionSeverityWeaknessAffected Software
May 5, 2025
Data Sourced
via Microsoft·07:00 AM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·07:00 AM
Affected Software
Updated
via Microsoft·07:00 AM
SeverityAffected Software
Updated
via Microsoft·07:00 AM
DescriptionSeverity

Frequently Asked Questions

1

What is the severity of CVE-2025-21731?

CVE-2025-21731 is classified as a moderate severity vulnerability in the Linux kernel.

2

How do I fix CVE-2025-21731?

To mitigate CVE-2025-21731, it is recommended to update to the latest version of the Linux kernel where the vulnerability has been patched.

3

What components are affected by CVE-2025-21731?

CVE-2025-21731 primarily affects the nbd (Network Block Device) component of the Linux kernel.

4

What type of vulnerability is CVE-2025-21731?

CVE-2025-21731 is a use-after-free (UAF) vulnerability that can lead to potential arbitrary code execution.

5

Can CVE-2025-21731 be exploited remotely?

Yes, CVE-2025-21731 could potentially be exploited remotely if the affected nbd service is improperly configured.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203