Issues (340)

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/UserstatsHandler.php (2 issues)

1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Newbb;
4
5
/**
6
 * NewBB,  the forum module for XOOPS project
7
 *
8
 * @copyright      XOOPS Project (https://xoops.org)
9
 * @license        GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
10
 * @author         Taiwen Jiang (phppp or D.J.) <[email protected]>
11
 * @since          4.00
12
 */
13
\defined('NEWBB_FUNCTIONS_INI') || require $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php');
14
15
/**
16
 * user stats
17
 */
18
class UserstatsHandler extends \XoopsPersistableObjectHandler
19
{
20
    /**
21
     * @param \XoopsDatabase|null $db
22
     */
23
    public function __construct(\XoopsDatabase $db = null)
24
    {
25
        parent::__construct($db, 'newbb_user_stats', Userstats::class, 'uid', '');
26
    }
27
28
    /**
29
     * @param \XoopsDatabase|null $db
30
     * @return UserstatsHandler
31
     */
32
    public static function getInstance(\XoopsDatabase $db = null): UserstatsHandler
33
    {
34
        static $instance;
35
        if (null === $instance) {
36
            $instance = new static($db);
37
        }
38
39
        return $instance;
40
    }
41
42
    /**
43
     * @param mixed $id
44
     * @param array|null  $fields
45
     * @return null|\XoopsObject
46
     */
47
    public function get($id = null, $fields = null): ?\XoopsObject //get($id)
48
    {
49
        $object = null;
0 ignored issues
show
The assignment to $object is dead and can be removed.
Loading history...
50
        if (!$id = (int)$id) {
51
            return null;
52
        }
53
        $object = $this->create(false);
54
        $object->setVar($this->keyName, $id);
55
        if (!$row = $this->getStats($id)) {
56
            return $object;
57
        }
58
        $object->assignVars($row);
0 ignored issues
show
It seems like $row can also be of type true; however, parameter $var_arr of XoopsObject::assignVars() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

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

58
        $object->assignVars(/** @scrutinizer ignore-type */ $row);
Loading history...
59
60
        /*
61
        $sql = "SELECT * FROM " . $this->table . " WHERE ".$this->keyName." = " . $id;
62
        if (!$result = $this->db->query($sql)) {
63
            return $object;
64
        }
65
        while (false !== ($row = $this->db->fetchArray($result))) {
66
            $object->assignVars($row);
67
        }
68
        */
69
70
        return $object;
71
    }
72
73
    /**
74
     * @param int $id
75
     * @return mixed[]|bool
76
     */
77
    public function getStats(int $id)
78
    {
79
        if (empty($id)) {
80
            return null;
81
        }
82
        $sql = 'SELECT * FROM ' . $this->table . ' WHERE ' . $this->keyName . ' = ' . (int)$id;
83
        $result = $this->db->query($sql);
84
        if (!$this->db->isResultSet($result)) {
85
            return null;
86
        }
87
88
        $row = $this->db->fetchArray($result);
89
90
        return $row;
91
    }
92
    /*
93
        function insert(\XoopsObject $object, $force = true)
94
        {
95
            if (!$object->isDirty()) {
96
                $object->setErrors("not isDirty");
97
98
                return $object->getVar($this->keyName);
99
            }
100
            $this->loadHandler("write");
101
            if (!$changedVars = $this->_handler["write"]->cleanVars($object)) {
102
                $object->setErrors("cleanVars failed");
103
104
                return $object->getVar($this->keyName);
105
            }
106
            $queryFunc = empty($force) ? "query" : "queryF";
107
108
            $keys = [];
109
            foreach ($changedVars as $k => $v) {
110
                $keys[] = " {$k} = {$v}";
111
            }
112
            $sql = "REPLACE INTO " . $this->table . " SET ".implode(",",$keys);
113
            if (!$result = $this->db->{$queryFunc}($sql)) {
114
                $object->setErrors("update object error:" . $sql);
115
116
                return false;
117
            }
118
            unset($changedVars);
119
120
            return $object->getVar($this->keyName);
121
        }
122
    */
123
}
124