Issues (1626)

Security Analysis    not enabled

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

  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  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.
  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.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
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.

modules/xoopsinfo/admin/rescue.php (13 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 34 and the first side effect is on line 15.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * XOOPS - PHP Content Management System
4
 * Copyright (c) 2001 - 2006 <http://www.xoops.org/>
5
 *
6
 * Module: xoopsinfo 2.13
7
 * Licence : GPL
8
 * Authors :
9
 *              - Jmorris
10
 *              - Marco
11
 *              - Christian
12
 *              - DuGris (http://www.dugris.info)
13
 */
14
15
$xoopsOption['nocommon'] = true;
16
require_once('../../../mainfile.php');
17
18
// Xoops Include, require, ...
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
19
require_once(XOOPS_ROOT_PATH . '/class/xoopssecurity.php');
20
$xoopsSecurity = new XoopsSecurity();
21
global $xoopsSecurity;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
22
//Check super globals
23
$xoopsSecurity->checkSuperglobals();
24
25
include_once XOOPS_ROOT_PATH . '/include/functions.php';
26
27
include_once XOOPS_ROOT_PATH . '/class/logger.php';
28
//$xoopsLogger =& XoopsLogger::instance();
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
29
//$xoopsErrorHandler =& $xoopsLogger;
30
//$xoopsLogger->startTime();
31
//$xoopsLogger->startTime( 'XOOPS Boot' );
32
33
if (!defined('XOOPS_XMLRPC')) {
34
    define('XOOPS_DB_CHKREF', 1);
35
} else {
36
    define('XOOPS_DB_CHKREF', 0);
37
}
38
require_once XOOPS_ROOT_PATH . '/class/database/databasefactory.php';
39
if ($_SERVER['REQUEST_METHOD'] !== 'POST' || !$xoopsSecurity->checkReferer(XOOPS_DB_CHKREF)) {
40
    define('XOOPS_DB_PROXY', 1);
41
}
42
$xoopsDB =& XoopsDatabaseFactory::getDatabaseConnection();
43
44
require_once XOOPS_ROOT_PATH . '/kernel/object.php';
45
require_once XOOPS_ROOT_PATH . '/class/criteria.php';
46
47
$config_handler = xoops_getHandler('config');
48
$xoopsConfig    =& $config_handler->getConfigsByCat(XOOPS_CONF);
49
// Xoops Include, require, ...
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
50
51
include('admin_header.php');
52
53
// Old debug mode
54
$isSystem       = XoopsInfo_getModuleInfo('system');
55
$config_handler = xoops_getHandler('config');
56
$xoopsConfig    =& $config_handler->getConfigsByCat(XOOPS_CONF);
57
$old_debug_mode = $xoopsConfig['debug_mode'];
58
$theme_set      = $xoopsConfig['theme_set'];
59
60
// Protector
61
$isProtector = XoopsInfo_getModuleInfo('protector');
62
if ($isProtector) {
63
    $old_protector = XoopsInfo_moduleoption('global_disabled', 'protector');
64
}
65
66
// UPDATE STAGE
67
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
68
    $passwd       = isset($_REQUEST['passwd']) ? trim($_REQUEST['passwd']) : '';
69
    $debug_mode   = isset($_REQUEST['debug_mode']) ? trim($_REQUEST['debug_mode']) : 0;
70
    $theme        = isset($_REQUEST['theme']) ? trim($_REQUEST['theme']) : 0;
71
    $protector    = isset($_REQUEST['protector']) ? trim($_REQUEST['protector']) : 0;
72
    $protector_ip = isset($_REQUEST['protector_ip']) ? trim($_REQUEST['protector_ip']) : 0;
73
    $template_c   = isset($_REQUEST['template_c']) ? trim($_REQUEST['template_c']) : 0;
74
    $cache        = isset($_REQUEST['cache']) ? trim($_REQUEST['cache']) : 0;
75
    $session      = isset($_REQUEST['session']) ? trim($_REQUEST['session']) : 0;
76
    if (!empty($passwd) && trim($passwd) != '') {
77
        // Checking Referer deeply against CSRF
78
        if (strpos($_SERVER['HTTP_REFERER'], XOOPS_URL . '/modules/xoopsinfo/admin/') !== 0) {
79
            die('Turn REFERER on (or disable Personal Firewalls like Norton');
80
        }
81
82
        // Authentication
83
        $sql    = 'SELECT count(*) FROM ' . $xoopsDB->prefix('config') . ' WHERE conf_title="_MI_XI_PASSWORD" AND conf_value="' . $passwd . '"';
84
        $result = $xoopsDB->query($sql);
85
        list($count) = $xoopsDB->fetchRow($result);
86
87
        // Result
88
        if ($xoopsDB->getRowsNum($result) == 1 && $count) {
89
            //   Debug Mode
90 View Code Duplication
            if ($old_debug_mode != $debug_mode) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
91
                $sql            = 'UPDATE ' . $xoopsDB->prefix('config') . ' SET conf_value="' . $debug_mode . '" WHERE conf_name="debug_mode" and conf_modid=0';
92
                $result         = $xoopsDB->queryF($sql);
93
                $old_debug_mode = $debug_mode;
94
            }
95
96
            // Theme
97
            if ($theme == 1) {
98
                $sql    = 'UPDATE ' . $xoopsDB->prefix('config') . ' SET conf_value="default" WHERE conf_name="theme_set" and conf_modid=0';
99
                $result = $xoopsDB->queryF($sql);
100
101
                $member_handler = xoops_getHandler('member');
102
                $member_handler->updateUsersByField('theme', 'default');
103
                $_SESSION['xoopsUserTheme'] = 'default';
104
            }
105
106 View Code Duplication
            if ($cache) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
107
                $dir = XOOPS_ROOT_PATH . '/cache';
108
                if (is_dir($dir)) {
109
                    if ($dh = opendir($dir)) {
110
                        while (($file = readdir($dh)) !== false) {
111
                            if (filetype($dir . '/' . $file) !== 'dir' && $file !== 'index.html' && $file !== 'adminmenu.php') {
112
                                @unlink($dir . '/' . $file);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

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...
113
                            }
114
                        }
115
                        closedir($dh);
116
                    }
117
                }
118
            }
119
120 View Code Duplication
            if ($template_c) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
121
                $dir = XOOPS_ROOT_PATH . '/templates_c';
122
                if (is_dir($dir)) {
123
                    if ($dh = opendir($dir)) {
124
                        while (($file = readdir($dh)) !== false) {
125
                            if (filetype($dir . '/' . $file) !== 'dir' && $file !== 'index.html') {
126
                                @unlink($dir . '/' . $file);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

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...
127
                            }
128
                        }
129
                        closedir($dh);
130
                    }
131
                }
132
            }
133
134
            // Session
135
            if ($session) {
136
                $sql    = 'TRUNCATE TABLE ' . $xoopsDB->prefix('online');
137
                $result = $xoopsDB->query($sql);
138
                $sql    = 'TRUNCATE TABLE ' . $xoopsDB->prefix('session');
139
                $result = $xoopsDB->query($sql);
140
            }
141
142
            // Protector
143 View Code Duplication
            if ($old_protector != $protector && $isProtector) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
144
                $sql    = 'UPDATE ' . $xoopsDB->prefix('config') . ' SET conf_value="' . $protector . '" WHERE conf_name="global_disabled" AND conf_modid=' . $isProtector->getVar('mid');
145
                $result = $xoopsDB->queryF($sql);
146
            }
147
148
            if ($protector_ip && $isProtector) {
149
                $sql    = 'TRUNCATE TABLE ' . $xoopsDB->prefix('protector_access');
150
                $result = $xoopsDB->queryF($sql);
151
            }
152
153
            define('SMARTY_DIR', XOOPS_ROOT_PATH . '/class/smarty/');
154
            define('XOOPS_COMPILE_PATH', XOOPS_ROOT_PATH . '/templates_c');
155
            redirect_header(XOOPS_URL . '/modules/xoopsinfo/admin/rescue.php', 3, _MD_AM_DBUPDATED);
156
        }
157
        define('SMARTY_DIR', XOOPS_ROOT_PATH . '/class/smarty/');
158
        define('XOOPS_COMPILE_PATH', XOOPS_ROOT_PATH . '/templates_c');
159
        redirect_header(XOOPS_URL . '/modules/xoopsinfo/admin/rescue.php', 3, _MI_XI_PASSWORD_ERROR);
160
    }
161
}
162
163
if (!headers_sent()) {
164
    header('Content-Type:text/html; charset=' . _CHARSET);
165
    header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
166
    //header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
167
    header('Cache-Control: private, no-cache');
168
    header('Pragma: no-cache');
169
}
170
?>
171
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
172
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
173
    <head>
174
        <link rel="stylesheet" type="text/css" media="screen" href="<?php echo XOOPS_URL . '/xoops.css'; ?>"/>
175
        <link rel="stylesheet" type="text/css" media="screen" href="<?php echo XOOPS_URL . '/themes/' . $theme_set . '/style.css'; ?>"/>
176
        <link rel="stylesheet" type="text/css" media="screen" href="<?php echo XOOPS_URL . '/modules/xoopsinfo/module.css'; ?>"/>
177
        <title><?php echo _MI_XI_NAME; ?> Rescue</title>
178
    </head>
179
    <body>
180
    <form action='' method='POST'>
181
        <div align="center">
182
            <div class="item" align="center">
183
                <div class="itemHead"><h3>
184
                        <?php echo _MI_XI_NAME; ?> Rescue
185
                    </h3></div>
186
187
                <table width="100%">
188
                    <tr>
189
                        <td class="even" align="left"><b>
190
                                <?php echo _MI_XI_XOOPS_DEBUG; ?>
191
                            </b></td>
192
193
                        <td class="odd" align="left">
194
                            <select size='1' name='debug_mode' id='debug_mode'>
195
                                <option value='0' <?php if ($old_debug_mode == 0) {
196
                                    echo 'selected=selected';
197
                                } ?>><?php echo _MD_AM_DEBUGMODE0; ?></option>
198
                                <option value='1' <?php if ($old_debug_mode == 1) {
199
                                    echo 'selected=selected';
200
                                } ?>><?php echo _MD_AM_DEBUGMODE1; ?></option>
201
                                <option value='2' <?php if ($old_debug_mode == 2) {
202
                                    echo 'selected=selected';
203
                                } ?>><?php echo _MD_AM_DEBUGMODE2; ?></option>
204
                                <option value='3' <?php if ($old_debug_mode == 3) {
205
                                    echo 'selected=selected';
206
                                } ?>><?php echo _MD_AM_DEBUGMODE3; ?></option>
207
                            </select>
208
                        </td>
209
                    </tr>
210
211
                    <tr>
212
                        <td class="even" align="left"><b>
213
                                <?php echo _MI_XI_XOOPS_THEME; ?>
214
                            </b></td>
215
216
                        <td class="odd" align="left">
217
                            <input type='radio' name='theme' value='0' checked='checked'/><?php echo _MI_XI_NO; ?>
218
                            <input type='radio' name='theme' value='1'/><?php echo _MI_XI_YES; ?>
219
                        </td>
220
                    </tr>
221
222
                    <tr>
223
                        <td class="even" align="left"><b>
224
                                <?php echo _MI_XI_XOOPS_CACHE; ?>
225
                            </b></td>
226
227
                        <td class="odd" align="left">
228
                            <input type='radio' name='cache' value='0' checked/><?php echo _MI_XI_NO; ?>
229
                            <input type='radio' name='cache' value='1'/><?php echo _MI_XI_YES; ?>
230
                        </td>
231
                    </tr>
232
233
                    <tr>
234
                        <td class="even" align="left"><b>
235
                                <?php echo _MI_XI_XOOPS_TEMPLATE; ?>
236
                            </b></td>
237
238
                        <td class="odd" align="left">
239
                            <input type='radio' name='template_c' value='0' checked/><?php echo _MI_XI_NO; ?>
240
                            <input type='radio' name='template_c' value='1'/><?php echo _MI_XI_YES; ?>
241
                        </td>
242
                    </tr>
243
244
                    <tr>
245
                        <td class="even" align="left"><b>
246
                                <?php echo _MI_XI_XOOPS_SESSION_TABLE; ?>
247
                            </b></td>
248
249
                        <td class="odd" align="left">
250
                            <input type='radio' name='session' value='0' checked/><?php echo _MI_XI_NO; ?>
251
                            <input type='radio' name='session' value='1'/><?php echo _MI_XI_YES; ?>
252
                        </td>
253
                    </tr>
254
255
                    <?php if ($isProtector) : ?>
256
                        <tr>
257
                            <td class="even" align="left"><b>
258
                                    <?php echo _MI_XI_XOOPS_PROTECTOR; ?>
259
                                </b></td>
260
261
                            <td class="odd" align="left">
262
                                <input type='radio' name='protector' value='0' <?php if (!$old_protector) {
263
                                    echo "checked='checked'";
264
                                } ?> /><?php echo _MI_XI_NO; ?>
265
                                <input type='radio' name='protector' value='1' <?php if ($old_protector) {
266
                                    echo "checked='checked'";
267
                                } ?> /><?php echo _MI_XI_YES; ?>
268
                            </td>
269
                        </tr>
270
271
                        <tr>
272
                            <td class="even" align="left"><b>
273
                                    <?php echo _MI_XI_XOOPS_PROTECTOR_IP; ?>
274
                                </b></td>
275
276
                            <td class="odd" align="left">
277
                                <input type='radio' name='protector_ip' value='0' checked='checked'/><?php echo _MI_XI_NO; ?>
278
                                <input type='radio' name='protector_ip' value='1'/><?php echo _MI_XI_YES; ?>
279
                            </td>
280
                        </tr>
281
                    <?php endif; ?>
282
283
                    <tr>
284
                        <td class="even" align="left"><b>
285
                                <?php echo _MI_XI_XOOPS_PASSWORD; ?>
286
                            </b></td>
287
288
                        <td class="odd" align="left">
289
                            <input type='password' name='passwd' size='15'/>
290
                        </td>
291
                    </tr>
292
293
                    <tr>
294
                        <td colspan="2" align="center">
295
                            <input type='submit' name='submit' value='<?php echo _MI_XI_XOOPS_SUBMIT; ?>'/>
296
                        </td>
297
                    </tr>
298
                    <tr>
299
                        <td colspan="2" align="center">
300
                            <br>
301
                        </td>
302
                    </tr>
303
                    <tr>
304
                        <td colspan="2" align="right">
305
                            <a href="<?php echo XOOPS_URL; ?>"><?php echo _YOURHOME; ?></a>
306
                        </td>
307
                    </tr>
308
                </table>
309
            </div>
310
        </div>
311
    </form>
312
    <br>
313
    </body>
314
    </html>
315
<?php
316
//echo $xoopsLogger->dump();
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
317
?>
318