
Local privilege escalation exploit for CVE-2019-13272, a Linux kernel ptrace vulnerability, allowing unprivileged users to gain root access via pkexec. Includes PoC source and compilation instructions.
⚠️ For educational and authorized security research purposes only
Very grateful to the original PoC author BCOLES
In the Linux kernel before 5.1.17, ptrace_link in kernel/ptrace.c mishandles the recording of the credentials of a process that wants to create a ptrace relationship, which allows local users to obtain root access by leveraging certain scenarios with a parent-child process relationship, where a parent drops privileges and calls execve (potentially allowing control by an attacker). One contributing factor is an object lifetime issue (which can also cause a panic). Another contributing factor is incorrect marking of a ptrace relationship as privileged, which is exploitable through (for example) Polkit's pkexec helper with PTRACE_TRACEME. NOTE: SELinux deny_ptrace might be a usable workaround in some environments.

Install git, then clone the script from the github repository:
sudo apt install git -y
git clone https://github.com/asepsaepdin/CVE-2019-13272.git
Compile the poc.c with gcc using command:
cd CVE-2019-13272
gcc -s poc.c -o become_root
Run the script using command:
./become_root