Issues (222)

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.

class/Plugins/Dynamic/PluginItem.php (8 issues)

1
<?php namespace XoopsModules\Mymenus\Plugins\Dynamic;
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
13
/**
14
 * @copyright       XOOPS Project (https://xoops.org)
15
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU Public License
16
 * @package         Mymenus
17
 * @since           1.0
18
 * @author          trabis <[email protected]>
19
 */
20
21
use XoopsModules\Mymenus;
22
23
defined('XOOPS_ROOT_PATH') || die('Restricted access');
24
25
/**
26
 * Class PluginItem
27
 */
28
class PluginItem extends Mymenus\PluginItem
29
{
30
    public static function eventEnd()
31
    {
32
        $newmenus = [];
33
        $registry = Mymenus\Registry::getInstance();
34
        $menus    = $registry->getEntry('menus');
0 ignored issues
show
Are you sure the assignment to $menus is correct as $registry->getEntry('menus') targeting XoopsModules\Mymenus\Registry::getEntry() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
35
        foreach ($menus as $menu) {
0 ignored issues
show
The expression $menus of type null is not traversable.
Loading history...
36
            if (!preg_match('/{(MODULE\|.*)}/i', $menu['title'], $reg)) {
37
                $newmenus[] = $menu;
38
                continue;
39
            }
40
            $result      = array_map('mb_strtolower', explode('|', $reg[1]));
41
            $moduleMenus = self::getModuleMenus($result[1], $menu['pid']);
42
            foreach ($moduleMenus as $mMenu) {
43
                $newmenus[] = $mMenu;
44
            }
45
        }
46
        $registry->setEntry('menus', $newmenus);
47
    }
48
49
    /**
50
     * @param $module
51
     * @param $pid
52
     *
53
     * @return array
54
     */
55
    protected static function getModuleMenus($module, $pid)
56
    {
57
        global $xoopsModule;
58
        static $id = -1;
59
        /** @var \XoopsModules\Mymenus\Helper $helper */
60
        $helper = \XoopsModules\Mymenus\Helper::getInstance();
61
62
63
        $ret = [];
64
        //Sanitizing $module
65
        if (preg_match('/[^a-z0-9\\/\\\\_.:-]/i', $module)) {
66
            return $ret;
67
        }
68
69
        $path = "modules/{$module}";
70
        $file = $GLOBALS['xoops']->path("{$path}/xoops_version.php");
71
72
        if (!file_exists($file)) {
73
            return $ret;
74
        }
75
        $helper->loadLanguage('modinfo');
76
77
78
        $overwrite = false;
79
        if (true === $force) {  //can set to false for debug
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $force seems to be never defined.
Loading history...
80
            if (!($xoopsModule instanceof \XoopsModule) || ($xoopsModule->getVar('dirname') != $module)) {
81
                // @TODO: check the following 2 statements, they're basically just assigns - is this intended?
82
                $_xoopsModule       = ($xoopsModule instanceof \XoopsModule) ? $xoopsModule : $xoopsModule;
83
                $_xoopsModuleConfig = is_object($xoopsModuleConfig) ? $xoopsModuleConfig : $xoopsModuleConfig;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $xoopsModuleConfig does not exist. Did you maybe mean $_xoopsModuleConfig?
Loading history...
84
                /** @var \XoopsModuleHandler $moduleHandler */
85
                $moduleHandler          = xoops_getHandler('module');
0 ignored issues
show
The function xoops_getHandler was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

85
                $moduleHandler          = /** @scrutinizer ignore-call */ xoops_getHandler('module');
Loading history...
86
                $xoopsModule            = $moduleHandler->getByDirname($module);
87
                $GLOBALS['xoopsModule'] = $xoopsModule;
88
                if ($xoopsModule instanceof \XoopsModule) {
89
                    /** @var \XoopsConfigHandler $configHandler */
90
                    $configHandler                = xoops_getHandler('config');
91
                    $xoopsModuleConfig            = $configHandler->getConfigsByCat(0, $xoopsModule->getVar('mid'));
92
                    $GLOBALS['xoopsModuleConfig'] = $xoopsModuleConfig;
93
                }
94
                $overwrite = true;
95
            }
96
        }
97
        $modversion['sub'] = [];
0 ignored issues
show
Comprehensibility Best Practice introduced by
$modversion was never initialized. Although not strictly required by PHP, it is generally a good practice to add $modversion = array(); before regardless.
Loading history...
98
        require $file;
99
100
        /** @var  \XoopsModules\Mymenus\LinksHandler $linksHandler */
101
        $linksHandler = $helper->getHandler('Links');
102
        foreach ($modversion['sub'] as $links) {
103
            $obj = $linksHandler->create();
104
            $obj->setVars([
105
                              'title'     => $links['name'],
106
                              'alt_title' => $links['name'],
107
                              'link'      => $GLOBALS['xoops']->url("{$path}/{$links['url']}"),
108
                              'id'        => $id,
109
                              'pid'       => (int)$pid
110
                          ]);
111
            $ret[] = $obj->getValues();
112
            $id--;
113
        }
114
115
        if ($overwrite) {
116
            $xoopsModule                  = $_xoopsModule;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $_xoopsModule does not seem to be defined for all execution paths leading up to this point.
Loading history...
117
            $GLOBALS['xoopsModule']       = $xoopsModule;
118
            $xoopsModuleConfig            = $_xoopsModuleConfig;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $_xoopsModuleConfig does not seem to be defined for all execution paths leading up to this point.
Loading history...
119
            $GLOBALS['xoopsModuleConfig'] = $xoopsModuleConfig;
120
        }
121
122
        return $ret;
123
    }
124
}
125