Issues (608)

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.

class/Registryfile.php (10 issues)

1
<?php
2
3
namespace XoopsModules\Oledrion;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
*/
14
15
/**
16
 * oledrion
17
 *
18
 * @copyright   {@link https://xoops.org/ XOOPS Project}
19
 * @license     {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
20
 * @author      Hervé Thouzard (http://www.herve-thouzard.com/)
21
 */
22
23
use XoopsModules\Oledrion;
24
25
/**
26
 * Management of text files used to display messages to users on certain pages
27
 */
28
class Registryfile
29
{
30
    public $filename; // File name to process
31
32
    /**
33
     * Access the only instance of this class
34
     *
35
     * @return Registryfile
36
     */
37
    public static function getInstance()
38
    {
39
        static $instance;
40
        if (null === $instance) {
41
            $instance = new static();
42
        }
43
44
        return $instance;
45
    }
46
47
    /**
48
     * Registryfile constructor.
49
     * @param null $fichier
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $fichier is correct as it would always require null to be passed?
Loading history...
50
     */
51
    public function __construct($fichier = null)
52
    {
53
        $this->setfile($fichier);
54
    }
55
56
    /**
57
     * @param null $fichier
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $fichier is correct as it would always require null to be passed?
Loading history...
58
     */
59
    public function setfile($fichier = null)
60
    {
61
        if ($fichier) {
0 ignored issues
show
$fichier is of type null, thus it always evaluated to false.
Loading history...
62
            $this->filename = OLEDRION_TEXT_PATH . $fichier;
63
        }
64
    }
65
66
    /**
67
     * @param  null $fichier
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $fichier is correct as it would always require null to be passed?
Loading history...
68
     * @return string
69
     */
70
    public function getfile($fichier = null)
71
    {
72
        $fw = '';
73
        if (!$fichier) {
0 ignored issues
show
$fichier is of type null, thus it always evaluated to false.
Loading history...
74
            $fw = $this->filename;
75
        } else {
76
            $fw = OLEDRION_TEXT_PATH . $fichier;
77
        }
78
79
        if (file_exists($fw)) {
80
            return file_get_contents($fw);
81
        }
82
83
        return '';
84
    }
85
86
    /**
87
     * @param       $content
88
     * @param  null $fichier
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $fichier is correct as it would always require null to be passed?
Loading history...
89
     * @return bool
90
     */
91
    public function savefile($content, $fichier = null)
92
    {
93
        $fw = '';
94
        if (!$fichier) {
0 ignored issues
show
$fichier is of type null, thus it always evaluated to false.
Loading history...
95
            $fw = $this->filename;
96
        } else {
97
            $fw = OLEDRION_TEXT_PATH . $fichier;
98
        }
99
        if (file_exists($fw)) {
100
            if (false === @unlink($fw)) {
101
                throw new \RuntimeException('The file ' . $fw . ' could not be deleted.');
102
            }
103
        }
104
        $fp = fopen($fw, 'wb') || die('Error, impossible to create the file ' . $this->filename);
0 ignored issues
show
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
105
        fwrite($fp, $content);
0 ignored issues
show
$fp of type boolean is incompatible with the type resource expected by parameter $stream of fwrite(). ( Ignorable by Annotation )

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

105
        fwrite(/** @scrutinizer ignore-type */ $fp, $content);
Loading history...
106
        fclose($fp);
0 ignored issues
show
$fp of type boolean is incompatible with the type resource expected by parameter $stream of fclose(). ( Ignorable by Annotation )

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

106
        fclose(/** @scrutinizer ignore-type */ $fp);
Loading history...
107
108
        return true;
109
    }
110
}
111