Issues (76)

Security Analysis    not enabled

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 (6 issues)

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      GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
15
 * @author       XOOPS Development Team
16
 */
17
18
use Xmf\Database\Tables;
19
use XoopsModules\Myiframe;
20
21
if ((!defined('XOOPS_ROOT_PATH')) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser)
22
    || !$GLOBALS['xoopsUser']->isAdmin()) {
23
    exit('Restricted access' . PHP_EOL);
24
}
25
26
/**
27
 * Prepares system prior to attempting to install module
28
 * @param \XoopsModule $module {@link XoopsModule}
29
 *
30
 * @return bool true if ready to install, false if not
31
 */
32
function xoops_module_pre_update_myiframe(\XoopsModule $module)
33
{
34
    $moduleDirName = \basename(\dirname(__DIR__));
0 ignored issues
show
The assignment to $moduleDirName is dead and can be removed.
Loading history...
35
    /** @var Myiframe\Helper $helper */
36
    /** @var Myiframe\Utility $utility */
37
    $helper  = Myiframe\Helper::getInstance();
0 ignored issues
show
The assignment to $helper is dead and can be removed.
Loading history...
38
    $utility = new Myiframe\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         $previousVersion
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $previousVersion is correct as it would always require null to be passed?
Loading history...
50
 *
51
 * @return bool true if update successful, false if not
52
 */
53
function xoops_module_update_myiframe(\XoopsModule $module, $previousVersion = null)
54
{
55
    $moduleDirName      = \basename(\dirname(__DIR__));
56
    $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
0 ignored issues
show
The assignment to $moduleDirNameUpper is dead and can be removed.
Loading history...
57
58
    /** @var Myiframe\Helper $helper */ /** @var Myiframe\Utility $utility */
59
    /** @var Myiframe\Common\Configurator $configurator */
60
    $helper       = Myiframe\Helper::getInstance();
0 ignored issues
show
The assignment to $helper is dead and can be removed.
Loading history...
61
    $utility      = new Myiframe\Utility();
62
    $configurator = new Myiframe\Common\Configurator();
63
64
    if ($previousVersion < 240) {
65
        //rename column EXAMPLE
66
        $tables     = new Tables();
67
        $table      = 'myiframex_categories';
68
        $column     = 'ordre';
69
        $newName    = 'order';
70
        $attributes = "INT(5) NOT NULL DEFAULT '0'";
71
        if ($tables->useTable($table)) {
72
            $tables->alterColumn($table, $column, $attributes, $newName);
73
            if (!$tables->executeQueue()) {
74
                echo '<br>' . _AM_MYIFRAME_UPGRADEFAILED0 . ' ' . $tables->getLastError();
0 ignored issues
show
The constant _AM_MYIFRAME_UPGRADEFAILED0 was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
75
            }
76
        }
77
78
        //delete old HTML templates
79
        if (count($configurator->templateFolders) > 0) {
80
            foreach ($configurator->templateFolders as $folder) {
81
                $templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder);
82
                if (is_dir($templateFolder)) {
83
                    $templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']);
84
                    foreach ($templateList as $k => $v) {
85
                        $fileInfo = new \SplFileInfo($templateFolder . $v);
86
                        if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) {
87
                            if (is_file($templateFolder . $v)) {
88
                                unlink($templateFolder . $v);
89
                            }
90
                        }
91
                    }
92
                }
93
            }
94
        }
95
96
        //  ---  DELETE OLD FILES ---------------
97
        if (count($configurator->oldFiles) > 0) {
98
            //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
99
            foreach (array_keys($configurator->oldFiles) as $i) {
100
                $tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]);
101
                if (is_file($tempFile)) {
102
                    unlink($tempFile);
103
                }
104
            }
105
        }
106
107
        //  ---  DELETE OLD FOLDERS ---------------
108
        xoops_load('XoopsFile');
109
        if (count($configurator->oldFolders) > 0) {
110
            //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
111
            foreach (array_keys($configurator->oldFolders) as $i) {
112
                $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]);
113
                /** @var XoopsObjectHandler $folderHandler */
114
                $folderHandler = XoopsFile::getHandler('folder', $tempFolder);
115
                $folderHandler->delete($tempFolder);
116
            }
117
        }
118
119
        //  ---  CREATE FOLDERS ---------------
120
        if (count($configurator->uploadFolders) > 0) {
121
            //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
122
            foreach (array_keys($configurator->uploadFolders) as $i) {
123
                $utility::createFolder($configurator->uploadFolders[$i]);
124
            }
125
        }
126
127
        //  ---  COPY blank.png FILES ---------------
128
        if (count($configurator->copyBlankFiles) > 0) {
129
            $file = \dirname(__DIR__) . '/assets/images/blank.png';
130
            foreach (array_keys($configurator->copyBlankFiles) as $i) {
131
                $dest = $configurator->copyBlankFiles[$i] . '/blank.png';
132
                $utility::copyFile($file, $dest);
133
            }
134
        }
135
136
        //delete .html entries from the tpl table
137
        $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . '\' AND `tpl_file` LIKE \'%.html%\'';
138
        $GLOBALS['xoopsDB']->queryF($sql);
139
140
        /** @var \XoopsGroupPermHandler $grouppermHandler */
141
        $grouppermHandler = xoops_getHandler('groupperm');
142
143
        return $grouppermHandler->deleteByModule($module->getVar('mid'), 'item_read');
144
    }
145
146
    return true;
147
}
148