Land #10471, Import target DefaultOptions into the datastore
parent
f3b9901c9f
commit
8c29a3b5da
|
@ -321,6 +321,9 @@ class Exploit < Msf::Module
|
||||||
self.active_timeout = info['Payload']['ActiveTimeout'].to_i
|
self.active_timeout = info['Payload']['ActiveTimeout'].to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Initialize exploit datastore with target information
|
||||||
|
import_target_datastore
|
||||||
|
|
||||||
# All exploits can increase the delay when waiting for a session.
|
# All exploits can increase the delay when waiting for a session.
|
||||||
# However, this only applies to aggressive exploits.
|
# However, this only applies to aggressive exploits.
|
||||||
if aggressive?
|
if aggressive?
|
||||||
|
@ -693,6 +696,14 @@ class Exploit < Msf::Module
|
||||||
return (target_idx) ? target_idx.to_i : nil
|
return (target_idx) ? target_idx.to_i : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# Import the target's DefaultOptions hash into the datastore.
|
||||||
|
#
|
||||||
|
def import_target_datastore
|
||||||
|
return unless target && target.default_options
|
||||||
|
datastore.import_options_from_hash(target.default_options)
|
||||||
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns the target's platform, or the one assigned to the module itself.
|
# Returns the target's platform, or the one assigned to the module itself.
|
||||||
#
|
#
|
||||||
|
|
|
@ -129,22 +129,29 @@ class Msf::Module::Target
|
||||||
# Payload-specific options, such as append, prepend, and other values that
|
# Payload-specific options, such as append, prepend, and other values that
|
||||||
# can be set on a per-exploit or per-target basis.
|
# can be set on a per-exploit or per-target basis.
|
||||||
#
|
#
|
||||||
|
# DefaultOptions
|
||||||
|
#
|
||||||
|
# DefaultOptions hash to be imported into the datastore.
|
||||||
|
#
|
||||||
def initialize(name, opts)
|
def initialize(name, opts)
|
||||||
opts = {} if (!opts)
|
opts = {} unless opts
|
||||||
|
|
||||||
self.name = name
|
self.name = name
|
||||||
self.platform = opts['Platform'] ? Msf::Module::PlatformList.transform(opts['Platform']) : nil
|
self.opts = opts
|
||||||
self.save_registers = opts['SaveRegisters']
|
self.save_registers = opts['SaveRegisters']
|
||||||
self.ret = opts['Ret']
|
self.ret = opts['Ret'],
|
||||||
self.opts = opts
|
self.default_options = opts['DefaultOptions']
|
||||||
|
|
||||||
if (opts['Arch'])
|
if opts['Platform']
|
||||||
self.arch = Rex::Transformer.transform(opts['Arch'], Array,
|
self.platform = Msf::Module::PlatformList.transform(opts['Platform'])
|
||||||
[ String ], 'Arch')
|
end
|
||||||
|
|
||||||
|
if opts['Arch']
|
||||||
|
self.arch = Rex::Transformer.transform(opts['Arch'], Array, [String], 'Arch')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Does this target have brute force information?
|
# Does this target have brute force information?
|
||||||
if (opts['Bruteforce'])
|
if opts['Bruteforce']
|
||||||
self.bruteforce = Bruteforce.new(opts['Bruteforce'])
|
self.bruteforce = Bruteforce.new(opts['Bruteforce'])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -305,10 +312,15 @@ class Msf::Module::Target
|
||||||
# option is passed to the constructor of the class.
|
# option is passed to the constructor of the class.
|
||||||
#
|
#
|
||||||
attr_reader :bruteforce
|
attr_reader :bruteforce
|
||||||
|
#
|
||||||
|
# DefaultOptions hash to be imported into the datastore.
|
||||||
|
#
|
||||||
|
attr_reader :default_options
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
attr_writer :name, :platform, :arch, :opts, :ret, :save_registers # :nodoc:
|
attr_writer :name, :platform, :arch, :opts, :ret, :save_registers # :nodoc:
|
||||||
attr_writer :bruteforce # :nodoc:
|
attr_writer :bruteforce # :nodoc:
|
||||||
|
attr_writer :default_options # :nodoc:
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1575,7 +1575,7 @@ class Core
|
||||||
# If the driver indicates that the value is not valid, bust out.
|
# If the driver indicates that the value is not valid, bust out.
|
||||||
if (driver.on_variable_set(global, name, value) == false)
|
if (driver.on_variable_set(global, name, value) == false)
|
||||||
print_error("The value specified for #{name} is not valid.")
|
print_error("The value specified for #{name} is not valid.")
|
||||||
return true
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
@ -1589,6 +1589,11 @@ class Core
|
||||||
elog(e.message)
|
elog(e.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Set PAYLOAD from TARGET
|
||||||
|
if name.upcase == 'TARGET' && active_module && active_module.exploit?
|
||||||
|
active_module.import_target_datastore
|
||||||
|
end
|
||||||
|
|
||||||
print_line("#{name} => #{datastore[name]}")
|
print_line("#{name} => #{datastore[name]}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
|
|
||||||
def initialize(info = {})
|
def initialize(info = {})
|
||||||
super(update_info(info,
|
super(update_info(info,
|
||||||
'Name' => 'HP VAN SDN Controller Root Command Injection',
|
'Name' => 'HP VAN SDN Controller Root Command Injection',
|
||||||
'Description' => %q{
|
'Description' => %q{
|
||||||
This module exploits a hardcoded service token or default credentials
|
This module exploits a hardcoded service token or default credentials
|
||||||
in HPE VAN SDN Controller <= 2.7.18.0503 to execute a payload as root.
|
in HPE VAN SDN Controller <= 2.7.18.0503 to execute a payload as root.
|
||||||
|
|
||||||
|
@ -27,34 +27,36 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
If the service token option TOKEN is blank, USERNAME and PASSWORD will
|
If the service token option TOKEN is blank, USERNAME and PASSWORD will
|
||||||
be used for authentication. An additional login request will be sent.
|
be used for authentication. An additional login request will be sent.
|
||||||
},
|
},
|
||||||
'Author' => [
|
'Author' => [
|
||||||
'Matt Bergin', # Vulnerability discovery and Python exploit
|
'Matt Bergin', # Vulnerability discovery and Python exploit
|
||||||
'wvu' # Metasploit module and additional ~research~
|
'wvu' # Metasploit module and additional ~research~
|
||||||
],
|
],
|
||||||
'References' => [
|
'References' => [
|
||||||
['EDB', '44951'],
|
['EDB', '44951'],
|
||||||
['URL', 'https://korelogic.com/Resources/Advisories/KL-001-2018-008.txt']
|
['URL', 'https://korelogic.com/Resources/Advisories/KL-001-2018-008.txt']
|
||||||
],
|
],
|
||||||
'DisclosureDate' => 'Jun 25 2018',
|
'DisclosureDate' => 'Jun 25 2018',
|
||||||
'License' => MSF_LICENSE,
|
'License' => MSF_LICENSE,
|
||||||
'Platform' => ['unix', 'linux'],
|
'Platform' => ['unix', 'linux'],
|
||||||
'Arch' => [ARCH_CMD, ARCH_X86, ARCH_X64],
|
'Arch' => [ARCH_CMD, ARCH_X86, ARCH_X64],
|
||||||
'Privileged' => true,
|
'Privileged' => true,
|
||||||
'Targets' => [
|
'Targets' => [
|
||||||
['Unix In-Memory',
|
['Unix In-Memory',
|
||||||
'Platform' => 'unix',
|
'Platform' => 'unix',
|
||||||
'Arch' => ARCH_CMD,
|
'Arch' => ARCH_CMD,
|
||||||
'Type' => :unix_memory,
|
'Type' => :unix_memory,
|
||||||
'Payload' => {'BadChars' => ' '}
|
'Payload' => {'BadChars' => ' '},
|
||||||
|
'DefaultOptions' => {'PAYLOAD' => 'cmd/unix/reverse_netcat_gaping'}
|
||||||
],
|
],
|
||||||
['Linux Dropper',
|
['Linux Dropper',
|
||||||
'Platform' => 'linux',
|
'Platform' => 'linux',
|
||||||
'Arch' => [ARCH_X86, ARCH_X64],
|
'Arch' => [ARCH_X86, ARCH_X64],
|
||||||
'Type' => :linux_dropper
|
'Type' => :linux_dropper,
|
||||||
|
'DefaultOptions' => {'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp'}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'DefaultTarget' => 0,
|
'DefaultTarget' => 0,
|
||||||
'DefaultOptions' => {'RPORT' => 8081, 'SSL' => true}
|
'DefaultOptions' => {'RPORT' => 8081, 'SSL' => true}
|
||||||
))
|
))
|
||||||
|
|
||||||
register_options([
|
register_options([
|
||||||
|
|
Loading…
Reference in New Issue