From 3768061e7129176aef5ed04f745343abc30e12d0 Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 9 Dec 2024 16:00:56 +0100 Subject: [PATCH] fix security vuln #225 --- pandora_console/godmode/servers/plugin.php | 66 ++++++++++++---------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php index 79d0f11870..3cf7de1803 100644 --- a/pandora_console/godmode/servers/plugin.php +++ b/pandora_console/godmode/servers/plugin.php @@ -217,37 +217,43 @@ if ($filemanager) { if ($edit_file) { $location_file = io_safe_output(get_parameter('location_file', '')); $filename = array_pop(explode('/', $location_file)); - $file = file_get_contents($location_file); - echo '

'.__('Edit file').' '.$filename.'

'; - // echo "" . __('Back to file explorer') . ""; - echo "
"; - // html_print_input_hidden('location_file', $locationFile); - echo ""; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ""; - echo ''; - echo ''; - echo '
'.__('Edit').'
'; - echo "'; - echo '
'; - html_print_input_hidden('location_file', $location_file); - echo __('Compatibility mode').':'; - $options = [ - 'unix' => 'Unix', - 'windows' => 'Windows', - ]; - html_print_select($options, 'compatibility', $compatibility); - echo " "; - echo '
'; - echo '
'; + if (empty($location_file) === false + && strpos($location_file, realpath('attachment/plugin')) !== false + && file_exists($location_file) === true + ) { + $file = file_get_contents($location_file); + echo '

'.__('Edit file').' '.$filename.'

'; + echo "
"; + echo ""; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ""; + echo ''; + echo ''; + echo '
'.__('Edit').'
'; + echo "'; + echo '
'; + html_print_input_hidden('location_file', $location_file); + + echo __('Compatibility mode').':'; + $options = [ + 'unix' => 'Unix', + 'windows' => 'Windows', + ]; + html_print_select($options, 'compatibility', $compatibility); + echo " "; + echo '
'; + echo '
'; + } else { + echo __('File not found'); + } } else { if ($update_file) { $location_file = io_safe_output(get_parameter('location_file', ''));