Rapid7 Vulnerability & Exploit Database

Local Privilege Escalation in polkits pkexec

Back to Search

Local Privilege Escalation in polkits pkexec



A bug exists in the polkit pkexec binary in how it processes arguments. If the binary is provided with no arguments, it will continue to process environment variables as argument variables, but without any security checking. By using the execve call we can specify a null argument list and populate the proper environment variables. This exploit is architecture independent.


  • Qualys Security
  • Andris Raugulis
  • Dhiraj Mishra
  • bwatters-r7




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/cve_2021_4034_pwnkit_lpe_pkexec
msf exploit(cve_2021_4034_pwnkit_lpe_pkexec) > show targets
msf exploit(cve_2021_4034_pwnkit_lpe_pkexec) > set TARGET < target-id >
msf exploit(cve_2021_4034_pwnkit_lpe_pkexec) > show options
    ...show and set options...
msf exploit(cve_2021_4034_pwnkit_lpe_pkexec) > 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