Issues (170)

Security Analysis    no request data  

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.

rest-change-password/RestChangePasswordDriver.php (1 issue)

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
3
class RestChangePasswordDriver implements \RainLoop\Providers\ChangePassword\ChangePasswordInterface
4
{
5
    /**
6
     * @var string
7
     */
8
    private $sUrl = '';
9
10
    /**
11
     * @var string
12
     */
13
    private $sKey = '';
14
15
    /**
16
     * @var string
17
     */
18
    private $sFieldEmail = '';
19
20
    /**
21
     * @var string
22
     */
23
    private $sFieldOldpassword = '';
24
25
    /**
26
     * @var string
27
     */
28
    private $sFieldNewpassword = '';
29
30
    /**
31
     * @var string
32
     */
33
    private $sAllowedEmails = '';
34
35
    /**
36
     * @var \MailSo\Log\Logger
37
     */
38
    private $oLogger = null;
39
40
    /**
41
     * @param string $sHost
42
     * @param int $iPort
43
     *
44
     * @return \RestChangePasswordDriver
45
     */
46
    public function SetConfig($sUrl, $sKey)
47
    {
48
        $this->sUrl = $sUrl;
49
        $this->sKey = $sKey;
50
51
        return $this;
52
    }
53
54
    $oProvider->SetFieldNames($sFieldEmail, $sFieldOldpassword, $sFieldNewpassword);
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_VARIABLE, expecting T_FUNCTION or T_CONST
Loading history...
55
56
    /**
57
     * @param string $sFieldEmail
58
     * @param string $sFieldOldpassword
59
     * @param string $sFieldNewpassword
60
     *
61
     * @return \RestChangePasswordDriver
62
     */
63
    public function SetFieldNames($sFieldEmail, $sFieldOldpassword, $sFieldNewpassword)
64
    {
65
        $this->sFieldEmail       = $sFieldEmail;
66
        $this->sFieldOldpassword = $sFieldOldpassword;
67
        $this->sFieldNewpassword = $sFieldNewpassword;
68
        return $this;
69
    }
70
71
    /**
72
     * @param string $sAllowedEmails
73
     *
74
     * @return \RestChangePasswordDriver
75
     */
76
    public function SetAllowedEmails($sAllowedEmails)
77
    {
78
        $this->sAllowedEmails = $sAllowedEmails;
79
        return $this;
80
    }
81
82
    /**
83
     * @param \MailSo\Log\Logger $oLogger
84
     *
85
     * @return \RestChangePasswordDriver
86
     */
87
    public function SetLogger($oLogger)
88
    {
89
        if ($oLogger instanceof \MailSo\Log\Logger)
90
        {
91
            $this->oLogger = $oLogger;
92
        }
93
94
        return $this;
95
    }
96
97
    /**
98
     * @param \RainLoop\Account $oAccount
99
     *
100
     * @return bool
101
     */
102
    public function PasswordChangePossibility($oAccount)
103
    {
104
        return $oAccount && $oAccount->Email() &&
105
            \RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails);
106
    }
107
108
    /**
109
     * @param \RainLoop\Account $oAccount
110
     * @param string $sPrevPassword
111
     * @param string $sNewPassword
112
     *
113
     * @return bool
114
     */
115
    public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword)
116
    {
117
        if ($this->oLogger)
118
        {
119
            $this->oLogger->Write('Rest: Try to change password for '.$oAccount->Email());
120
        }
121
122
        $bResult = false;
123
        if (!empty($this->sHost) && 0 < $this->iPort && $oAccount)
124
        {
125
            $sEmail = \trim(\strtolower($oAccount->Email()));
126
127
            # Adding  the REST Api key to the url, try to use always https
128
            $sUrl = str_replace('://', '://'+$this->sKey+"@", $this->sUrl);
129
130
            $iCode = 0;
131
            $oHttp = \MailSo\Base\Http::SingletonInstance();
132
133
            if ($this->oLogger)
134
            {
135
                $this->oLogger->Write('Rest[Api Request]:'.$sUrl);
136
            }
137
138
            $mResult = $oHttp->SendPostRequest($sUrl,
139
                array(
140
                    $this->sFieldEmail => $sEmail,
141
                    $this->sFieldOldpassword => $sPrevPassword,
142
                    $this->sFieldNewpassword => $sNewPassword,
143
                ), 'MailSo Http User Agent (v1)', $iCode, $this->oLogger);
144
145
            if (false !== $mResult && 200 === $iCode)
146
            {
147
                $aRes = null;
148
                @\parse_str($mResult, $aRes);
149
                if (is_array($aRes) && (!isset($aRes['error']) || (int) $aRes['error'] !== 1))
150
                {
151
                    $bResult = true;
152
                }
153
                else
154
                {
155
                    if ($this->oLogger)
156
                    {
157
                        $this->oLogger->Write('Rest[Error]: Response: '.$mResult);
158
                    }
159
                }
160
            }
161
            else
162
            {
163
                if ($this->oLogger)
164
                {
165
                    $this->oLogger->Write('Rest[Error]: Empty Response: Code:'.$iCode);
166
                }
167
            }
168
        }
169
170
        return $bResult;
171
    }
172
}
173