This commit is contained in:
Diego Najar 2019-09-08 10:45:56 +02:00
parent 3dd31b9d11
commit a9640ff6b5
1 changed files with 10 additions and 1 deletions

View File

@ -14,6 +14,15 @@ header('Content-Type: application/json');
$uuid = empty($_POST['uuid']) ? false : $_POST['uuid']; $uuid = empty($_POST['uuid']) ? false : $_POST['uuid'];
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Check path traversal on $uuid
if ($uuid) {
if (Text::stringContains($uuid, DS, false)) {
$message = 'Path traversal detected.';
Log::set($message, LOG_TYPE_ERROR);
ajaxResponse(1, $message);
}
}
// Set upload directory // Set upload directory
if ($uuid && IMAGE_RESTRICT) { if ($uuid && IMAGE_RESTRICT) {
$imageDirectory = PATH_UPLOADS_PAGES.$uuid.DS; $imageDirectory = PATH_UPLOADS_PAGES.$uuid.DS;
@ -38,7 +47,7 @@ foreach ($_FILES['images']['name'] as $uuid=>$filename) {
// Convert URL characters such as spaces or quotes to characters // Convert URL characters such as spaces or quotes to characters
$filename = urldecode($filename); $filename = urldecode($filename);
// Check path traversal // Check path traversal on $filename
if (Text::stringContains($filename, DS, false)) { if (Text::stringContains($filename, DS, false)) {
$message = 'Path traversal detected.'; $message = 'Path traversal detected.';
Log::set($message, LOG_TYPE_ERROR); Log::set($message, LOG_TYPE_ERROR);