diff --git a/pandora_console/extensions/files_repo/files_repo_list.php b/pandora_console/extensions/files_repo/files_repo_list.php index 80de4563ae..e0ca07366d 100644 --- a/pandora_console/extensions/files_repo/files_repo_list.php +++ b/pandora_console/extensions/files_repo/files_repo_list.php @@ -64,9 +64,11 @@ if (!empty($files)) { $document_root = str_replace('\\', '/', io_safe_output($_SERVER['DOCUMENT_ROOT'])); $file['location'] = str_replace('\\', '/', io_safe_output($file['location'])); $relative_path = str_replace($document_root, '', $file['location']); - $file_path = base64_encode($relative_path); - $hash = md5($relative_path.$config['dbpass']); - $url = ui_get_full_url("include/get_file.php?file=$file_path&hash=$hash"); + $file_name = explode('/', $file['location']); + $file_decoded = $file_name[(count($file_name) - 1)]; + $file_path = base64_encode($file_decoded); + $hash = md5($file_path.$config['dbpass']); + $url = ui_get_full_url('include/get_file.php?file='.urlencode($file_path).'&hash='.$hash); $date_format = ($config['date_format']) ? io_safe_output($config['date_format']) : 'F j, Y - H:m'; $data[0] = "".$file['name'].''; diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index 2c8ed90ee4..a3cf4ac0a5 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -690,8 +690,9 @@ function filemanager_file_explorer( $data[1] = ''.$fileinfo['name'].''; } else { - $hash = md5($relative_path.$config['dbpass']); - $data[1] = ''.$fileinfo['name'].''; + $filename = base64_encode($relative_directory.'/'.$fileinfo['name']); + $hash = md5($filename.$config['dbpass']); + $data[1] = ''.$fileinfo['name'].''; } // Notice that uploaded php files could be dangerous @@ -751,8 +752,9 @@ function filemanager_file_explorer( } if ((!$fileinfo['is_dir']) && ($download_button)) { - $hash = md5($fileinfo['realpath'].$config['dbpass']); - $data[4] .= ''; + $filename = base64_encode($fileinfo['name']); + $hash = md5($filename.$config['dbpass']); + $data[4] .= ''; $data[4] .= html_print_image('images/file.png', true); $data[4] .= ''; } diff --git a/pandora_console/include/get_file.php b/pandora_console/include/get_file.php index 0f0fd30353..550e7e92fd 100644 --- a/pandora_console/include/get_file.php +++ b/pandora_console/include/get_file.php @@ -29,29 +29,42 @@ if ($auth_method != 'ad' && $auth_method != 'ldap') { $styleError = 'background:url("../images/err.png") no-repeat scroll 0 0 transparent; padding:4px 1px 6px 30px; color:#CC0000;'; -$file = get_parameter('file', null); +$file_raw = get_parameter('file', null); -$file = base64_decode($file); +$file = base64_decode(urldecode($file_raw)); $hash = get_parameter('hash', null); -$testHash = md5($file.$config['dbpass']); - -if ($hash != $testHash) { +if ($file === '' || $hash === '' || $hash !== md5($file_raw.$config['dbpass']) || !isset($_SERVER['HTTP_REFERER'])) { echo "