
Proof-of-concept exploit for CVE-2022-0847 (Dirty Pipe) enabling local privilege escalation on Linux kernels 5.8–5.16 via pipe buffer manipulation and SUID binary hijacking.
This repository contains a Proof of Concept (PoC) exploit for the Dirty Pipe vulnerability (CVE-2022-0847), which affects Linux kernel versions 5.8 to 5.16. This vulnerability allows local privilege escalation by exploiting improper handling of pipe buffers in the kernel, enabling an attacker to modify read-only files (such as SUID binaries) and execute arbitrary code with elevated privileges.
The Dirty Pipe vulnerability is a critical issue found in Linux kernel versions between 5.8 and 5.16. It allows local privilege escalation by exploiting improper handling of pipe buffers in the kernel. This vulnerability can be triggered by writing to a read-only file (such as SUID binaries), which can lead to arbitrary code execution and potentially a root shell on the affected system.
To compile the exploit, run the following command:
gcc dirtypipe.c -Wall -O2 -fno-pie -no-pie -o dirtypipe
Notes:
Ensure that the target SUID binary is exploitable and resides in a path that can be accessed by the user running the exploit.
The system must be running a vulnerable version of the Linux kernel (5.8 to 5.16).
Anti-Debugging Features The exploit contains an anti-debugging mechanism to prevent detection by debugging tools such as gdb. If the exploit detects the presence of a debugger, it will terminate early, making it more difficult for attackers to analyze the code.
How It Works: The exploit checks for debugging activity by inspecting /proc/self/status and uses ptrace system calls to detect if the program is being traced by a debugger.
If a debugger is detected, the exploit will stop executing and exit, making reverse engineering harder.
Disclaimer This exploit is provided for educational and research purposes only. Unauthorized use of this exploit is illegal and unethical. Running this exploit on any system without explicit permission from the system owner is prohibited and could result in legal consequences.
The author is not responsible for any damages, data loss, or legal ramifications resulting from the use or misuse of this exploit.