Skip to content

Commit aaea730

Browse files
committed
Fix rapid7#6213 - Method to_linux_x86_elf fails to set set :template
:template by default is just the base name of the file, not the fullname. Before we use it, we need to normalize it. Methods in this class rely on set_template_default for normalization ( which can also handle a custom path), so we'll just use that too. Fix rapid7#6213
1 parent ee25cb8 commit aaea730

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/msf/util/exe.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,11 @@ def self.to_linux_x86_elf(framework, code, opts = {})
992992
if default
993993
elf = to_exe_elf(framework, opts, "template_x86_linux.bin", code)
994994
else
995+
# Use set_template_default to normalize the :template key. It will just end up doing
996+
# opts[:template] = File.join(opts[:template_path], opts[:template])
997+
# for us, check if the file exists.
998+
set_template_default(opts)
999+
9951000
# If this isn't our normal template, we have to do some fancy
9961001
# header patching to mark the .text section rwx before putting our
9971002
# payload into the entry point.

0 commit comments

Comments
 (0)