From 1527356b1e2cd54f21bbe4da4f6783f11d0415f8 Mon Sep 17 00:00:00 2001 From: "Nicholas K. Dionysopoulos" Date: Wed, 25 Feb 2015 17:18:15 +0200 Subject: [PATCH 1/3] Fix #6173 JFile::upload was missing the fourth argument, resulting in file content scanning for ZIP file per the default options. Since installation package ZIP files may contain uncompressed .php files OR otherwise the string literals ` Date: Wed, 25 Feb 2015 18:18:44 +0200 Subject: [PATCH 2/3] JInputFiles::get needs to be passed filter type 'raw' to return "unsafe" files. Plus: fixed a typo in a comment. --- administrator/components/com_installer/models/install.php | 3 ++- libraries/joomla/input/files.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/administrator/components/com_installer/models/install.php b/administrator/components/com_installer/models/install.php index f7493b53ffadc..3f9c7b14aa51b 100644 --- a/administrator/components/com_installer/models/install.php +++ b/administrator/components/com_installer/models/install.php @@ -201,7 +201,8 @@ protected function _getPackageFromUpload() { // Get the uploaded file information. $input = JFactory::getApplication()->input; - $userfile = $input->files->get('install_package', null, 'array'); + // Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get. + $userfile = $input->files->get('install_package', null, 'raw'); // Make sure that file uploads are enabled in php. if (!(bool) ini_get('file_uploads')) diff --git a/libraries/joomla/input/files.php b/libraries/joomla/input/files.php index 37fee94834e39..23aeceffd8c3f 100644 --- a/libraries/joomla/input/files.php +++ b/libraries/joomla/input/files.php @@ -76,7 +76,7 @@ public function get($name, $default = null, $filter = 'cmd') { if (isset($this->data[$name])) { - // Prevent returning an unsafe file unless speciffically requested + // Prevent returning an unsafe file unless specifically requested if (!$this->data[$name]['safe']) { if ($filter != 'raw') From 93ebe41bffeb1a31c91aa0e447d9e251d6c50356 Mon Sep 17 00:00:00 2001 From: "Nicholas K. Dionysopoulos" Date: Thu, 26 Feb 2015 09:33:35 +0200 Subject: [PATCH 3/3] Last commit missed a line. Whoops! --- libraries/joomla/filesystem/file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/joomla/filesystem/file.php b/libraries/joomla/filesystem/file.php index 3c82e33cf02ad..cc14b9c69109d 100644 --- a/libraries/joomla/filesystem/file.php +++ b/libraries/joomla/filesystem/file.php @@ -462,7 +462,7 @@ public static function upload($src, $dest, $use_streams = false, $allow_unsafe = 'size' => '', ); - $isSafe = JFilterInput::isSafeFile($descriptor); + $isSafe = JFilterInput::isSafeFile($descriptor, $safeFileOptions); if (!$isSafe) {