MODULE

Ubuntu needrestart Privilege Escalation

Try Surface Command Get a continuous 360° view of your attack surface
Back to Search

Ubuntu needrestart Privilege Escalation

Disclosed
11/19/2024
Created
01/10/2025

Description

Local attackers can execute arbitrary code as root by tricking needrestart into running the Python interpreter with an attacker-controlled PYTHONPATH environment variable. Verified against Ubuntu 22.04 with needrestart 3.5-5ubuntu2.1 Attempted exploitation against Debian 12, expliotation failed

Author(s)

  • h00die
  • makuga01
  • qualys

Platform

Linux

Architectures

x86, x64

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

;