CVE-2025-21751
Published: 27 February 2025
Summary
CVE-2025-21751 is a high-severity Use After Free (CWE-416) vulnerability in Linux Linux Kernel. Its CVSS base score is 7.8 (High).
Operationally, exploitation aligns with the MITRE ATT&CK technique Exploitation for Privilege Escalation (T1068); ranked at the 4.2th percentile by exploit likelihood (below the median); it is not currently listed in the CISA KEV catalog.
The strongest mitigations our analysis identified are NIST 800-53 SI-2 (Flaw Remediation) and SI-11 (Error Handling).
Threat & Defense at a Glance
Threat & Defense Details
Mitigating Controls (NIST 800-53 r5)AI
Directly mitigates the use-after-free vulnerability by requiring timely remediation through application of the specific kernel patches fixing mlx5 HWS matcher disconnect error handling.
Addresses the root cause of improper error handling during firmware failure in matcher disconnect, preventing conditions that lead to use-after-free.
Provides memory protection mechanisms that mitigate exploitation of the use-after-free in the mlx5 driver by safeguarding against unauthorized memory access.
MITRE ATT&CK Enterprise TechniquesAI
Why these techniques?
Local kernel use-after-free in mlx5 driver enables arbitrary code execution for privilege escalation (T1068) by low-privileged attackers and system crashes via exploitation (T1499.004).
NVD Description
In the Linux kernel, the following vulnerability has been resolved: net/mlx5: HWS, change error flow on matcher disconnect Currently, when firmware failure occurs during matcher disconnect flow, the error flow of the function reconnects the matcher back and returns an…
more
error, which continues running the calling function and eventually frees the matcher that is being disconnected. This leads to a case where we have a freed matcher on the matchers list, which in turn leads to use-after-free and eventual crash. This patch fixes that by not trying to reconnect the matcher back when some FW command fails during disconnect. Note that we're dealing here with FW error. We can't overcome this problem. This might lead to bad steering state (e.g. wrong connection between matchers), and will also lead to resource leakage, as it is the case with any other error handling during resource destruction. However, the goal here is to allow the driver to continue and not crash the machine with use-after-free error.
Deeper analysisAI
CVE-2025-21751 is a use-after-free vulnerability (CWE-416) in the Linux kernel's mlx5 network driver, specifically within the Hardware Steering (HWS) component. The issue arises during the matcher disconnect flow when a firmware failure occurs: the existing error handling reconnects the matcher and returns an error, allowing the calling function to proceed and free the matcher while it remains listed, leading to a use-after-free condition and system crash. The vulnerability carries a CVSS v3.1 base score of 7.8 (AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H) and was published on 2025-02-27.
A local attacker with low privileges can exploit this vulnerability due to its low attack complexity and lack of user interaction requirements. Successful exploitation could result in high impacts to confidentiality, integrity, and availability, potentially enabling arbitrary code execution, data corruption, or system crashes via the use-after-free in the mlx5 driver's matcher handling.
The provided patch references from kernel.org stable repositories (commits 1ce840c7a659aa53a31ef49f0271b4fd0dc10296, 23a86c76a1a197e8fbbbd0ce3e826eb58c471624, and 5682aad0276ff9b9b0eff3188eb6a1f504d6b436) mitigate the issue by modifying the error flow in the mlx5 HWS matcher disconnect function. Instead of attempting to reconnect the matcher on firmware command failure, the updated code avoids reconnection, preventing the use-after-free and crash at the cost of potential bad steering state or resource leakage, as firmware errors cannot be fully resolved during resource destruction.
Details
- CWE(s)