NVIDIA CUDA Driver Use-After-Free Allows GPU Memory Evasion and Host Privilege Escalation
Overview
A critical use-after-free vulnerability was found in the NVIDIA CUDA driver for Linux (versions 550.x prior to 550.78). The flaw resides in the Unified Memory management component responsible for handling memory allocations that can be accessed by both the CPU and GPU. An attacker with local, unprivileged access to a system with a vulnerable driver—a common scenario in multi-tenant cloud ML environments or shared university compute clusters—could exploit this flaw. By crafting a specific sequence of memory allocation and deallocation calls via the CUDA API while simultaneously launching a malicious kernel, an attacker can trigger a race condition. This leads to the driver's kernel module retaining a stale pointer to freed memory. The attacker can then reclaim this memory and overwrite the stale pointer, gaining the ability to write arbitrary data to arbitrary physical memory locations. This powerful primitive can be leveraged to corrupt kernel data structures, disable security features like SMAP/SMEP, and ultimately execute code with full kernel privileges, resulting in a complete host system compromise and breaking isolation between GPU tenants.
Affected Systems
Testing Guide
1. **Check Driver Version**: On Linux, run `nvidia-smi` to check the installed driver version. On Windows, check the NVIDIA Control Panel. 2. **Compare with Patched Versions**: If your driver version is lower than the patched versions listed in the advisory, your system is vulnerable. 3. **Run a PoC (Caution!)**: In a controlled, isolated environment, a security team could attempt to run a proof-of-concept exploit for this CVE to confirm exploitability. This is not recommended for production systems.
Mitigation Steps
1. **Update NVIDIA Drivers**: Immediately update to the latest NVIDIA driver version (550.78 or newer for Linux, 551.23 or newer for Windows) provided by NVIDIA or your cloud service provider. 2. **Restrict GPU Access**: In multi-tenant environments, use technologies like NVIDIA MIG (Multi-Instance GPU) to provide stronger hardware-level isolation between workloads. 3. **Use Secure Base Images**: Ensure that ML container images are based on recent OS versions and that driver updates are regularly applied to the underlying container hosts. 4. **Monitor for Anomalous GPU Activity**: Use system monitoring tools to detect unusual patterns of GPU kernel execution or memory access that could indicate an exploitation attempt.
Patch Details
Patched in NVIDIA driver versions 550.78 (Linux) and 551.23 (Windows) and subsequent releases.