@@ -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