From d0843a4070c7d7fa596a7eb2130be15383013487 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Sun, 10 Mar 2019 18:27:24 +0100 Subject: [PATCH] check extension and path traversal --- bl-kernel/abstract/plugin.class.php | 16 +++++++++------- bl-kernel/admin/themes/booty/html/sidebar.php | 2 +- bl-kernel/admin/themes/booty/index.php | 2 +- bl-kernel/admin/themes/booty/login.php | 2 +- bl-kernel/ajax/delete-image.php | 2 +- bl-kernel/ajax/upload-profile-picture.php | 17 ++++++++++++++++- bl-kernel/boot/init.php | 5 ----- bl-kernel/boot/rules/60.plugins.php | 10 +++++----- bl-kernel/css/bootstrap.min.css | 3 +-- bl-kernel/helpers/sanitize.class.php | 14 ++++++-------- bl-kernel/js/bootstrap.bundle.min.js | 3 +-- bl-kernel/language.class.php | 4 ++-- bl-plugins/simplemde/plugin.php | 4 ++-- install.php | 2 +- 14 files changed, 47 insertions(+), 39 deletions(-) diff --git a/bl-kernel/abstract/plugin.class.php b/bl-kernel/abstract/plugin.class.php index 7cd301d5..59612eff 100644 --- a/bl-kernel/abstract/plugin.class.php +++ b/bl-kernel/abstract/plugin.class.php @@ -252,6 +252,8 @@ class Plugin { return true; } + // Returns TRUE if the plugin is installed + // This function just check if the database of the plugin is created public function installed() { return file_exists($this->filenameDb); @@ -271,13 +273,13 @@ class Plugin { public function post() { $args = $_POST; - foreach ($this->dbFields as $key=>$value) { - if (isset($args[$key])) { - $value = Sanitize::html( $args[$key] ); - if ($value==='false') { $value = false; } - elseif ($value==='true') { $value = true; } - settype($value, gettype($this->dbFields[$key])); - $this->db[$key] = $value; + foreach ($this->dbFields as $field=>$value) { + if (isset($args[$field])) { + $finalValue = Sanitize::html( $args[$field] ); + if ($finalValue==='false') { $finalValue = false; } + elseif ($finalValue==='true') { $finalValue = true; } + settype($finalValue, gettype($value)); + $this->db[$field] = $finalValue; } } return $this->save(); diff --git a/bl-kernel/admin/themes/booty/html/sidebar.php b/bl-kernel/admin/themes/booty/html/sidebar.php index f68c0fc6..bd663f4f 100644 --- a/bl-kernel/admin/themes/booty/html/sidebar.php +++ b/bl-kernel/admin/themes/booty/html/sidebar.php @@ -2,7 +2,7 @@