Rapid7 Vulnerability & Exploit Database

Dirty Pipe Local Privilege Escalation via CVE-2022-0847

Back to Search

Dirty Pipe Local Privilege Escalation via CVE-2022-0847

Disclosed
02/20/2022
Created
03/11/2022

Description

This exploit targets a vulnerability in the Linux kernel since 5.8, that allows writing of read only or immutable memory. The vulnerability was fixed in Linux 5.16.11, 5.15.25 and 5.10.102. The module exploits this vulnerability by overwriting a suid binary with the payload, executing it, and then writing the original data back. There are two major limitations of this exploit: the offset cannot be on a page boundary (it needs to write one byte before the offset to add a reference to this page to the pipe), and the write cannot cross a page boundary. This means the payload must be less than the page size (4096 bytes).

Author(s)

  • Max Kellermann
  • timwr

Platform

Linux

Architectures

x64, x86, armle, aarch64

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

;