From 9473d002745cf8bf1ff988bfab473a06065fcb86 Mon Sep 17 00:00:00 2001 From: Tim W Date: Wed, 22 Sep 2021 22:40:47 +0100 Subject: [PATCH] fix php recursive search --- php/meterpreter/ext_server_stdapi.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/php/meterpreter/ext_server_stdapi.php b/php/meterpreter/ext_server_stdapi.php index 172c26d3..13de68f2 100755 --- a/php/meterpreter/ext_server_stdapi.php +++ b/php/meterpreter/ext_server_stdapi.php @@ -358,8 +358,11 @@ function safe_glob($pattern, $flags=0, $start_date=null, $end_date=null) { && (!is_link($path."/".$file)) ) ) { - $glob = array_merge($glob, array_prepend(safe_glob($path.'/'.$file.'/'.$mask, $flags, $start_date, $end_date), - ($flags&GLOB_PATH?'':$file.'/'))); + $newglob = safe_glob($path.'/'.$file.'/'.$mask, $flags, $start_date, $end_date); + if ($newglob !== false) { + $glob = array_merge($glob, array_prepend($newglob, + ($flags&GLOB_PATH?'':$file.'/'))); + } } // Match file mask if (fnmatch($mask,$file)) {