A newly discovered vulnerability, CVE-2022-3707, has been found to cause a double-free memory flaw in the Linux kernel. This issue affects the Intel GVT-g graphics driver and can potentially allow a local user to crash the system. To understand this vulnerability and how to address it, we must look at the details of the flaw, the kernels affected, and the possible mitigations. This post will cover:

CVE-2022-3707 Vulnerability Details

The CVE-2022-3707 vulnerability lies within the Linux kernel's implementation of the Intel GVT-g graphics driver. The issue arises when the driver triggers an overload in the system resources of the VGA card due to a failure in the intel_gvt_dma_map_guest_page function. The resulting memory corruption leads to a double-free scenario, which can be exploited by a local user to crash the system.

The affected function in the Linux kernel source code is as shown below

static int intel_gvt_dma_map_guest_page(struct intel_vgpu *vgpu, struct intel_vgpu_mm *mm,
        dma_addr_t dma_addr, unsigned long gfn, int write)
{
        // ... code that initializes variables omitted

        if (unlikely(ret)) {
                gvt_vgpu_warn("fail to dma_map pfn %lx\n", pfn);
                intel_gvt_dma_unmap_guest_page(vgpu, dma_addr);
                return ret;
        }

        // ... rest of the function
}

The double-free scenario occurs when the function fails to map the DMA address and subsequently calls the intel_gvt_dma_unmap_guest_page function. As a result, the function unmaps the DMA address, leading to the double-free memory flaw.

For further information and details on the vulnerability, refer to the following resources

1. Official CVE entry: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-3707
2. Linux kernel source code: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

Exploit Details

The exploit for this vulnerability hasn't been publicly disclosed. However, those with malicious intent might be able to create an exploit by triggering GPU-related tasks that would cause a fail in the intel_gvt_dma_map_guest_page function, which would, in turn, lead to the double-free memory flaw. Since this issue can only be triggered by a local user, the attacker needs to have physical access to the vulnerable system. An attacker aware of the vulnerability could potentially exploit it to crash the victim's system and cause a denial of service.

Mitigations

Kernel developers have already begun working on a patch to address this vulnerability. Linux users are strongly advised to apply the patch once it becomes publicly available or switch to using a different graphics driver until the patch is released. Additionally, system administrators should always ensure that proper access permissions and restrictions are in place to prevent unauthorized local users from exploiting this or other vulnerabilities.

Conclusion

CVE-2022-3707 is a critical double-free memory flaw in the Linux kernel that affects the Intel GVT-g graphics driver. Although a successful exploit requires a local user with malicious intent, it can result in severe system crashes. To mitigate this vulnerability, users should update their system with the forthcoming patch and maintain strict access controls. By understanding the details of this vulnerability and staying informed on the latest updates, users can safeguard their systems against potential exploits.

Timeline

Published on: 03/06/2023 23:15:00 UTC
Last modified on: 05/03/2023 14:15:00 UTC