Skip to content

armgit / Vvveb

Public Imported from GitHub
0

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

Added recursive filtering sanitizeFileName(), vulnerability reported by @EvidentObscurity

givanz8c062a047a66
diff --git a/system/functions.php b/system/functions.php
index 204bf3a..18d47d7 100755
--- a/system/functions.php
+++ b/system/functions.php
@@ -1209,7 +1209,11 @@ 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,}|[^\w\-\./\\\]@' , '', $file);
+ $prev = '';
+ while ($prev != $file) {
+ $prev = $file;
+ $file = preg_replace('@\?.*$|\.{2,}|[^\w\-\./\\\]@' , '', $file);
+ }
//replace directory separators with OS specific separator
if ($normalizePath) {
$file = str_replace(['\\', '/'], DS, $file);