Skip to main content

CVE-2025-21731: Vulnerability in Linux Linux

High
VulnerabilityCVE-2025-21731cvecve-2025-21731
Published: Thu Feb 27 2025 (02/27/2025, 02:07:35 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

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.

AI-Powered Analysis

AILast updated: 07/03/2025, 04:26:58 UTC

Technical Analysis

CVE-2025-21731 is a high-severity use-after-free (UAF) vulnerability in the Linux kernel's Network Block Device (NBD) subsystem. The flaw arises from improper handling of references during the disconnect and reconnect process of NBD configurations. Specifically, the vulnerability occurs when the nbd_config object is temporarily grabbed and then released in a sequence that allows a race condition. The nbd_genl_disconnect() function flushes all pending recv_work() tasks and releases the initial reference to the nbd_config object. However, due to the temporary grab, the reference count does not reach zero immediately. Subsequently, nbd_genl_reconfigure() queues recv_work() again, and when the original reference is finally released, the recv_work() function accesses the freed nbd_config object, leading to a use-after-free condition. This can cause memory corruption, potentially allowing an attacker with local privileges to execute arbitrary code, escalate privileges, or cause denial of service by crashing the kernel. The fix involves clearing the NBD_RT_BOUND flag during disconnection to prevent reconfiguration from queuing work on a freed object. The vulnerability is tracked as CWE-416 (Use After Free) and has a CVSS 3.1 score of 7.8, indicating high severity. Exploitation requires local privileges with low attack complexity and no user interaction, affecting confidentiality, integrity, and availability of the system.

Potential Impact

For European organizations, this vulnerability poses a significant risk, especially for those relying on Linux-based infrastructure that utilizes the NBD subsystem, such as cloud service providers, data centers, and enterprises running virtualized storage solutions. Exploitation could allow attackers to gain elevated privileges on affected systems, leading to unauthorized access to sensitive data, disruption of critical services, or deployment of persistent malware. The ability to cause kernel crashes could also result in denial of service, impacting availability of essential services. Given the widespread use of Linux in European government, financial, healthcare, and industrial sectors, successful exploitation could have cascading effects on operational continuity and data protection compliance under regulations like GDPR. The local attack vector means that attackers need some form of access, but this could be achieved through compromised user accounts or insider threats, making internal security controls crucial.

Mitigation Recommendations

European organizations should prioritize patching affected Linux kernel versions as soon as updates become available from trusted distributors. In the interim, restricting local access to trusted users and employing strict access controls can reduce exploitation risk. Monitoring for unusual kernel activity or crashes related to NBD operations can help detect attempted exploitation. Employing kernel hardening techniques such as Kernel Address Space Layout Randomization (KASLR), Control Flow Integrity (CFI), and enabling security modules like SELinux or AppArmor can mitigate exploitation impact. Additionally, organizations should audit and limit the use of NBD where possible, or isolate NBD workloads in hardened containers or virtual machines. Regularly reviewing and updating privilege management policies to minimize the number of users with local access is also recommended. Finally, integrating vulnerability scanning and compliance checks into patch management workflows will ensure timely remediation.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-12-29T08:45:45.755Z
Cisa Enriched
true
Cvss Version
3.1
State
PUBLISHED

Threat ID: 682d9832c4522896dcbe8608

Added to database: 5/21/2025, 9:09:06 AM

Last enriched: 7/3/2025, 4:26:58 AM

Last updated: 7/30/2025, 4:53:55 AM

Views: 11

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats