Issues (102)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  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.
  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.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
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.

blocks/xhp_block_latest.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
// $Id: xhp_block_latest.php 11919 2013-08-14 14:07:10Z beckmi $
3
//  ------------------------------------------------------------------------ //
4
//                XOOPS - PHP Content Management System                      //
5
//                    Copyright (c) 2000 XOOPS.org                           //
6
//                       <http://www.xoops.org/>                             //
7
// ------------------------------------------------------------------------- //
8
//  This program is free software; you can redistribute it and/or modify     //
9
//  it under the terms of the GNU General Public License as published by     //
10
//  the Free Software Foundation; either version 2 of the License, or        //
11
//  (at your option) any later version.                                      //
12
//                                                                           //
13
//  You may not change or alter any portion of this comment or credits       //
14
//  of supporting developers from this source code or any supporting         //
15
//  source code which is considered copyrighted (c) material of the          //
16
//  original comment or credit authors.                                      //
17
//                                                                           //
18
//  This program is distributed in the hope that it will be useful,          //
19
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
20
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
21
//  GNU General Public License for more details.                             //
22
//                                                                           //
23
//  You should have received a copy of the GNU General Public License        //
24
//  along with this program; if not, write to the Free Software              //
25
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26
//  ------------------------------------------------------------------------ //
27
28
// $options[0]: sorting order <DESC or ''> //
0 ignored issues
show
Unused Code Comprehensibility introduced by
40% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
29
// $options[1]: num to list //
30
// $options[2]: module dirname //
31
32
/**
33
 * @param $options
34
 * @return array
35
 */
36
function b_XHP_latest_show($options)
37
{
38
    global $xoopsDB, $xoopsUser, $xoopsConfig;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
39
    $myts      = MyTextSanitizer::getInstance();
40
    $block     = array();
41
    $mydirname = $options[2];
42
    $mymodpath = "modules/$mydirname";
43
    include "$mymodpath/module_prefix.php";
44
    if (file_exists("$mymodpath/language/" . $xoopsConfig['language'] . '/main.php')) {
45
        include "$mymodpath/language/" . $xoopsConfig['language'] . '/main.php';
46
    } else {
47
        include "$mymodpath/language/english/main.php";
48
    }
49
    $mytablename = $xoopsDB->prefix($module_prefix . '_quiz');
0 ignored issues
show
The variable $module_prefix does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
50
    if ($xoopsUser) {
51
        $alert = '';
52
    } else {
53
        $alert = " onClick='alert(\"" . _MD_ALERTGUEST . "\")'";
54
    }
55
    $sql    = "SELECT artid, secid, title, posted, counter, display, expire FROM $mytablename WHERE display=1  ORDER BY posted $options[0] LIMIT $options[1]";
56
    $result = $xoopsDB->query($sql);
57
    while ($myrow = $xoopsDB->fetchArray($result)) {
58
        $items            = array();
59
        $items['ref']     = $mymodpath . '/index.php?op=viewarticle&amp;artid=' . $myrow['artid'];
60
        $items['title']   = $myts->makeTboxData4Show($myrow['title']);
61
        $items['posted']  = $myrow['posted'];
62
        $items['counter'] = $myrow['counter'];
63
        $items['alert']   = $alert;
64
        $block['items'][] = $items;
65
    }
66
67
    return $block;
68
}
69
70
/**
71
 * @param $options
72
 * @return string
73
 */
74
function b_XHP_latest_edit($options)
75
{
76
    $form = _MB_XHP_ITEMS_ORDER . "&nbsp;<select name='options[]'>";
77
    $form .= "<option value='DESC'";
78
    if ($options[0] === 'DESC') {
79
        $form .= " selected='selected'";
80
    }
81
    $form .= '>' . _MB_XHP_ITEMS_DESC . "</option>\n";
82
    $form .= "<option value=''";
83
    if ($options[0] === '') {
84
        $form .= " selected='selected'";
85
    }
86
    $form .= '>' . _MB_XHP_ITEMS_ASCEND . "</option>\n";
87
    $form .= "</select>\n";
88
    $form .= '&nbsp;' . _MB_XHP_ITEMS_DISP . "&nbsp;<input type='text'  size=5 name='options[]' value='" . $options[1] . "' />&nbsp;" . _MB_XHP_ITEMS_ARTCLS . '';
89
    $form .= "<input type='hidden' name='options[]' value='" . $options[2] . "'>";
90
91
    return $form;
92
}
93