Issues (371)

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.

include/onupdate.php (1 issue)

Labels
Severity
1
<?php declare(strict_types=1);
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
 * Xoopspoll install functions.php
14
 *
15
 * @copyright:: {@link https://xoops.org/ XOOPS Project}
16
 * @license  ::   {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2.0 or later}
17
 * @since    ::     1.40
18
 * @author   ::    zyspec <[email protected]>
19
 */
20
21
use XoopsModules\Xoopspoll\{
22
    Helper,
23
    Utility
24
};
25
26
/**
27
 * @param \XoopsDatabase|null $db
28
 * @param                     $fromTable
29
 * @param                     $toTable
30
 * @return bool
31
 */
32
function xoopspollChangeTableName(\XoopsDatabase $db, $fromTable, $toTable): bool
33
{
34
    $fromTable = addslashes($fromTable);
35
    $toTable   = addslashes($toTable);
36
    /*
37
        $fromThisTable = $db->prefix("{$fromTable}");
38
        $toThisTable = $db->prefix("{$toTable}");
39
    */
40
    $helper  = Helper::getInstance();
41
    $success = false;
42
    if (Utility::dbTableExists($db, $fromTable) && !Utility::dbTableExists($db, $toTable)) {
43
        $sql     = 'ALTER TABLE ' . $db->prefix((string)$fromTable) . ' RENAME ' . $db->prefix('{$toTable}');
44
        $success = $db->queryF($sql);
45
        if (false === $success) {
46
            $moduleHandler   = $helper->getHandler('Module');
47
            $xoopspollModule = $moduleHandler->getByDirname('xoopspoll');
0 ignored issues
show
The method getByDirname() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsModuleHandler or XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

47
            /** @scrutinizer ignore-call */ 
48
            $xoopspollModule = $moduleHandler->getByDirname('xoopspoll');
Loading history...
48
            $xoopspollModule->setErrors(sprintf(_AM_XOOPSPOLL_UPGRADE_FAILED, $fromTable));
49
        }
50
    }
51
52
    return $success;
53
}
54
55
/**
56
 * @param \XoopsModule $module
57
 * @param              $prev_version
58
 * @return bool
59
 */
60
function xoops_module_update_xoopspoll(\XoopsModule $module, $prev_version): bool
61
{
62
    // referer check
63
    $success = false;
64
    $ref     = xoops_getenv('HTTP_REFERER');
65
    $helper  = Helper::getInstance();
66
    if (('' === $ref) || 0 === mb_strpos($ref, $GLOBALS['xoops']->url('modules/system/admin.php'))) {
67
        /* module specific part */
68
        require_once $helper->path('include/oninstall.php');
69
70
        $installedVersion = (int)$prev_version;
71
        xoops_loadLanguage('admin', 'xoopspoll');
72
        $db      = \XoopsDatabaseFactory::getDatabaseConnection();
73
        $success = true;
74
        if ($installedVersion < 140) {
75
            /* add column for poll anonymous which was created in versions prior
76
             * to 1.40 of xoopspoll but not automatically created
77
             */
78
            $result    = $db->queryF('SHOW COLUMNS FROM ' . $db->prefix('xoopspoll_desc') . " LIKE 'anonymous'");
79
            $foundAnon = $db->getRowsNum($result);
80
            if (empty($foundAnon)) {
81
                // column doesn't exist, so try and add it
82
                $success = $db->queryF('ALTER TABLE ' . $db->prefix('xoopspoll_desc') . ' ADD anonymous TINYINT( 1 ) DEFAULT 0 NOT NULL AFTER multiple');
83
                if (false === $success) {
84
                    $module->setErrors(_AM_XOOPSPOLL_ERROR_COLUMN . 'anonymous');
85
                }
86
            }
87
            /* change description to TINYTEXT */
88
            if ($success) {
89
                $success = $db->queryF('ALTER TABLE ' . $db->prefix('xoopspoll_desc') . ' MODIFY description TINYTEXT NOT NULL');
90
                if (false === $success) {
91
                    $module->setErrors(_AM_XOOPSPOLL_ERROR_COLUMN . 'description');
92
                }
93
            }
94
95
            if ($success) {
96
                $success = $db->queryF('ALTER TABLE ' . $db->prefix('xoopspoll_desc') . " ADD multilimit TINYINT( 63 ) UNSIGNED DEFAULT '0' NOT NULL AFTER multiple");
97
                if (false === $success) {
98
                    $module->setErrors(_AM_XOOPSPOLL_ERROR_COLUMN . 'multilimit');
99
                }
100
            }
101
            if ($success) {
102
                $success = $db->queryF('ALTER TABLE ' . $db->prefix('xoopspoll_desc') . " ADD mail_voter TINYINT( 1 ) UNSIGNED DEFAULT '0' NOT NULL AFTER mail_status");
103
                if (false === $success) {
104
                    $module->setErrors(_AM_XOOPSPOLL_ERROR_COLUMN . 'mail_voter');
105
                }
106
            }
107
            if ($success) {
108
                $result   = $db->queryF('SHOW COLUMNS FROM ' . $db->prefix('xoopspoll_desc') . " LIKE 'visibility'");
109
                $foundCol = $db->getRowsNum($result);
110
                if (empty($foundCol)) {
111
                    // column doesn't exist, so try and add it
112
                    $success = $db->queryF('ALTER TABLE ' . $db->prefix('xoopspoll_desc') . " ADD visibility INT( 3 ) DEFAULT '0' NOT NULL AFTER display");
113
                    if (false === $success) {
114
                        $module->setErrors(_AM_XOOPSPOLL_ERROR_COLUMN . 'visibility');
115
                    }
116
                }
117
            }
118
        }
119
120
        if ($success) {
121
            /* now reverse table names changes from 1.40 Beta  */
122
            $s1      = xoopspollChangeTableName($db, 'mod_xoopspoll_option', 'xoopspoll_option');
123
            $s2      = xoopspollChangeTableName($db, 'mod_xoopspoll_desc', 'xoopspoll_desc');
124
            $s3      = xoopspollChangeTableName($db, 'mod_xoopspoll_log', 'xoopspoll_log');
125
            $success = ($s1 && $s2 && $s3);
126
        }
127
    }
128
129
    return $success;
130
}
131