Issues (1507)

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.

PHPDaemon/Clients/IRC/ChannelParticipant.php (3 issues)

Labels
Severity

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
namespace PHPDaemon\Clients\IRC;
3
4
use PHPDaemon\Utils\IRC;
5
6
class ChannelParticipant
7
{
8
    use \PHPDaemon\Traits\ClassWatchdog;
9
    use \PHPDaemon\Traits\StaticObjectWatchdog;
10
11
    /**
12
     * @var string
13
     */
14
    public $channel;
15
16
    /**
17
     * @var string
18
     */
19
    public $nick;
20
21
    /**
22
     * @var string
23
     */
24
    public $user;
25
26
    /**
27
     * @var string
28
     */
29
    public $flag;
30
31
    /**
32
     * @var string
33
     */
34
    public $mode;
35
36
    /**
37
     * @var boolean
38
     */
39
    public $unverified;
40
41
    /**
42
     * @var string
43
     */
44
    public $host;
45
46
    /**
47
     * @param string $channel
48
     * @param string $nick
49
     */
50
    public function __construct($channel, $nick)
51
    {
52
        $this->channel = $channel;
53
        $this->setNick($nick);
54
        $this->channel->attach($this);
0 ignored issues
show
The method attach cannot be called on $this->channel (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
55
    }
56
57
    /**
58
     * @TODO DESCR
59
     * @param  string $nick
60
     * @return $this
61
     */
62
    public function setNick($nick)
63
    {
64
        if ($this->nick === $nick) {
65
            return $this;
66
        }
67
        $this->nick = $nick;
68
        unset($this->channel->nicknames[$this->nick]);
69
        $this->nick = $nick;
70
        $this->channel->nicknames[$this->nick] = $this;
71
        return $this;
72
    }
73
74
    /**
75
     * @TODO DESCR
76
     * @param  string $channel
77
     * @param  string $nick
78
     * @return static
79
     */
80
    public static function instance($channel, $nick)
81
    {
82
        if (isset($channel->nicknames[$nick])) {
83
            return $channel->nicknames[$nick];
84
        }
85
        return new static($channel, $nick);
86
    }
87
88
    /**
89
     * @param  string $flag
90
     * @return $this
91
     */
92
    public function setFlag($flag)
93
    {
94
        $flag = strtr($flag, ['H' => '', 'G' => '', '*' => '']);
95
        $this->flag = $flag;
96
        if ($flag === '@') {
97
            $this->mode = 'o';
98
        } elseif ($flag === '%') {
99
            $this->mode = 'h';
100
        } elseif ($flag === '+') {
101
            $this->mode = 'v';
102
        }
103
        return $this;
104
    }
105
106
    /**
107
     * @TODO DESCR
108
     */
109
    public function onModeUpdate()
110
    {
111
        if (mb_orig_strpos($this->mode, 'o') !== false) {
112
            $this->flag = '@';
113
        } elseif (mb_orig_strpos($this->mode, 'h') !== false) {
114
            $this->flag = '%';
115
        } elseif (mb_orig_strpos($this->mode, 'v') !== false) {
116
            $this->flag = '+';
117
        } else {
118
            $this->flag = '';
119
        }
120
    }
121
122
    /**
123
     * @TODO DESCR
124
     * @return string
125
     */
126
    public function getUsermask()
127
    {
128
        return $this->nick . '!' . ($this->unverified ? '~' : '') . $this->user . '@' . $this->host;
129
    }
130
131
    /**
132
     * @TODO DESCR
133
     * @param  array|string $mask
134
     * @return $this
135
     */
136
    public function setUsermask($mask)
137
    {
138
        if (is_string($mask)) {
139
            $mask = IRC::parseUsermask($mask);
140
        }
141
        $this
142
            ->setUnverified($mask['unverified'])
143
            ->setUser($mask['user'])
144
            ->setNick($mask['nick'])
145
            ->setHost($mask['host']);
146
        return $this;
147
    }
148
149
    /**
150
     * @TODO DESCR
151
     * @param  string $host
152
     * @return $this
153
     */
154
    public function setHost($host)
155
    {
156
        $this->host = $host;
157
        return $this;
158
    }
159
160
    /**
161
     * @TODO DESCR
162
     * @param  string $user
163
     * @return $this
164
     */
165
    public function setUser($user)
166
    {
167
        $this->user = $user;
168
        return $this;
169
    }
170
171
    /**
172
     * @TODO DESCR
173
     * @param  boolean $bool
174
     * @return $this
175
     */
176
    public function setUnverified($bool)
177
    {
178
        $this->unverified = (bool)$bool;
179
        return $this;
180
    }
181
182
    /**
183
     * @TODO DESCR
184
     */
185
    public function destroy()
186
    {
187
        $this->channel->detach($this);
0 ignored issues
show
The method detach cannot be called on $this->channel (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
188
    }
189
190
    /**
191
     * @TODO DESCR
192
     * @param string $msg
193
     */
194
    public function chanMessage($msg)
195
    {
196
        $this->channel->message($this->nick . ': ' . $msg);
0 ignored issues
show
The method message cannot be called on $this->channel (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
197
    }
198
}
199