Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Fixed rename failing to prevent rename to restricted file extension in media library, 'Remote Code Execution via Chained Rename Bypass and .htaccess PHP Handler Injection', reported by @kdalal-vulncheck https://github.com/givanz/Vvveb/issues/419

givanz6fb8eaa99826
diff --git a/system/traits/media.php b/system/traits/media.php
index e0c5ea1..7239515 100644
--- a/system/traits/media.php
+++ b/system/traits/media.php
@@ -205,6 +205,8 @@ trait Media {
$duplicate = $this->request->post['duplicate'] ?? false;
$dirMedia = $this->dirMedia;
+ $this->response->setType('json');
+
$currentFile = $dirMedia . DS . $file;
if ($newfile) {
$targetFile = $dirMedia . DS . $newfile;
@@ -217,8 +219,9 @@ trait Media {
$extension = strtolower(substr($targetFile, strrpos($targetFile, '.') + 1));
if (isset($this->uploadDenyExtensions) && in_array($extension, $this->uploadDenyExtensions)) {
- $message .= __('File type not allowed!');
- $success = false;
+ $message = ['success' => false, 'message' => __('File type not allowed!')];
+ $this->response->output($message);
+ return;
}
if ($duplicate) {
@@ -235,7 +238,6 @@ trait Media {
}
}
- $this->response->setType('json');
$this->response->output($message);
}