Issues (314)

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.

admin/devtools.php (1 issue)

1
<?php
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
 * modulebuilder module.
15
 *
16
 * @copyright       XOOPS Project (https://xoops.org)
17
 * @license         GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
18
 *
19
 * @since           2.5.5
20
 *
21
 * @author          Goffy https://myxoops.org
22
 *
23
 */
24
25
use Xmf\Request;
26
use XoopsModules\Modulebuilder\Devtools;
27
28
$moduleDirName      = \basename(\dirname(__DIR__));
29
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
30
31
// Define main template
32
$templateMain = $moduleDirName . '_devtools.tpl';
33
34
require __DIR__ . '/header.php';
35
// Recovered value of argument op in the URL $
36
$op    = Request::getString('op', 'list');
37
38
switch ($op) {
39
    case 'fq':
40
        $fqModule = Request::getString('fq_module');
41
        $src_path = \XOOPS_ROOT_PATH . '/modules/' . $fqModule;
42
        $dst_path = TDMC_UPLOAD_PATH . '/devtools/fq/' . $fqModule;
43
44
        $patKeys = [];
45
        $patValues = [];
46
        //Devtools::cloneFileFolder($src_path, $dst_path, $patKeys, $patValues);
47
        Devtools::function_qualifier($src_path, $dst_path, $fqModule);
48
        \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_FQ_SUCCESS);
49
        break;
50
    case 'check_lang':
51
        $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('devtools.php'));
52
        $clModuleName = Request::getString('cl_module');
53
        $clModuleNameUpper = \mb_strtoupper($clModuleName);
54
55
        //scan language files
56
        $src_path = \XOOPS_ROOT_PATH . '/modules/' . $clModuleName . '/language/english/';
57
        $langfiles = [];
58
        foreach (scandir($src_path) as $scan) {
59
            if (is_file($src_path . $scan) && 'index.html' !== $scan) {
60
                $langfiles[] = $src_path . $scan;
61
            }
62
        }
63
        $moduleConstants = [];
64
        foreach ($langfiles as $langfile) {
65
            //$constantsBeforeInclude = getUserDefinedConstants();
66
            require_once($langfile);
67
            //$constantsAfterInclude = getUserDefinedConstants();
68
            //$moduleConstants[$langfile] = array_diff_assoc($constantsAfterInclude, $constantsBeforeInclude);
69
        }
70
        $constantsAfterInclude = getUserDefinedConstants();
71
        foreach ($constantsAfterInclude as $constKey => $constValue) {
72
            if (strpos($constKey, '_' . $clModuleNameUpper . '_') > 0) {
73
                $moduleConstants[$constKey] = $constKey;
74
            }
75
        }
76
77
        //get all php and tpl files from module
78
        $check_path = \XOOPS_ROOT_PATH . '/modules/' . $clModuleName;
79
        $Directory = new RecursiveDirectoryIterator($check_path);
80
        $Iterator = new RecursiveIteratorIterator($Directory);
81
        $regexFiles = new RegexIterator($Iterator, '/^.+\.(php|tpl)$/i', RecursiveRegexIterator::GET_MATCH);
82
        //$files = new RegexIterator($flattened, '#^(?:[A-Z]:)?(?:/(?!\.Trash)[^/]+)+/[^/]+\.(?:php|html)$#Di');
83
        $modfiles = [];
84
        foreach($regexFiles as $regexFiles) {
85
            $file = str_replace('\\', '/', $regexFiles[0]);
86
            if (!\in_array($file, $langfiles)) {
87
                $modfiles[] = $file;
88
            }
89
        }
90
91
        //check all constants in all files
92
        $resultCheck = [];
93
        foreach ($moduleConstants as $constKey) {
94
            $foundMod = 0;
95
            $first = '';
96
            $foundLang = 'not defined';
97
            //search for complete string
98
            foreach($modfiles as $modfile) {
99
                if( strpos(file_get_contents($modfile),$constKey) !== false) {
100
                    $foundMod = 1;
101
                    $first = $modfile;
102
                    break;
103
                }
104
            }
105
            if (0 == $foundMod) {
106
                //search for concatenated string
107
                $needle = str_replace('_' . $clModuleNameUpper . '_', "_' . \$moduleDirNameUpper . '_", $constKey);
108
                foreach($modfiles as $modfile) {
109
                    if( strpos(file_get_contents($modfile),$needle) !== false) {
110
                        $foundMod = 1;
111
                        $first = $modfile;
112
                        break;
113
                    }
114
                }
115
            }
116
            if (0 == $foundMod) {
117
                //search for concatenated string
118
                $needle = str_replace('_' . $clModuleNameUpper . '_', "_' . \$moduleDirNameUpper . '_' . '", $constKey);
119
                foreach($modfiles as $modfile) {
120
                    if( strpos(file_get_contents($modfile),$needle) !== false) {
121
                        $foundMod = 1;
122
                        $first = $modfile;
123
                        break;
124
                    }
125
                }
126
            }
127
            foreach($langfiles as $langfile) {
128
                if( strpos(file_get_contents($langfile),$constKey) !== false) {
129
                    $foundLang = $langfile;
130
                    break;
131
                }
132
            }
133
            if ('' == $foundLang) {
134
                //search for concatenated string
135
                $needle = str_replace('_' . $clModuleNameUpper . '_', "_' . \$moduleDirNameUpper . '_", $constKey);
136
                foreach($langfiles as $langfile) {
137
                    if( strpos(file_get_contents($langfile),$needle) !== false) {
138
                        $foundLang = $langfile;
139
                        break;
140
                    }
141
                }
142
            }
143
            if ('' == $foundLang) {
144
                //search for concatenated string
145
                $needle = str_replace('_' . $clModuleNameUpper . '_', "_' . \$moduleDirNameUpper . '_' . '", $constKey);
146
                foreach($langfiles as $langfile) {
147
                    if( strpos(file_get_contents($langfile),$needle) !== false) {
148
                        $foundLang = $langfile;
149
                        break;
150
                    }
151
                }
152
            }
153
            $resultCheck[\basename($foundLang)][] = ['define' => $constKey, 'found' => $foundMod, 'first' => $first];
154
        }
155
        $GLOBALS['xoopsTpl']->assign('clresults', $resultCheck);
156
        $GLOBALS['xoopsTpl']->assign('modPathIcon16', TDMC_URL . '/' . $modPathIcon16);
157
158
        break;
159
    case 'tab_replacer':
160
        $tabModule = Request::getString('tab_module');
161
        $src_path = \XOOPS_ROOT_PATH . '/modules/' . $tabModule;
162
        $dst_path = TDMC_UPLOAD_PATH . '/devtools/tab/';
163
        @\mkdir($dst_path);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition for mkdir(). This can introduce security issues, and is generally not recommended. ( Ignorable by Annotation )

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

163
        /** @scrutinizer ignore-unhandled */ @\mkdir($dst_path);

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
164
        $dst_path = TDMC_UPLOAD_PATH . '/devtools/tab/' . $tabModule;
165
        @\mkdir($dst_path);
166
167
        Devtools::function_tabreplacer($src_path, $dst_path);
168
        \redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_FQ_SUCCESS);
169
        break;
170
    case 'list':
171
    default:
172
        $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('devtools.php'));
173
        $dst_path = TDMC_UPLOAD_PATH . '/devtools/fq/';
174
        $GLOBALS['xoopsTpl']->assign('fq_desc',\str_replace('%s', $dst_path, \_AM_MODULEBUILDER_DEVTOOLS_FQ_DESC));
175
        $fq_form = Devtools::getFormModulesFq();
176
        $GLOBALS['xoopsTpl']->assign('fq_form', $fq_form->render());
177
        $cl_form = Devtools::getFormModulesCl();
178
        $GLOBALS['xoopsTpl']->assign('cl_form', $cl_form->render());
179
        $tab_form = Devtools::getFormModulesTab();
180
        $GLOBALS['xoopsTpl']->assign('tab_form', $tab_form->render());
181
        $dst_path = TDMC_UPLOAD_PATH . '/devtools/tab/';
182
        $GLOBALS['xoopsTpl']->assign('tab_desc',\str_replace('%s', $dst_path, \_AM_MODULEBUILDER_DEVTOOLS_TAB_DESC));
183
        $GLOBALS['xoopsTpl']->assign('devtools_list',true);
184
185
        break;
186
}
187
188
function getUserDefinedConstants() {
189
    $constants = get_defined_constants(true);
190
    return (isset($constants['user']) ? $constants['user'] : []);
191
}
192
193
require __DIR__ . '/footer.php';
194
195
196
197
198