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.

extras/newbb_5x/irmtfan/votepolls.php (2 issues)

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
 * @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
 * @author       XOOPS Development Team
16
 */
17
18
use Xmf\Request;
19
use XoopsModules\Newbb;
20
use XoopsModules\Xoopspoll;
21
use XoopsModules\Xoopspoll\Constants;
22
23
require_once __DIR__ . '/header.php';
24
25
$poll_id  = Request::getInt('poll_id', 0, 'GET');
26
$poll_id  = Request::getInt('poll_id', $poll_id, 'POST');
27
$topic_id = Request::getInt('topic_id', 0, 'GET');
28
$topic_id = Request::getInt('topic_id', $topic_id, 'POST');
29
$forum    = Request::getInt('forum', 0, 'GET');
30
$forum    = Request::getInt('forum', $forum, 'POST');
31
32
/** @var Newbb\TopicHandler $topicHandler */
33
$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic');
34
$topic_obj    = $topicHandler->get($topic_id);
35
if (!$topicHandler->getPermission($topic_obj->getVar('forum_id'), $topic_obj->getVar('topic_status'), 'vote')) {
36
    // irmtfan - issue with javascript:history.go(-1)
37
    redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _NOPERM);
38
}
39
40
if (empty($_POST['option_id'])) {
41
    // irmtfan - add error message - simple url
42
    redirect_header("viewtopic.php?topic_id={$topic_id}", 1, _MD_POLL_NOOPTION);
43
}
44
45
if (($xoopspoll instanceof \XoopsModule) && $xoopspoll->isactive()) {
46
    if ('xoopspoll' === $pollmodules) {
47
        /* xoopspoll module installed & active */
48
        $pollmodul = 'xoopspoll';
49
        xoops_loadLanguage('main', 'xoopspoll');
50
        $xpPollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll');
51
        $xpLogHandler  = Xoopspoll\Helper::getInstance()->getHandler('Log');
52
    } else { // Umfrage
53
        $pollmodul = 'umfrage';
54
        require_once XOOPS_ROOT_PATH . '/modules/umfrage/include/constants.php';
55
        require_once XOOPS_ROOT_PATH . '/modules/umfrage/class/umfrage.php';
56
        require_once XOOPS_ROOT_PATH . '/modules/umfrage/class/umfrageoption.php';
57
        require_once XOOPS_ROOT_PATH . '/modules/umfrage/class/umfragelog.php';
58
        require_once XOOPS_ROOT_PATH . '/modules/umfrage/class/umfragerenderer.php';
59
    }
60
} else {
61
    //no active poll module found
62
    redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_POLLMODULE_ERROR);
63
}
64
65
$mail_author = false;
66
if ('xoopspoll' === $pollmodules) {
67
    $pollObj = $xpPollHandler->get($poll_id);
68
    if ($pollObj instanceof Xoopspoll\Poll) {
69
        if ($pollObj->getVar('multiple')) {
70
            $optionId = Request::getInt('option_id', 0, 'POST');
71
            $optionId = (array)$optionId; // type cast to make sure it's an array
72
            $optionId = array_map('\intval', $optionId); // make sure values are integers
73
        } else {
74
            $optionId = $_POST['option_id'];
75
        }
76
        if (!$pollObj->hasExpired()) {
77
            $msg = _MD_XOOPSPOLL_MUSTLOGIN;
78
            //@todo:: add $url to all redirects
79
            //            $url = $GLOBALS['xoops']->buildUrl("index.php", array('poll_id' => $poll_id));
80
            if ($pollObj->isAllowedToVote()) {
81
                $thisVoter     = (!empty($GLOBALS['xoopsUser'])
82
                                  && ($GLOBALS['xoopsUser'] instanceof \XoopsUser)) ? $GLOBALS['xoopsUser']->getVar('uid') : null;
83
                $votedThisPoll = $xpLogHandler->hasVoted($poll_id, xoops_getenv('REMOTE_ADDR'), $thisVoter);
84
                if (!$votedThisPoll) {
85
                    /* user that hasn't voted before in this poll or module preferences allow it */
86
                    $voteTime = time();
87
                    if ($pollObj->vote($optionId, xoops_getenv('REMOTE_ADDR'), $voteTime)) {
88
                        if (!$xpPollHandler->updateCount($pollObj)) { // update the count and save in db
89
                            echo $pollObj->getHtmlErrors();
90
                            exit();
91
                        }
92
                        $msg = _MD_XOOPSPOLL_THANKSFORVOTE;
93
                    } else {
94
                        /* there was a problem registering the vote */
95
                        redirect_header($GLOBALS['xoops']->buildUrl('index.php', ['poll_id' => $poll_id]), Constants::REDIRECT_DELAY_MEDIUM, _MD_XOOPSPOLL_VOTE_ERROR);
96
                    }
97
                } else {
98
                    $msg = _MD_XOOPSPOLL_ALREADYVOTED;
99
                }
100
                /* set anon user vote (and the time they voted) */
101
                if (!$GLOBALS['xoopsUser'] instanceof \XoopsUser) {
102
                    Xoopspoll\Utility::setVoteCookie($poll_id, $voteTime, 0);
103
                }
104
            } else {
105
                $msg = _MD_XOOPSPOLL_CANNOTVOTE;
106
            }
107
        } else {
108
            /* poll has expired so just show the results */
109
            $msg = _MD_XOOPSPOLL_SORRYEXPIRED;
110
        }
111
    } else {
112
        $msg = _MD_XOOPSPOLL_ERROR_INVALID_POLLID;
113
    }
114
    if (null !== $url) {
115
        redirect_header($url, Constants::REDIRECT_DELAY_MEDIUM, $msg);
116
    } else {
117
        /*
118
                redirect_header($GLOBALS['xoops']->buildUrl("pollresults.php", array('poll_id' => $poll_id)),
119
                                                       Constants::REDIRECT_DELAY_MEDIUM,
120
                                                       $msg);
121
        */
122
        redirect_header($GLOBALS['xoops']->buildUrl('viewtopic.php', ['topic_id' => $topic_id]), Constants::REDIRECT_DELAY_MEDIUM, $msg);
123
    }
124
} else { //Umfrage
125
    $poll = new \Umfrage($poll_id);
0 ignored issues
show
The type Umfrage 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...
126
    if (is_object($xoopsUser)) {
127
        if ((new UmfrageLog())->hasVoted($poll_id, $_SERVER['REMOTE_ADDR'], $xoopsUser->getVar('uid'))) {
0 ignored issues
show
The type UmfrageLog 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...
128
            $msg = _PL_ALREADYVOTED;
129
            setcookie("bb_polls[$poll_id]", 1);
130
        } else {
131
            // irmtfan save ip to db
132
            $poll->vote($_POST['option_id'], $_SERVER['REMOTE_ADDR'], $xoopsUser->getVar('uid'));
133
            $poll->updateCount();
134
            $msg = _PL_THANKSFORVOTE;
135
            setcookie("bb_polls[$poll_id]", 1);
136
        }
137
    } else {
138
        if ((new UmfrageLog())->hasVoted($poll_id, $_SERVER['REMOTE_ADDR'])) {
139
            $msg = _PL_ALREADYVOTED;
140
            setcookie("bb_polls[$poll_id]", 1);
141
        } else {
142
            $poll->vote($_POST['option_id'], $_SERVER['REMOTE_ADDR']);
143
            $poll->updateCount();
144
            $msg = _PL_THANKSFORVOTE;
145
            setcookie("bb_polls[$poll_id]", 1);
146
        }
147
    }
148
}
149
// irmtfan - simple url
150
redirect_header("viewtopic.php?topic_id={$topic_id}", 1, $msg);
151