Issues (371)

Security Analysis    no vulnerabilities found

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

include/onupdate.php (1 issue)

Severity
1
<?php declare(strict_types=1);
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * @copyright       XOOPS Project (https://xoops.org)
14
 * @license         https://www.fsf.org/copyleft/gpl.html GNU public license
15
 * @author          trabis <[email protected]>
16
 */
17
18
use XoopsModules\Publisher\Common;
19
use XoopsModules\Publisher\Helper;
20
use XoopsModules\Publisher\Utility;
21
22
if ((!defined('XOOPS_ROOT_PATH')) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser)
23
    || !$GLOBALS['xoopsUser']->isAdmin()) {
24
    exit('Restricted access' . PHP_EOL);
25
}
26
27
$helper = Helper::getInstance();
28
$helper->loadLanguage('field');
29
30
/**
31
 * Prepares system prior to attempting to install module
32
 * @param \XoopsModule $module {@link XoopsModule}
33
 *
34
 * @return bool true if ready to install, false if not
35
 */
36
function xoops_module_pre_update_publisher(\XoopsModule $module)
37
{
38
    $utility = new Utility();
39
40
    $xoopsSuccess = $utility::checkVerXoops($module);
41
    $phpSuccess   = $utility::checkVerPhp($module);
42
43
    return $xoopsSuccess && $phpSuccess;
44
}
45
46
/**
47
 * Performs tasks required during update of the module
48
 * @param \XoopsModule $module {@link XoopsModule}
49
 * @param null|string  $previousVersion
50
 *
51
 * @return bool true if update successful, false if not
52
 */
53
function xoops_module_update_publisher(\XoopsModule $module, ?string $previousVersion = null)
54
{
55
    //    global $GLOBALS['xoopsDB'];
56
    $moduleDirName = \basename(\dirname(__DIR__));
57
    //    $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
58
59
    /** @var Helper $helper */
60
    /** @var Common\Configurator $configurator */
61
    $helper       = Helper::getInstance();
62
    $configurator = new Common\Configurator();
63
    $utility      = new Utility();
64
    $errors       = 0;
0 ignored issues
show
The assignment to $errors is dead and can be removed.
Loading history...
65
66
    $helper->loadLanguage('common');
67
    $helper->loadLanguage('field');
68
69
    //delete .html entries from the tpl table
70
    $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'";
71
    $GLOBALS['xoopsDB']->queryF($sql);
72
    $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newblocks') . " WHERE `dirname` = '" . $module->getVar('dirname', 'n') . "' AND `template` LIKE '%.html%'";
73
    $GLOBALS['xoopsDB']->queryF($sql);
74
75
    if ($previousVersion <= 105) {
76
        //change TEXT fields to NULL
77
        $sql = '    ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix($module->getVar('dirname', 'n') . '_categories') . ' MODIFY `description` TEXT NULL';
78
        $GLOBALS['xoopsDB']->queryF($sql);
79
        $sql = '    ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix($module->getVar('dirname', 'n') . '_categories') . ' MODIFY `header` TEXT NULL';
80
        $GLOBALS['xoopsDB']->queryF($sql);
81
        $sql = '    ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix($module->getVar('dirname', 'n') . '_categories') . ' MODIFY `meta_keywords` TEXT NULL';
82
        $GLOBALS['xoopsDB']->queryF($sql);
83
        $sql = '    ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix($module->getVar('dirname', 'n') . '_categories') . ' MODIFY `meta_description` TEXT NULL';
84
        $GLOBALS['xoopsDB']->queryF($sql);
85
86
        //delete old HTML templates
87
        if (count($configurator->templateFolders) > 0) {
88
            foreach ($configurator->templateFolders as $folder) {
89
                $templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder);
90
                if (is_dir($templateFolder)) {
91
                    $templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']);
92
                    foreach ($templateList as $k => $v) {
93
                        $fileInfo = new \SplFileInfo($templateFolder . $v);
94
                        if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) {
95
                            if (\is_file($templateFolder . $v)) {
96
                                unlink($templateFolder . $v);
97
                            }
98
                        }
99
                    }
100
                }
101
            }
102
        }
103
104
        //  ---  DELETE OLD FILES ---------------
105
        if (count($configurator->oldFiles) > 0) {
106
            //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
107
            foreach (array_keys($configurator->oldFiles) as $i) {
108
                $tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]);
109
                if (\is_file($tempFile)) {
110
                    unlink($tempFile);
111
                }
112
            }
113
        }
114
115
        //  ---  DELETE OLD FOLDERS ---------------
116
        xoops_load('XoopsFile');
117
        if (count($configurator->oldFolders) > 0) {
118
            //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
119
            foreach (array_keys($configurator->oldFolders) as $i) {
120
                $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]);
121
                /** @var \XoopsObjectHandler $folderHandler */
122
                $folderHandler = \XoopsFile::getHandler('folder', $tempFolder);
123
                $folderHandler->delete($tempFolder);
124
            }
125
        }
126
127
        //  ---  CREATE FOLDERS ---------------
128
        if (count($configurator->uploadFolders) > 0) {
129
            //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
130
            foreach (array_keys($configurator->uploadFolders) as $i) {
131
                $utility::createFolder($configurator->uploadFolders[$i]);
132
            }
133
        }
134
135
        //  ---  COPY blank.png FILES ---------------
136
        if (count($configurator->copyBlankFiles) > 0) {
137
            $file = \dirname(__DIR__) . '/assets/images/blank.png';
138
            foreach (array_keys($configurator->copyBlankFiles) as $i) {
139
                $dest = $configurator->copyBlankFiles[$i] . '/blank.png';
140
                $utility::copyFile($file, $dest);
141
            }
142
        }
143
144
        //delete .html entries from the tpl table
145
        $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'";
146
        $GLOBALS['xoopsDB']->queryF($sql);
147
148
        /** @var \XoopsGroupPermHandler $grouppermHandler */
149
        $grouppermHandler = xoops_getHandler('groupperm');
150
151
        return $grouppermHandler->deleteByModule($module->getVar('mid'), 'item_read');
152
    }
153
154
    // check table items for field `dateexpire`
155
    if (!$GLOBALS['xoopsDB']->query('SELECT dateexpire FROM ' . $GLOBALS['xoopsDB']->prefix($module->getVar('dirname', 'n') . '_items'))) {
156
        $sql = 'ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix($module->getVar('dirname', 'n') . '_items') . " ADD `dateexpire` INT(11) NULL DEFAULT '0' AFTER `datesub`";
157
        $GLOBALS['xoopsDB']->queryF($sql);
158
    }
159
    // check table items for field `votetype`
160
    if (!$GLOBALS['xoopsDB']->query('SELECT votetype FROM ' . $GLOBALS['xoopsDB']->prefix($module->getVar('dirname', 'n') . '_items'))) {
161
        $sql = 'ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix($module->getVar('dirname', 'n') . '_items') . " ADD `votetype` TINYINT(1) NOT NULL DEFAULT '0' AFTER `item_tag`";
162
        $GLOBALS['xoopsDB']->queryF($sql);
163
    }
164
165
        // Publisher 1.8.0
166
        // check table items for field `template_item` for custom templates
167
        if (!$GLOBALS['xoopsDB']->query('SELECT template_item FROM ' . $GLOBALS['xoopsDB']->prefix($module->getVar('dirname', 'n') . '_categories'))) {
168
            $sql = 'ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix($module->getVar('dirname', 'n') . '_categories') . " ADD `template_item` VARCHAR(150) NOT NULL DEFAULT '' AFTER `template`";
169
            $GLOBALS['xoopsDB']->queryF($sql);
170
        }
171
172
    return true;
173
    }
174