Issues (132)

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.

referdetail.php (1 issue)

Severity
1
<?php
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      {@link https://xoops.org/ XOOPS Project}
14
 * @license        {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
15
 * @package
16
 * @since
17
 * @author         XOOPS Development Team
18
 */
19
20
use XoopsModules\Statistics;
21
22
require_once dirname(dirname(__DIR__)) . '/mainfile.php';
23
24
/** @var Statistics\Helper $helper */
25
$helper = Statistics\Helper::getInstance();
26
$helper->loadLanguage('blocks');
27
28
$GLOBALS['xoopsOption']['template_main'] = 'referdetail.tpl';
29
require_once XOOPS_ROOT_PATH . '/header.php';
30
31
function referDetail()
32
{
33
    global $xoopsDB, $xoopsTpl;
34
    /** @var Statistics\Helper $helper */
35
    $helper = Statistics\Helper::getInstance();
36
37
    // get any current blacklist
38
    $result = $xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('stats_refer_blacklist'));
39
    [$id, $referer] = $xoopsDB->fetchRow($result);
40
    $referblacklist = unserialize(stripslashes($referer));
41
    if (!is_array($referblacklist)) { // something went wrong, or there is no data...
42
        $referblacklist = [];
43
    }
44
45
    // figure out if we are saving hits by refer and path or just refer
46
    $resultoption = $xoopsDB->queryF('SELECT options FROM ' . $xoopsDB->prefix('newblocks') . " WHERE name='Top Referers' AND dirname='statistics'");
47
    $optionsret   = $xoopsDB->fetchRow($resultoption);
48
    $options      = explode('|', $optionsret[0]);
49
    if ('' == $options[1]) {
50
        $options[1] = 0;
51
    }
52
53
    $showselfrefer = $options[2];
54
55
    $result    = $xoopsDB->queryF('SELECT refer, date, hits, referpath FROM ' . $xoopsDB->prefix('stats_refer') . ' ORDER BY hits DESC');
56
    $referhits = [];
57
    $cnt       = 0;
58
    while (list($refer, $date, $hits, $referpath) = $xoopsDB->fetchRow($result)) {
59
        if ((0 == $showselfrefer && !strcmp($refer, $_SERVER['HTTP_HOST'])) || '' == $refer) {
60
            continue;
61
        }
62
        // see if we have a blacklist
63
        $blacklisted = false;
64
65
        // check configs if we are ignoring or allowing
66
        if ('Allow' !== $helper->getConfig('refererspam')) {
67
            if (count($referblacklist) > 0) {
68
                $rbldelimited = '/' . implode('|', $referblacklist) . '/';
69
                if (preg_match($rbldelimited, $refer)) {
70
                    $blacklisted = true;
0 ignored issues
show
The assignment to $blacklisted is dead and can be removed.
Loading history...
71
                    continue;
72
                }
73
            }
74
        }
75
76
        if (false === $blacklisted) {
77
            $referpathparts = explode('|', $referpath);
78
            if (($howmany = count($referpathparts)) < 3) {
79
                switch ($howmany) {
80
                    case 0:
81
                        for ($i = 0; $i < 3; ++$i) {
82
                            $referpathparts[$i] = '';
83
                        }
84
                        break;
85
                    case 1:
86
                        for ($i = 1; $i < 3; ++$i) {
87
                            $referpathparts[$i] = '';
88
                        }
89
                        break;
90
                    case 2:
91
                        $referpathparts[2] = '';
92
                        break;
93
                }
94
            }
95
96
            $referhits[$cnt]['pathing']   = $options[1];
97
            $referhits[$cnt]['elipses']   = B_STATS_ELIPSES;
98
            $referhits[$cnt]['pathstrip'] = B_STATS_DELPATH;
99
            $referhits[$cnt]['pathdns']   = B_STATS_PATHDNS;
100
            $referhits[$cnt]['path']      = $referpathparts[0];
101
            $referhits[$cnt]['query']     = $referpathparts[1];
102
            $referhits[$cnt]['fragment']  = $referpathparts[2];
103
            $referhits[$cnt]['refer']     = $refer;
104
            $referhits[$cnt]['hits']      = '';
105
            preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})/', $date, $regs);
106
            $referhits[$cnt]['year']  = $regs[1];
107
            $referhits[$cnt]['month'] = $regs[2];
108
            $referhits[$cnt]['day']   = $regs[3];
109
            $referhits[$cnt]['hour']  = B_STATS_HOUR . '&nbsp;' . $regs[4];
110
            if (mb_strlen($hits) < 3) {
111
                $hits = sprintf('%03d', $hits);
112
            }
113
            for ($i = 0, $iMax = mb_strlen($hits); $i < $iMax; ++$i) {
114
                //the <img src> tag
115
                $imgsrc                  = mb_substr($hits, $i, 1);
116
                $referhits[$cnt]['hits'] .= '<img src="' . XOOPS_URL . '/modules/statistics/assets/images/' . $imgsrc . '.gif" border = "0">';
117
            }
118
119
            ++$cnt;
120
        }
121
    }
122
123
    $xoopsTpl->assign('lang_refer_counterhead', B_STATS_REFERHEAD);
124
    $xoopsTpl->assign('lang_refer_referhits', $referhits);
125
}
126
127
referDetail();
128
129
require_once XOOPS_ROOT_PATH . '/footer.php';
130