Land #10456, known_hosts fix for SSH modules
parent
e11266f0a0
commit
bf7c530f7e
|
@ -55,7 +55,8 @@ module Metasploit
|
|||
:config => false,
|
||||
:verbose => verbosity,
|
||||
:proxy => factory,
|
||||
:non_interactive => true
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
case credential.private_type
|
||||
when :password, nil
|
||||
|
|
|
@ -70,13 +70,14 @@ class MetasploitModule < Msf::Auxiliary
|
|||
def do_login(user, pass, ip)
|
||||
factory = ssh_socket_factory
|
||||
opts = {
|
||||
auth_methods: ['password'],
|
||||
port: rport,
|
||||
config: false,
|
||||
use_agent: false,
|
||||
password: pass,
|
||||
proxy: factory,
|
||||
non_interactive: true
|
||||
:auth_methods => ['password'],
|
||||
:port => rport,
|
||||
:config => false,
|
||||
:use_agent => false,
|
||||
:password => pass,
|
||||
:proxy => factory,
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
|
||||
opts.merge!(verbose: :debug) if datastore['SSH_DEBUG']
|
||||
|
|
|
@ -67,13 +67,14 @@ class MetasploitModule < Msf::Auxiliary
|
|||
|
||||
def check_vulnerable(ip)
|
||||
opt_hash = {
|
||||
port: rport,
|
||||
auth_methods: ['password', 'keyboard-interactive'],
|
||||
use_agent: false,
|
||||
config: false,
|
||||
password_prompt: Net::SSH::Prompt.new,
|
||||
non_interactive: true,
|
||||
proxies: datastore['Proxies']
|
||||
:port => rport,
|
||||
:auth_methods => ['password', 'keyboard-interactive'],
|
||||
:use_agent => false,
|
||||
:config => false,
|
||||
:password_prompt => Net::SSH::Prompt.new,
|
||||
:non_interactive => true,
|
||||
:proxies => datastore['Proxies'],
|
||||
:verify_host_key => :never
|
||||
}
|
||||
|
||||
begin
|
||||
|
@ -105,11 +106,12 @@ class MetasploitModule < Msf::Auxiliary
|
|||
pass = Rex::Text.rand_text_alphanumeric(8)
|
||||
|
||||
opt_hash = {
|
||||
auth_methods: ['password', 'keyboard-interactive'],
|
||||
port: port,
|
||||
use_agent: false,
|
||||
config: false,
|
||||
proxies: datastore['Proxies']
|
||||
:auth_methods => ['password', 'keyboard-interactive'],
|
||||
:port => port,
|
||||
:use_agent => false,
|
||||
:config => false,
|
||||
:proxies => datastore['Proxies'],
|
||||
:verify_host_key => :never
|
||||
}
|
||||
|
||||
opt_hash.merge!(verbose: :debug) if datastore['SSH_DEBUG']
|
||||
|
|
|
@ -55,6 +55,7 @@ class MetasploitModule < Msf::Auxiliary
|
|||
non_interactive: true,
|
||||
config: false,
|
||||
use_agent: false,
|
||||
verify_host_key: :never,
|
||||
proxy: factory
|
||||
}
|
||||
|
||||
|
|
|
@ -43,11 +43,12 @@ class MetasploitModule < Msf::Auxiliary
|
|||
def run_host(ip)
|
||||
factory = ssh_socket_factory
|
||||
ssh_opts = {
|
||||
port: rport,
|
||||
auth_methods: ['password', 'keyboard-interactive'],
|
||||
password: %q{<<< %s(un='%s') = %u},
|
||||
proxy: factory,
|
||||
:non_interactive => true
|
||||
:port => rport,
|
||||
:auth_methods => ['password', 'keyboard-interactive'],
|
||||
:password => %q{<<< %s(un='%s') = %u},
|
||||
:proxy => factory,
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
|
||||
ssh_opts.merge!(verbose: :debug) if datastore['SSH_DEBUG']
|
||||
|
|
|
@ -86,7 +86,8 @@ class MetasploitModule < Msf::Auxiliary
|
|||
:password => pass,
|
||||
:config => false,
|
||||
:proxy => factory,
|
||||
:non_interactive => true
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
|
||||
opt_hash.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||
|
|
|
@ -208,9 +208,10 @@ class MetasploitModule < Msf::Auxiliary
|
|||
:port => port,
|
||||
:key_data => key_data[:public],
|
||||
:use_agent => false,
|
||||
:config =>false,
|
||||
:config => false,
|
||||
:proxy => factory,
|
||||
:non_interactive => true
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
|
||||
opt_hash.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||
|
|
|
@ -79,13 +79,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
def do_login(user, pass)
|
||||
factory = ssh_socket_factory
|
||||
opts = {
|
||||
auth_methods: ['password', 'keyboard-interactive'],
|
||||
port: rport,
|
||||
use_agent: false,
|
||||
config: false,
|
||||
password: pass,
|
||||
proxy: factory,
|
||||
non_interactive: true
|
||||
:auth_methods => ['password', 'keyboard-interactive'],
|
||||
:port => rport,
|
||||
:use_agent => false,
|
||||
:config => false,
|
||||
:password => pass,
|
||||
:proxy => factory,
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
|
||||
opts.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||
|
|
|
@ -74,13 +74,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
def do_login(user)
|
||||
factory = Rex::Socket::SSHFactory.new(framework,self, datastore['Proxies'])
|
||||
opt_hash = {
|
||||
auth_methods: ['publickey'],
|
||||
port: rport,
|
||||
key_data: [ key_data ],
|
||||
use_agent: false,
|
||||
config: false,
|
||||
proxy: factory,
|
||||
non_interactive: true
|
||||
:auth_methods => ['publickey'],
|
||||
:port => rport,
|
||||
:key_data => [ key_data ],
|
||||
:use_agent => false,
|
||||
:config => false,
|
||||
:proxy => factory,
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
opt_hash.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||
begin
|
||||
|
|
|
@ -118,13 +118,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
factory = ssh_socket_factory
|
||||
|
||||
ssh_options = {
|
||||
auth_methods: ['publickey'],
|
||||
config: false,
|
||||
use_agent: false,
|
||||
key_data: [ key_data ],
|
||||
port: rport,
|
||||
proxy: factory,
|
||||
non_interactive: true
|
||||
:auth_methods => ['publickey'],
|
||||
:config => false,
|
||||
:use_agent => false,
|
||||
:key_data => [ key_data ],
|
||||
:port => rport,
|
||||
:proxy => factory,
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
ssh_options.merge!(verbose: :debug) if datastore['SSH_DEBUG']
|
||||
|
||||
|
|
|
@ -77,13 +77,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
factory = Rex::Socket::SSHFactory.new(framework, self, datastore['Proxies'])
|
||||
|
||||
opt_hash = {
|
||||
auth_methods: ['publickey'],
|
||||
port: rport,
|
||||
key_data: [ key_data ],
|
||||
use_agent: false,
|
||||
config: false,
|
||||
proxy: factory,
|
||||
non_interactive: true
|
||||
:auth_methods => ['publickey'],
|
||||
:port => rport,
|
||||
:key_data => [ key_data ],
|
||||
:use_agent => false,
|
||||
:config => false,
|
||||
:proxy => factory,
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
opt_hash[:verbose] = :debug if datastore['SSH_DEBUG']
|
||||
|
||||
|
|
|
@ -77,7 +77,8 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
:use_agent => false,
|
||||
:config => false,
|
||||
:proxy => factory,
|
||||
:non_interactive => true
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
opt_hash.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||
begin
|
||||
|
|
|
@ -74,13 +74,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
def exploit
|
||||
factory = ssh_socket_factory
|
||||
ssh_options = {
|
||||
auth_methods: ['publickey'],
|
||||
config: false,
|
||||
use_agent: false,
|
||||
key_data: [ ssh_priv_key ],
|
||||
port: rport,
|
||||
proxy: factory,
|
||||
non_interactive: true
|
||||
:auth_methods => ['publickey'],
|
||||
:config => false,
|
||||
:use_agent => false,
|
||||
:key_data => [ ssh_priv_key ],
|
||||
:port => rport,
|
||||
:proxy => factory,
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
|
||||
ssh_options.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||
|
|
|
@ -76,7 +76,8 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
:use_agent => false,
|
||||
:config => false,
|
||||
:proxy => factory,
|
||||
:non_interactive => true
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
opt_hash.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||
begin
|
||||
|
|
|
@ -88,7 +88,8 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
:config => true,
|
||||
:password => pass,
|
||||
:proxy => factory,
|
||||
:non_interactive => true
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
|
||||
opts.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||
|
|
|
@ -81,7 +81,8 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
:config => false,
|
||||
:password => password,
|
||||
:proxy => factory,
|
||||
:non_interactive => true
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
|
||||
opts.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||
|
|
|
@ -92,7 +92,8 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
:config => false,
|
||||
:password => pass,
|
||||
:proxy => factory,
|
||||
:non_interactive => true
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
|
||||
opts.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||
|
|
|
@ -130,6 +130,7 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
non_interactive: true,
|
||||
config: false,
|
||||
use_agent: false,
|
||||
verify_host_key: :never,
|
||||
proxy: factory
|
||||
}
|
||||
|
||||
|
|
|
@ -70,13 +70,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
def do_login()
|
||||
factory = Rex::Socket::SSHFactory.new(framework,self, datastore['Proxies'])
|
||||
opt_hash = {
|
||||
auth_methods: ['publickey'],
|
||||
port: rport,
|
||||
key_data: [ key_data ],
|
||||
use_agent: false,
|
||||
config: false,
|
||||
proxy: factory,
|
||||
non_interactive: true
|
||||
:auth_methods => ['publickey'],
|
||||
:port => rport,
|
||||
:key_data => [ key_data ],
|
||||
:use_agent => false,
|
||||
:config => false,
|
||||
:proxy => factory,
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
opt_hash.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||
begin
|
||||
|
|
|
@ -147,13 +147,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
def do_login(ip, user, pass, port)
|
||||
factory = ssh_socket_factory
|
||||
opt_hash = {
|
||||
auth_methods: ['password', 'keyboard-interactive'],
|
||||
port: port,
|
||||
use_agent: false,
|
||||
config: false,
|
||||
password: pass,
|
||||
proxy: factory,
|
||||
non_interactive: true
|
||||
:auth_methods => ['password', 'keyboard-interactive'],
|
||||
:port => port,
|
||||
:use_agent => false,
|
||||
:config => false,
|
||||
:password => pass,
|
||||
:proxy => factory,
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
|
||||
opt_hash[:verbose] = :debug if (datastore['SSH_DEBUG'])
|
||||
|
|
|
@ -107,7 +107,8 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
:config => true,
|
||||
:key_data => key_data,
|
||||
:proxy => factory,
|
||||
:non_interactive => true
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
|
||||
opts
|
||||
|
@ -123,7 +124,8 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
:config => true,
|
||||
:password => pass,
|
||||
:proxy => factory,
|
||||
:non_interactive => true
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
|
||||
opts
|
||||
|
|
|
@ -186,7 +186,11 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
end
|
||||
|
||||
def init_ssh(user)
|
||||
opts = {:user=>user, :port=>rport}
|
||||
opts = {
|
||||
:user => user,
|
||||
:port => rport,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
options = Net::SSH::Config.for(rhost, Net::SSH::Config.default_files).merge(opts)
|
||||
transport = Net::SSH::Transport::Session.new(rhost, options)
|
||||
connection = Net::SSH::Connection::Session.new(transport, options)
|
||||
|
|
|
@ -80,12 +80,13 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
|
||||
def setup_ssh_options
|
||||
{
|
||||
password: rand_text_alpha(8),
|
||||
port: datastore['RPORT'],
|
||||
timeout: 1,
|
||||
proxies: datastore['Proxies'],
|
||||
key_data: OpenSSL::PKey::RSA.new(2048).to_pem,
|
||||
auth_methods: ['publickey']
|
||||
:password => rand_text_alpha(8),
|
||||
:port => datastore['RPORT'],
|
||||
:timeout => 1,
|
||||
:proxies => datastore['Proxies'],
|
||||
:key_data => OpenSSL::PKey::RSA.new(2048).to_pem,
|
||||
:auth_methods => ['publickey'],
|
||||
:verify_host_key => :never
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -202,7 +202,8 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
timeout: 1,
|
||||
proxy: factory,
|
||||
config: false,
|
||||
non_interactive: true
|
||||
non_interactive: true,
|
||||
verify_host_key: :never
|
||||
)
|
||||
|
||||
::Timeout.timeout(1) { ssh.close }
|
||||
|
|
|
@ -145,7 +145,8 @@ RSpec.describe Metasploit::Framework::LoginScanner::SSH do
|
|||
:proxy => factory,
|
||||
:auth_methods => ['password','keyboard-interactive'],
|
||||
:password => private,
|
||||
:non_interactive => true
|
||||
:non_interactive => true,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
allow(Rex::Socket::SSHFactory).to receive(:new).and_return factory
|
||||
expect(Net::SSH).to receive(:start).with(
|
||||
|
@ -167,7 +168,8 @@ RSpec.describe Metasploit::Framework::LoginScanner::SSH do
|
|||
:key_data => key,
|
||||
:config => false,
|
||||
:verbose => ssh_scanner.verbosity,
|
||||
:proxy => factory
|
||||
:proxy => factory,
|
||||
:verify_host_key => :never
|
||||
}
|
||||
allow(Rex::Socket::SSHFactory).to receive(:new).and_return factory
|
||||
expect(Net::SSH).to receive(:start).with(
|
||||
|
|
Loading…
Reference in New Issue