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.

class/Cloner.php (2 issues)

Labels
1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Publisher;
4
5
/**
6
 * Class Cloner
7
 */
8
class Cloner
9
{
10
    // recursive cloning script
11
    /**
12
     * @param $path
13
     */
14
    public static function cloneFileFolder($path): void
15
    {
16
        global $patKeys;
17
        global $patValues;
18
19
        $newPath = \str_replace($patKeys[0], $patValues[0], $path);
20
21
        if (\is_dir($path)) {
22
            // create new dir
23
            if (!\mkdir($newPath) && !\is_dir($newPath)) {
24
                throw new \RuntimeException(\sprintf('Directory "%s" was not created', $newPath));
25
            }
26
27
            // check all files in dir, and process it
28
            $handle = \opendir($path);
29
            if ($handle) {
0 ignored issues
show
$handle is of type resource, thus it always evaluated to false.
Loading history...
30
                while (false !== ($file = \readdir($handle))) {
31
                    if (0 !== \mb_strpos($file, '.')) {
32
                        self::cloneFileFolder("{$path}/{$file}");
33
                    }
34
                }
35
                \closedir($handle);
36
            }
37
        } else {
38
            $noChangeExtensions = ['jpeg', 'jpg', 'gif', 'png', 'zip', 'ttf'];
39
            if (\in_array(\mb_strtolower(\pathinfo($path, \PATHINFO_EXTENSION)), $noChangeExtensions, true)) {
0 ignored issues
show
It seems like pathinfo($path, PATHINFO_EXTENSION) can also be of type array; however, parameter $string of mb_strtolower() does only seem to accept string, 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

39
            if (\in_array(\mb_strtolower(/** @scrutinizer ignore-type */ \pathinfo($path, \PATHINFO_EXTENSION)), $noChangeExtensions, true)) {
Loading history...
40
                // image
41
                \copy($path, $newPath);
42
            } else {
43
                // file, read it
44
                $content = file_get_contents($path);
45
                $content = \str_replace($patKeys, $patValues, $content);
46
                file_put_contents($newPath, $content);
47
            }
48
        }
49
    }
50
51
    /**
52
     * @param $dirname
53
     *
54
     * @return bool
55
     */
56
    public static function createLogo($dirname)
57
    {
58
        if (!\extension_loaded('gd')) {
59
            return false;
60
        }
61
        $requiredFunctions = [
62
            'imagecreatefrompng',
63
            'imagecolorallocate',
64
            'imagefilledrectangle',
65
            'imagepng',
66
            'imagedestroy',
67
            'imagefttext',
68
            'imagealphablending',
69
            'imagesavealpha',
70
        ];
71
        foreach ($requiredFunctions as $func) {
72
            if (!\function_exists($func)) {
73
                return false;
74
            }
75
        }
76
        //            unset($func);
77
78
        if (!\file_exists($imageBase = $GLOBALS['xoops']->path('modules/' . $dirname . '/assets/images/logoModule.png'))
79
            || !\file_exists($font = $GLOBALS['xoops']->path('modules/' . $dirname . '/assets/images/VeraBd.ttf'))) {
80
            return false;
81
        }
82
83
        $imageModule = \imagecreatefrompng($imageBase);
84
        // save existing alpha channel
85
        imagealphablending($imageModule, false);
86
        imagesavealpha($imageModule, true);
87
88
        //Erase old text
89
        $greyColor = \imagecolorallocate($imageModule, 237, 237, 237);
90
        \imagefilledrectangle($imageModule, 5, 35, 85, 46, $greyColor);
91
92
        // Write text
93
        $textColor     = \imagecolorallocate($imageModule, 0, 0, 0);
94
        $spaceToBorder = (int)((80 - \mb_strlen($dirname) * 6.5) / 2);
95
        \imagefttext($imageModule, 8.5, 0, $spaceToBorder, 45, $textColor, $font, \ucfirst($dirname), []);
96
97
        // Set transparency color
98
        //$white = imagecolorallocatealpha($imageModule, 255, 255, 255, 127);
99
        //imagefill($imageModule, 0, 0, $white);
100
        //imagecolortransparent($imageModule, $white);
101
102
        \imagepng($imageModule, $GLOBALS['xoops']->path('modules/' . $dirname . '/assets/images/logoModule.png'));
103
        \imagedestroy($imageModule);
104
105
        return true;
106
    }
107
}
108