Rapid7 Vulnerability & Exploit Database

vmwgfx Driver File Descriptor Handling Priv Esc

Back to Search

vmwgfx Driver File Descriptor Handling Priv Esc

Disclosed
01/28/2022
Created
02/01/2023

Description

If the vmwgfx driver fails to copy the 'fence_rep' object to userland, it tries to recover by deallocating the (already populated) file descriptor. This is wrong, as the fd gets released via put_unused_fd() which shouldn't be used, as the fd table slot was already populated via the previous call to fd_install(). This leaves userland with a valid fd table entry pointing to a free'd 'file' object. We use this bug to overwrite a SUID binary with our payload and gain root. Linux kernel 4.14-rc1 - 5.17-rc1 are vulnerable. Successfully tested against Ubuntu 22.04.01 with kernel 5.13.12-051312-generic.

Author(s)

  • h00die
  • Mathias Krause

Platform

Linux

Architectures

x86, x64

Development

Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use exploit/linux/local/vmwgfx_fd_priv_esc
msf exploit(vmwgfx_fd_priv_esc) > show targets
    ...targets...
msf exploit(vmwgfx_fd_priv_esc) > set TARGET < target-id >
msf exploit(vmwgfx_fd_priv_esc) > show options
    ...show and set options...
msf exploit(vmwgfx_fd_priv_esc) > exploit

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security

;