Skip to main content

CVE-2023-52851: Vulnerability in Linux Linux

High
VulnerabilityCVE-2023-52851cvecve-2023-52851
Published: Tue May 21 2024 (05/21/2024, 15:31:47 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: IB/mlx5: Fix init stage error handling to avoid double free of same QP and UAF In the unlikely event that workqueue allocation fails and returns NULL in mlx5_mkey_cache_init(), delete the call to mlx5r_umr_resource_cleanup() (which frees the QP) in mlx5_ib_stage_post_ib_reg_umr_init(). This will avoid attempted double free of the same QP when __mlx5_ib_add() does its cleanup. Resolves a splat: Syzkaller reported a UAF in ib_destroy_qp_user workqueue: Failed to create a rescuer kthread for wq "mkey_cache": -EINTR infiniband mlx5_0: mlx5_mkey_cache_init:981:(pid 1642): failed to create work queue infiniband mlx5_0: mlx5_ib_stage_post_ib_reg_umr_init:4075:(pid 1642): mr cache init failed -12 ================================================================== BUG: KASAN: slab-use-after-free in ib_destroy_qp_user (drivers/infiniband/core/verbs.c:2073) Read of size 8 at addr ffff88810da310a8 by task repro_upstream/1642 Call Trace: <TASK> kasan_report (mm/kasan/report.c:590) ib_destroy_qp_user (drivers/infiniband/core/verbs.c:2073) mlx5r_umr_resource_cleanup (drivers/infiniband/hw/mlx5/umr.c:198) __mlx5_ib_add (drivers/infiniband/hw/mlx5/main.c:4178) mlx5r_probe (drivers/infiniband/hw/mlx5/main.c:4402) ... </TASK> Allocated by task 1642: __kmalloc (./include/linux/kasan.h:198 mm/slab_common.c:1026 mm/slab_common.c:1039) create_qp (./include/linux/slab.h:603 ./include/linux/slab.h:720 ./include/rdma/ib_verbs.h:2795 drivers/infiniband/core/verbs.c:1209) ib_create_qp_kernel (drivers/infiniband/core/verbs.c:1347) mlx5r_umr_resource_init (drivers/infiniband/hw/mlx5/umr.c:164) mlx5_ib_stage_post_ib_reg_umr_init (drivers/infiniband/hw/mlx5/main.c:4070) __mlx5_ib_add (drivers/infiniband/hw/mlx5/main.c:4168) mlx5r_probe (drivers/infiniband/hw/mlx5/main.c:4402) ... Freed by task 1642: __kmem_cache_free (mm/slub.c:1826 mm/slub.c:3809 mm/slub.c:3822) ib_destroy_qp_user (drivers/infiniband/core/verbs.c:2112) mlx5r_umr_resource_cleanup (drivers/infiniband/hw/mlx5/umr.c:198) mlx5_ib_stage_post_ib_reg_umr_init (drivers/infiniband/hw/mlx5/main.c:4076 drivers/infiniband/hw/mlx5/main.c:4065) __mlx5_ib_add (drivers/infiniband/hw/mlx5/main.c:4168) mlx5r_probe (drivers/infiniband/hw/mlx5/main.c:4402) ...

AI-Powered Analysis

AILast updated: 07/01/2025, 07:54:56 UTC

Technical Analysis

CVE-2023-52851 is a use-after-free (UAF) vulnerability identified in the Linux kernel's InfiniBand Mellanox mlx5 driver, specifically within the mlx5_mkey_cache_init() and related functions handling queue pair (QP) resources. The vulnerability arises due to improper error handling during the initialization of the Mellanox mlx5 memory key (mkey) cache. If the workqueue allocation fails and returns NULL during mlx5_mkey_cache_init(), the code erroneously calls mlx5r_umr_resource_cleanup(), which frees the same QP resource twice. This double free leads to a use-after-free condition when the kernel later attempts to access the freed QP in ib_destroy_qp_user(). The issue was detected through kernel address sanitizer (KASAN) reports triggered by Syzkaller fuzzing, which revealed slab-use-after-free errors in the verbs layer of the InfiniBand driver stack. The root cause is a race or logic flaw in error cleanup paths during resource initialization, causing the same memory to be freed multiple times. This can result in kernel memory corruption, potentially leading to system crashes (kernel panics) or exploitable conditions for privilege escalation or denial of service. The vulnerability affects Linux kernel versions containing the affected mlx5 driver code prior to the patch. No public exploits are known at this time, but the flaw is critical due to its low-level nature and potential for kernel memory corruption. The mlx5 driver is commonly used in high-performance computing and data center environments leveraging InfiniBand networking hardware from Mellanox (now part of NVIDIA).

Potential Impact

For European organizations, particularly those operating data centers, HPC clusters, or cloud infrastructure using Linux servers with Mellanox InfiniBand hardware, this vulnerability poses a significant risk. Exploitation could allow attackers or malicious insiders to cause kernel crashes, leading to denial of service and potential disruption of critical services. In worst cases, memory corruption could be leveraged to escalate privileges or execute arbitrary code within the kernel context, compromising confidentiality and integrity of sensitive data and systems. Given the widespread use of Linux in enterprise and research environments across Europe, especially in countries with advanced HPC facilities (e.g., Germany, France, UK, Netherlands), the impact could be substantial. Disruptions in financial services, telecommunications, scientific research, and cloud providers relying on affected hardware could result in operational downtime and data breaches. The lack of known exploits reduces immediate risk, but the vulnerability’s nature demands prompt remediation to prevent future attacks.

Mitigation Recommendations

European organizations should prioritize updating Linux kernels to versions that include the patch for CVE-2023-52851 as soon as they become available from their Linux distribution vendors. Until patches are applied, organizations should: 1) Audit and inventory systems using Mellanox mlx5 InfiniBand hardware to identify vulnerable hosts. 2) Limit access to affected systems to trusted administrators and restrict unprivileged user access to reduce exploitation risk. 3) Monitor kernel logs and system behavior for signs of crashes or unusual activity related to mlx5 driver operations. 4) Employ kernel hardening techniques such as Kernel Address Space Layout Randomization (KASLR) and Kernel Page Table Isolation (KPTI) to mitigate exploitation impact. 5) Coordinate with hardware vendors for firmware updates or mitigations if available. 6) For critical environments, consider temporarily disabling InfiniBand mlx5 interfaces if feasible to eliminate attack surface until patched. 7) Implement strict change control and testing procedures for kernel updates to ensure stability in production HPC and data center environments. These targeted steps go beyond generic advice by focusing on the specific driver and hardware involved and operational realities of affected organizations.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-05-21T15:19:24.255Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9830c4522896dcbe7736

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

Last enriched: 7/1/2025, 7:54:56 AM

Last updated: 8/12/2025, 8:04:23 AM

Views: 17

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