CVE-2023-52851

7.8 HIGH

📋 TL;DR

This CVE describes a double-free vulnerability in the Linux kernel's mlx5 InfiniBand driver that occurs during initialization error handling. When workqueue allocation fails, the cleanup code attempts to free the same QP (Queue Pair) twice, leading to use-after-free conditions. This affects systems using Mellanox InfiniBand hardware with vulnerable kernel versions.

💻 Affected Systems

Products:
  • Linux kernel mlx5 InfiniBand driver
Versions: Specific kernel versions containing the vulnerable code (check git commits for exact ranges)
Operating Systems: Linux distributions with vulnerable kernel versions
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects systems with Mellanox InfiniBand hardware and when the mlx5 driver is loaded. The vulnerability triggers during device initialization when workqueue allocation fails.

📦 What is this software?

Linux Kernel by Linux

The Linux Kernel is the core component of the Linux operating system, serving as the critical interface between computer hardware and software processes. As the heart of millions of servers, cloud infrastructure, embedded systems, Android devices, and IoT deployments worldwide, the Linux Kernel mana...

Learn more about Linux Kernel →

Linux Kernel by Linux

The Linux Kernel is the core component of the Linux operating system, serving as the critical interface between computer hardware and software processes. As the heart of millions of servers, cloud infrastructure, embedded systems, Android devices, and IoT deployments worldwide, the Linux Kernel mana...

Learn more about Linux Kernel →

Linux Kernel by Linux

The Linux Kernel is the core component of the Linux operating system, serving as the critical interface between computer hardware and software processes. As the heart of millions of servers, cloud infrastructure, embedded systems, Android devices, and IoT deployments worldwide, the Linux Kernel mana...

Learn more about Linux Kernel →

⚠️ Risk & Real-World Impact

🔴

Worst Case

Kernel panic, system crash, or potential privilege escalation leading to full system compromise through memory corruption.

🟠

Likely Case

System instability, kernel crashes, or denial of service when initializing mlx5 InfiniBand devices.

🟢

If Mitigated

No impact if the vulnerable code path isn't triggered during device initialization.

🌐 Internet-Facing: LOW - Requires local access or specific InfiniBand network conditions.
🏢 Internal Only: MEDIUM - Affects systems with Mellanox InfiniBand hardware in data centers and HPC environments.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: HIGH - Requires triggering specific error conditions during driver initialization.

Exploitation requires local access and ability to trigger the workqueue allocation failure path. Found via syzkaller fuzzing.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Kernel versions with commits 2ef422f063b74adcc4a4a9004b0a87bb55e0a836 or later

Vendor Advisory: https://git.kernel.org/stable/c/2ef422f063b74adcc4a4a9004b0a87bb55e0a836

Restart Required: Yes

Instructions:

1. Update Linux kernel to patched version. 2. Reboot system. 3. Verify mlx5 driver loads without errors in dmesg.

🔧 Temporary Workarounds

Disable mlx5 InfiniBand driver

linux

Prevent loading of vulnerable driver module

echo 'blacklist mlx5_ib' >> /etc/modprobe.d/blacklist.conf
rmmod mlx5_ib

🧯 If You Can't Patch

  • Avoid using Mellanox InfiniBand hardware on vulnerable systems
  • Monitor kernel logs for workqueue allocation failures and mlx5 initialization errors

🔍 How to Verify

Check if Vulnerable:

Check kernel version and if mlx5_ib module is loaded: lsmod | grep mlx5_ib && uname -r

Check Version:

uname -r

Verify Fix Applied:

Check if kernel includes fix commit: git log --oneline | grep -i '2ef422f063b74adcc4a4a9004b0a87bb55e0a836' or check kernel version against patched releases

📡 Detection & Monitoring

Log Indicators:

  • Failed to create work queue
  • mr cache init failed
  • KASAN: slab-use-after-free in ib_destroy_qp_user
  • mlx5_mkey_cache_init failed

Network Indicators:

  • InfiniBand connection failures during initialization

SIEM Query:

source="kernel" AND ("mlx5_mkey_cache_init" OR "ib_destroy_qp_user" OR "UAF" OR "double free")

🔗 References

📤 Share & Export