Skip to content

Commit 04a701d

Browse files
committed
Check template file extension name
1 parent ee13195 commit 04a701d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/exploits/multi/fileformat/office_word_macro.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,11 @@ def get_template_path
265265

266266
def exploit
267267
template_path = get_template_path
268+
269+
unless File.extname(template_path).match(/\.docx$/i)
270+
fail_with(Failure::BadConfig, 'Template is not a docx file.')
271+
end
272+
268273
print_status("Using template: #{template_path}")
269274
@docx = unpack_docx(template_path)
270275

@@ -277,7 +282,6 @@ def exploit
277282
print_status("Finalizing docm: #{datastore['FILENAME']}")
278283
docm = pack_docm
279284
file_create(docm)
280-
super
281285
end
282286

283287
end

0 commit comments

Comments
 (0)