Issues (181)

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.

plugins/newbb.php (7 issues)

1
<?php declare(strict_types=1);
2
3
/**
4
 * ****************************************************************************
5
 * marquee - MODULE FOR XOOPS
6
 * Copyright (c) Hervé Thouzard (https://www.herve-thouzard.com)
7
 *
8
 * You may not change or alter any portion of this comment or credits
9
 * of supporting developers from this source code or any supporting source code
10
 * which is considered copyrighted (c) material of the original comment or credit authors.
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 *
15
 * @copyright          Hervé Thouzard (https://www.herve-thouzard.com)
16
 * @license            GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
17
 * @author             Hervé Thouzard (https://www.herve-thouzard.com)
18
 * ****************************************************************************
19
 *
20
 * @param $limit
21
 * @param $dateFormat
22
 * @param $itemsSize
23
 *
24
 * @return array
25
 */
26
27
use XoopsModules\Newbb;
0 ignored issues
show
The type XoopsModules\Newbb was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
28
29
// Script to list recent posts from Newbb 1 & 2
30
/**
31
 * @param $limit
32
 * @param $dateFormat
33
 * @param $itemsSize
34
 * @return array|false
35
 */
36
function b_marquee_newbb($limit, $dateFormat, $itemsSize)
37
{
38
    //    require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php';
39
    $block = [];
40
    /** @var \XoopsModuleHandler $moduleHandler */
41
    $moduleHandler = xoops_getHandler('module');
42
    $newbb         = $moduleHandler->getByDirname('newbb');
43
    $newbbVersion  = (int)$newbb->getInfo('version');
44
    if ($newbbVersion >= 2) {
45
        $order        = 't.topic_time';
46
        $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum');
0 ignored issues
show
The type XoopsModules\Newbb\Helper was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
47
        /** @var \XoopsModuleHandler $moduleHandler */
48
        $moduleHandler = xoops_getHandler('module');
49
        $newbb         = $moduleHandler->getByDirname('newbb');
50
        if (null === $newbbConfig) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $newbbConfig seems to be never defined.
Loading history...
51
            /** @var \XoopsConfigHandler $configHandler */
52
            $configHandler = xoops_getHandler('config');
53
            $newbbConfig   = $configHandler->getConfigsByCat(0, $newbb->getVar('mid'));
0 ignored issues
show
The assignment to $newbbConfig is dead and can be removed.
Loading history...
54
        }
55
        if (null === $access_forums) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $access_forums seems to be never defined.
Loading history...
56
            $access_forums = $forumHandler->getForums(0, 'access'); // get all accessible forums
57
        }
58
        $validForums   = array_keys($access_forums);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $access_forums does not seem to be defined for all execution paths leading up to this point.
Loading history...
59
        $forumCriteria = ' AND t.forum_id IN (' . implode(',', $validForums) . ')';
60
        unset($access_forums);
61
        $approveCriteria = ' AND t.approved = 1 AND p.approved = 1';
62
        $db              = \XoopsDatabaseFactory::getDatabaseConnection();
63
        $query           = 'SELECT t.*, f.forum_name, f.allow_subject_prefix, p.post_id, p.icon, p.uid, p.poster_name, u.uname, u.name FROM '
64
                           . $db->prefix('bb_topics')
65
                           . ' t, '
66
                           . $db->prefix('bb_forums')
67
                           . ' f, '
68
                           . $db->prefix('bb_posts')
69
                           . ' p LEFT JOIN '
70
                           . $db->prefix('users')
71
                           . ' u ON u.uid = p.uid WHERE f.forum_id=t.forum_id '
72
                           . $forumCriteria
73
                           . $approveCriteria
74
                           . ' AND t.topic_last_post_id=p.post_id ORDER BY '
75
                           . $order
76
                           . ' DESC';
77
        $result          = $db->query($query, $limit, 0);
78
        if (!$result) {
79
            return false;
80
        }
81
        $rows = [];
82
        while (false !== ($row = $db->fetchArray($result))) {
83
            $rows[] = $row;
84
        }
85
        if (count($rows) < 1) {
86
            return false;
87
        }
88
        $myts = \MyTextSanitizer::getInstance();
0 ignored issues
show
The assignment to $myts is dead and can be removed.
Loading history...
89
        foreach ($rows as $arr) {
90
            $title = htmlspecialchars($arr['topic_title'], ENT_QUOTES | ENT_HTML5);
91
            if ($itemsSize > 0) {
92
                $title = xoops_substr($title, 0, $itemsSize + 3);
93
            }
94
            $block[] = [
95
                'date'     => formatTimestamp($arr['topic_time'], $dateFormat),
96
                'category' => $arr['forum_name'],
97
                'author'   => $arr['uid'],
98
                'title'    => $title,
99
                'link'     => "<a href='" . XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $arr['topic_id'] . '&amp;post_id=' . $arr['post_id'] . '#forumpost' . $arr['post_id'] . "'>" . $title . '</a>',
100
            ];
101
        }
102
    } else { // Newbb 1
103
        $db    = \XoopsDatabaseFactory::getDatabaseConnection();
104
        $myts  = \MyTextSanitizer::getInstance();
105
        $order = 't.topic_time';
106
        $time  = $tmpuser = '';
107
        $query = 'SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.topic_time, t.topic_views, t.topic_replies, t.forum_id, f.forum_name FROM '
108
                 . $db->prefix('bb_topics')
109
                 . ' t, '
110
                 . $db->prefix('bb_forums')
111
                 . ' f WHERE f.forum_id=t.forum_id AND f.forum_type <> 1 ORDER BY '
112
                 . $order
113
                 . ' DESC';
114
        if (!$result = $db->query($query, $limit, 0)) {
115
            return false;
116
        }
117
        while (false !== ($arr = $db->fetchArray($result))) {
118
            $lastpostername = $db->query('SELECT post_id, uid FROM ' . $db->prefix('bb_posts') . ' WHERE post_id = ' . $arr['topic_last_post_id']);
119
            while (false !== ($tmpdb = $db->fetchArray($lastpostername))) {
120
                $tmpuser = \XoopsUser::getUnameFromId($tmpdb['uid']);
121
                $time    = formatTimestamp($arr['topic_time'], $dateFormat);
122
            }
123
            $title = htmlspecialchars($arr['topic_title'], ENT_QUOTES | ENT_HTML5);
124
            if ($itemsSize > 0) {
125
                $title = xoops_substr($title, 0, $itemsSize + 3);
126
            }
127
            $block[] = [
128
                'date'     => $time,
129
                'category' => $arr['forum_name'],
130
                'author'   => $tmpuser,
131
                'title'    => $title,
132
                'link'     => "<a href='" . XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $arr['topic_id'] . '&amp;forum=' . $arr['forum_id'] . '&amp;post_id=' . $arr['topic_last_post_id'] . '#forumpost' . $arr['topic_last_post_id'] . "'>" . $title . '</a>',
133
            ];
134
        }
135
    }
136
137
    return $block;
138
}
139