Skip to content

armgit / Vvveb

Public Imported from GitHub
0

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

Fixed vulnerability "Unauthenticated Remote Code Execution via PHP Code Injection into 'env.php' During Installation", reported by @sh4dowalker Mohammed EL OUARDANI

givanz5162c1639130
diff --git a/install/controller/index.php b/install/controller/index.php
index 0ce2aeb..bc5d775 100755
--- a/install/controller/index.php
+++ b/install/controller/index.php
@@ -24,6 +24,7 @@ namespace Vvveb\Controller;
use function Vvveb\__;
use function Vvveb\installedLanguages;
+use function Vvveb\sanitizeFileName;
use function Vvveb\session as sess;
use function Vvveb\setLanguage;
use Vvveb\Sql\LanguageSQL;
@@ -386,6 +387,7 @@ class Index extends Base {
$subdir = $this->request->post['subdir'] ?? $this->subdir ?? false;
if ($subdir) {
+ $subdir = sanitizeFileName($subdir);
$subdir = '/' . trim($subdir, '/ ');
//add subdir path to menu links
$menus = new menuSQL();
diff --git a/system/functions.php b/system/functions.php
index 061bd45..e3f33e4 100755
--- a/system/functions.php
+++ b/system/functions.php
@@ -1205,13 +1205,12 @@ function sanitizeFileName($file, $normalizePath = true) {
//remove null bytes
$file = str_replace(chr(0), '', $file);
//sanitize, remove double dot .. and remove get parameters if any
- $file = preg_replace('@\?.*$|\.{2,}|[^\/\\a-zA-Z0-9\-\._]@' , '', $file);
- $file = preg_replace('@[^\/\w\s\d\.\-_~,;:\[\]\(\)\\]|[\.]{2,}@', '', $file);
+ $file = preg_replace('@\?.*$|\.{2,}|[^\w\-\./\\\]@' , '', $file);
//replace directory separators with OS specific separator
if ($normalizePath) {
$file = str_replace(['\\', '/'], DS, $file);
}
-
+
return $file;
}