From cd0161ada2e34b337f132e3ec0b5127133a533f0 Mon Sep 17 00:00:00 2001 From: Tim W Date: Mon, 21 May 2018 16:46:42 +0800 Subject: [PATCH] fix gcc for shell_reverse_tcp payloads on ubuntu --- .../linux/local/af_packet_chocobo_root_priv_esc.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/exploits/linux/local/af_packet_chocobo_root_priv_esc.rb b/modules/exploits/linux/local/af_packet_chocobo_root_priv_esc.rb index b5a4dd78fd..acb9b57a20 100644 --- a/modules/exploits/linux/local/af_packet_chocobo_root_priv_esc.rb +++ b/modules/exploits/linux/local/af_packet_chocobo_root_priv_esc.rb @@ -93,7 +93,12 @@ class MetasploitModule < Msf::Exploit::Local def upload_and_compile(path, data) upload "#{path}.c", data - output = cmd_exec "gcc -o #{path} #{path}.c -lpthread" + + gcc_cmd = "gcc -o #{path} #{path}.c -lpthread" + if session.type.eql? 'shell' + gcc_cmd = "PATH=$PATH:/usr/bin/ #{gcc_cmd}" + end + output = cmd_exec gcc_cmd unless output.blank? print_error output