Issues (371)

Security Analysis    no vulnerabilities found

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.
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       XOOPS Project (https://xoops.org)
14
 * @license         https://www.fsf.org/copyleft/gpl.html GNU public license
15
 * @since           1.0
16
 * @author          trabis <[email protected]>
17
 * @author          The SmartFactory <www.smartfactory.ca>
18
 */
19
20
use Xmf\Request;
21
use XoopsModules\Publisher;
22
use XoopsModules\Publisher\Utility;
23
24
require_once __DIR__ . '/header.php';
25
26
$helper->loadLanguage('admin');
27
//xoops_loadLanguage('admin', PUBLISHER_DIRNAME);
28
29
$op     = Request::getString('op', Request::getString('op', '', 'GET'), 'POST');
30
$fileid = Request::getInt('fileid', Request::getInt('fileid', 0, 'GET'), 'POST');
31
32
if (0 == $fileid) {
33
    redirect_header('index.php', 2, _MD_PUBLISHER_NOITEMSELECTED);
34
}
35
36
$fileObj = $helper->getHandler('File')
37
                  ->get($fileid);
38
39
// if the selected item was not found, exit
40
if (!$fileObj) {
41
    redirect_header('index.php', 1, _NOPERM);
42
}
43
44
$itemObj = $helper->getHandler('Item')
45
                  ->get($fileObj->getVar('itemid'));
46
47
// if the user does not have permission to modify this file, exit
48
if (!(Utility::userIsAdmin() || Utility::userIsModerator($itemObj) || (is_object($GLOBALS['xoopsUser']) && $fileObj->getVar('uid') == $GLOBALS['xoopsUser']->getVar('uid')))) {
49
    redirect_header('index.php', 1, _NOPERM);
50
}
51
52
/* -- Available operations -- */
53
switch ($op) {
54
    case 'default':
55
    case 'mod':
56
        require_once XOOPS_ROOT_PATH . '/header.php';
57
        require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
58
59
        // FILES UPLOAD FORM
60
        $uploadForm = $fileObj->getForm();
61
        $uploadForm->display();
62
        break;
63
    case 'modify':
64
        $fileid = Request::getInt('fileid', 0, 'POST');
65
66
        // Creating the file object
67
        if (0 != $fileid) {
68
            $fileObj = $helper->getHandler('File')
69
                              ->get($fileid);
70
        } else {
71
            redirect_header('index.php', 1, _NOPERM);
72
        }
73
74
        // Putting the values in the file object
75
        $fileObj->setVar('name', Request::getString('name'));
76
        $fileObj->setVar('description', Request::getString('description'));
77
        $fileObj->setVar('status', Request::getInt('file_status', 0, 'GET'));
78
79
        // attach file if any
80
81
        if ('' != Request::getString('item_upload_file', '', 'FILES')) {
82
            $oldfile = $fileObj->getFilePath();
83
84
            // Get available mimetypes for file uploading
85
            $allowedMimetypes = $helper->getHandler('Mimetype')
86
                                       ->getArrayByType();
87
            // TODO : display the available mimetypes to the user
88
            $errors = [];
89
90
            //            if ($helper->getConfig('perm_upload') && is_uploaded_file(Request::getArray('item_upload_file', array(), 'FILES')['tmp_name'])) {
91
            $temp = Request::getArray('item_upload_file', [], 'FILES');
92
            if ($helper->getConfig('perm_upload') && is_uploaded_file($temp['tmp_name'])) {
93
                if ($fileObj->checkUpload('item_upload_file', $allowedMimetypes, $errors)) {
94
                    if ($fileObj->storeUpload('item_upload_file', $allowedMimetypes, $errors)) {
95
                        unlink($oldfile);
96
                    }
97
                }
98
            }
99
        }
100
101
        if (!$helper->getHandler('File')
102
                    ->insert($fileObj)) {
103
            redirect_header('item.php?itemid=' . $fileObj->itemid(), 3, _AM_PUBLISHER_FILE_EDITING_ERROR . Utility::formatErrors($fileObj->getErrors()));
104
        }
105
106
        redirect_header('item.php?itemid=' . $fileObj->itemid(), 2, _AM_PUBLISHER_FILE_EDITING_SUCCESS);
107
        break;
108
    case 'clear':
109
        //mb        echo 'my time is now ' . now;
110
        break;
111
    case 'del':
112
        $confirm = Request::getInt('confirm', '', 'POST');
0 ignored issues
show
'' of type string is incompatible with the type integer expected by parameter $default of Xmf\Request::getInt(). ( Ignorable by Annotation )

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

112
        $confirm = Request::getInt('confirm', /** @scrutinizer ignore-type */ '', 'POST');
Loading history...
113
114
        if ($confirm) {
115
            if (!$helper->getHandler('File')
116
                        ->delete($fileObj)) {
117
                redirect_header('item.php?itemid=' . $fileObj->itemid(), 2, _AM_PUBLISHER_FILE_DELETE_ERROR);
118
            }
119
120
            redirect_header('item.php?itemid=' . $fileObj->itemid(), 2, sprintf(_AM_PUBLISHER_FILEISDELETED, $fileObj->name()));
121
        } else {
122
            // no confirm: show deletion condition
123
124
            require_once XOOPS_ROOT_PATH . '/header.php';
125
            xoops_confirm(['op' => 'del', 'fileid' => $fileObj->fileid(), 'confirm' => 1, 'name' => $fileObj->name()], 'file.php', _AM_PUBLISHER_DELETETHISFILE . ' <br>' . $fileObj->name() . ' <br> <br>', _AM_PUBLISHER_DELETE);
126
            require_once XOOPS_ROOT_PATH . '/footer.php';
127
        }
128
        exit();
129
}
130
require_once XOOPS_ROOT_PATH . '/footer.php';
131