Fix #9602, a little defensive programming
Check for a nil message and unnecessary auth failures while looping.MS-2855/keylogger-mettle-extension
parent
95a019675f
commit
0e4fc48df4
|
@ -29,15 +29,22 @@ module Msf::Exploit::Remote::Fortinet
|
||||||
password || ''
|
password || ''
|
||||||
))
|
))
|
||||||
|
|
||||||
|
tried = false
|
||||||
|
|
||||||
loop do
|
loop do
|
||||||
message = session.next_message
|
message = session.next_message
|
||||||
|
|
||||||
|
return false unless message
|
||||||
|
|
||||||
case message.type
|
case message.type
|
||||||
when USERAUTH_SUCCESS
|
when USERAUTH_SUCCESS
|
||||||
debug { 'Received SSH_MSG_USERAUTH_SUCCESS' }
|
debug { 'Received SSH_MSG_USERAUTH_SUCCESS' }
|
||||||
return true
|
return true
|
||||||
when USERAUTH_FAILURE
|
when USERAUTH_FAILURE
|
||||||
debug { 'Received SSH_MSG_USERAUTH_FAILURE' }
|
debug { 'Received SSH_MSG_USERAUTH_FAILURE' }
|
||||||
|
|
||||||
|
break if tried
|
||||||
|
|
||||||
debug { 'Sending SSH_MSG_USERAUTH_REQUEST (keyboard-interactive)' }
|
debug { 'Sending SSH_MSG_USERAUTH_REQUEST (keyboard-interactive)' }
|
||||||
|
|
||||||
send_message(userauth_request(
|
send_message(userauth_request(
|
||||||
|
@ -54,6 +61,8 @@ module Msf::Exploit::Remote::Fortinet
|
||||||
'',
|
'',
|
||||||
''
|
''
|
||||||
))
|
))
|
||||||
|
|
||||||
|
tried = true
|
||||||
when USERAUTH_INFO_REQUEST
|
when USERAUTH_INFO_REQUEST
|
||||||
debug { 'Received SSH_MSG_USERAUTH_INFO_REQUEST' }
|
debug { 'Received SSH_MSG_USERAUTH_INFO_REQUEST' }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue