Fix #9602, a little defensive programming

Check for a nil message and unnecessary auth failures while looping.
MS-2855/keylogger-mettle-extension
William Vu 2018-02-26 16:51:23 -06:00
parent 95a019675f
commit 0e4fc48df4
No known key found for this signature in database
GPG Key ID: 68BD00CE25866743
1 changed files with 9 additions and 0 deletions

View File

@ -29,15 +29,22 @@ module Msf::Exploit::Remote::Fortinet
password || ''
))
tried = false
loop do
message = session.next_message
return false unless message
case message.type
when USERAUTH_SUCCESS
debug { 'Received SSH_MSG_USERAUTH_SUCCESS' }
return true
when USERAUTH_FAILURE
debug { 'Received SSH_MSG_USERAUTH_FAILURE' }
break if tried
debug { 'Sending SSH_MSG_USERAUTH_REQUEST (keyboard-interactive)' }
send_message(userauth_request(
@ -54,6 +61,8 @@ module Msf::Exploit::Remote::Fortinet
'',
''
))
tried = true
when USERAUTH_INFO_REQUEST
debug { 'Received SSH_MSG_USERAUTH_INFO_REQUEST' }