Rapid7 Vulnerability & Exploit Database

ptrace Sudo Token Privilege Escalation

Back to Search

ptrace Sudo Token Privilege Escalation

Disclosed
03/24/2019
Created
09/02/2019

Description

This module attempts to gain root privileges by blindly injecting into the session user's running shell processes and executing commands by calling `system()`, in the hope that the process has valid cached sudo tokens with root privileges. The system must have gdb installed and permit ptrace. This module has been tested successfully on: Debian 9.8 (x64); and CentOS 7.4.1708 (x64).

Author(s)

  • chaignc
  • bcoles <bcoles@gmail.com>

Platform

Linux

Architectures

x86, x64, armle, aarch64, ppc, mipsle, mipsbe

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

;