Skip to content

Commit

Permalink
Fix: Arbitrary File Read
Browse files Browse the repository at this point in the history
  • Loading branch information
robertSt7 authored and aryaantony92 committed Apr 19, 2023
1 parent 21e35af commit 1d12840
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -2463,7 +2463,12 @@ public function importServerFilesAction(Request $request)
if (!$assetFolder) {
throw $this->createNotFoundException('Parent asset not found');
}
$serverPath = PIMCORE_PROJECT_ROOT . $request->get('serverPath');

$serverPath = realpath(PIMCORE_PROJECT_ROOT . $request->get('serverPath'));
if(!str_starts_with($serverPath, rtrim(str_replace('../', '', PIMCORE_PROJECT_ROOT), './'))) {
throw $this->createAccessDeniedException('Please do not navigate out of the web root directory!');
}

$files = explode('::', $request->get('files'));

foreach ($files as $file) {
Expand Down

0 comments on commit 1d12840

Please sign in to comment.