This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | function ldGetCurrentTemplate( $function ) { |
||
4 | if ( isset($function) ) { |
||
5 | return $function; |
||
6 | } else { |
||
7 | $me = ar_ariadneContext::getObject(); |
||
8 | if ($me) { |
||
9 | $context = $me->getContext(); |
||
10 | return $context['arCallFunction']; |
||
11 | } |
||
12 | } |
||
13 | return null; |
||
14 | } |
||
15 | |||
16 | function ldSetCredentials($login, $ARUserDir="/system/users/") { |
||
0 ignored issues
–
show
ldSetCredentials uses the super-global variable $_SERVER which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: // Bad
class Router
{
public function generate($path)
{
return $_SERVER['HOST'].$path;
}
}
// Better
class Router
{
private $host;
public function __construct($host)
{
$this->host = $host;
}
public function generate($path)
{
return $this->host.$path;
}
}
class Controller
{
public function myAction(Request $request)
{
// Instead of
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
// Better (assuming you use the Symfony2 request)
$page = $request->query->get('page', 1);
}
}
![]() The function
ldSetCredentials() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L127-128) is considered.
This check looks for functions that have already been defined in other files. Some Codebases, like WordPress, make a practice of defining functions multiple times. This
may lead to problems with the detection of function parameters and types. If you really
need to do this, you can mark the duplicate definition with the /**
* @ignore
*/
function getUser() {
}
function getUser($id, $realm) {
}
See also the PhpDoc documentation for @ignore. ![]() |
|||
17 | global $ARCurrent, $AR; |
||
18 | if (!$ARUserDir || $ARUserDir == "") { |
||
19 | $ARUserDir = "/system/users/"; |
||
20 | } |
||
21 | |||
22 | // Make sure the login is lower case. Because of the |
||
23 | // numerous checks on "admin". |
||
24 | $login = strtolower( $login ); |
||
25 | |||
26 | debug("ldSetCredentials($login)","object"); |
||
27 | |||
28 | if (!$ARCurrent->session) { |
||
29 | ldStartSession(); |
||
30 | } else { |
||
31 | /* use the same sessionid if the user didn't login before */ |
||
32 | ldStartSession($ARCurrent->session->id); |
||
33 | } |
||
34 | $ARCurrent->session->put("ARLogin", $login); |
||
35 | $ARCurrent->session->put("ARUserDir", $ARUserDir, true); |
||
36 | |||
37 | /* create the session key */ |
||
38 | $session_key = bin2hex(random_bytes(16)); |
||
39 | |||
40 | $ARCurrent->session->put("ARSessionKey", $session_key, true); |
||
41 | $ARCurrent->session->put("ARSessionTimedout", 0, 1); |
||
42 | |||
43 | /* now save our session */ |
||
44 | $ARCurrent->session->save(); |
||
45 | |||
46 | $cookies = (array)$_COOKIE["ARSessionCookie"]; |
||
47 | $https = ($_SERVER['HTTPS']=='on'); |
||
48 | |||
49 | $currentCookies = array(); |
||
50 | |||
51 | foreach($cookies as $sessionid => $cookie){ |
||
52 | if(!$AR->hideSessionIDfromURL){ |
||
53 | if (!$ARCurrent->session->sessionstore->exists("/$sessionid/")) { |
||
54 | $data = ldDecodeCookie($cookie); |
||
55 | if(is_array($data)) { |
||
56 | // don't just kill it, it may be from another ariadne installation |
||
57 | if ($data['timestamp']<(time()-86400)) { |
||
58 | // but do kill it if it's older than one day |
||
59 | unset($cookies[$sessionid]); |
||
60 | setcookie("ARSessionCookie[".$sessionid."]",false); |
||
61 | } else { |
||
62 | $currentCookies[$sessionid] = $data['timestamp']; |
||
63 | } |
||
64 | } |
||
65 | } |
||
66 | } |
||
67 | } |
||
68 | |||
69 | // Keep a maximum of 15 session cookies for one client |
||
70 | if (sizeof($currentCookies) > 15) { |
||
71 | sort($currentCookies); |
||
72 | $removed = array_slice(array_keys($input), 15); // grab the session ids for all the older sessions |
||
0 ignored issues
–
show
|
|||
73 | foreach ($removed as $sessionid) { |
||
74 | // and kill those sessions |
||
75 | unset($cookies[$sessionid]); |
||
76 | setcookie("ARSessionCookie[".$sessionid."]",false); |
||
77 | } |
||
78 | } |
||
79 | |||
80 | if( $ARCurrent->session->id !== 0) { |
||
81 | $data = array(); |
||
82 | |||
83 | $data['login']=$login; |
||
84 | $data['timestamp']=time(); |
||
85 | $data['check']=ldGenerateSessionKeyCheck(); |
||
86 | |||
87 | $cookie=ldEncodeCookie($data); |
||
88 | $cookiename = "ARSessionCookie[".$ARCurrent->session->id."]"; |
||
89 | |||
90 | header('P3P: CP="NOI CUR OUR"'); |
||
91 | setcookie('ARCurrentSession', $ARCurrent->session->id, 0, '/', false, $https, true); |
||
92 | setcookie($cookiename,$cookie, 0, '/', false, $https, true); |
||
93 | } |
||
94 | } |
||
95 | |||
96 | View Code Duplication | function ldAccessTimeout($path, $message, $args = null, $function = null) { |
|
0 ignored issues
–
show
This function seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
97 | global $ARCurrent, $store; |
||
98 | /* |
||
99 | since there is no 'peek' function, we need to pop and push |
||
100 | the arCallArgs variable. |
||
101 | */ |
||
102 | |||
103 | if( isset( $args ) ) { |
||
104 | $arCallArgs = $args; |
||
105 | } else { |
||
106 | $arCallArgs = @array_pop($ARCurrent->arCallStack); |
||
107 | @array_push($ARCurrent->arCallStack, $arCallArgs); |
||
108 | } |
||
109 | |||
110 | $eventData = new baseObject(); |
||
111 | $eventData->arCallPath = $path; |
||
0 ignored issues
–
show
The property
arCallPath does not seem to exist in baseObject .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
112 | $eventData->arCallFunction = ldGetCurrentTemplate( $function ); |
||
0 ignored issues
–
show
The property
arCallFunction does not seem to exist in baseObject .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
113 | $eventData->arCallArgs = $arCallArgs; |
||
0 ignored issues
–
show
The property
arCallArgs does not seem to exist in baseObject .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
114 | $eventData->arLoginMessage = $message; |
||
0 ignored issues
–
show
The property
arLoginMessage does not seem to exist in baseObject .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
115 | $eventData->arReason = 'access timeout'; |
||
0 ignored issues
–
show
The property
arReason does not seem to exist in baseObject .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
116 | $eventData = ar_events::fire( 'onaccessdenied', $eventData ); |
||
117 | if ( $eventData ) { |
||
118 | |||
119 | $arCallArgs = $eventData->arCallArgs; |
||
120 | $arCallArgs["arLoginMessage"] = $eventData->message; |
||
121 | |||
122 | if (!$ARCurrent->arLoginSilent) { |
||
123 | $ARCurrent->arLoginSilent = true; |
||
124 | $store->call("user.session.timeout.html", |
||
125 | $arCallArgs, |
||
126 | $store->get($path) ); |
||
127 | } |
||
128 | |||
129 | } |
||
130 | } |
||
131 | |||
132 | View Code Duplication | function ldAccessDenied($path, $message, $args = null, $function = null) { |
|
0 ignored issues
–
show
The function
ldAccessDenied() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L83-88) is considered.
This check looks for functions that have already been defined in other files. Some Codebases, like WordPress, make a practice of defining functions multiple times. This
may lead to problems with the detection of function parameters and types. If you really
need to do this, you can mark the duplicate definition with the /**
* @ignore
*/
function getUser() {
}
function getUser($id, $realm) {
}
See also the PhpDoc documentation for @ignore. ![]() This function seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
133 | global $ARCurrent, $store; |
||
134 | /* |
||
135 | since there is no 'peek' function, we need to pop and push |
||
136 | the arCallArgs variable. |
||
137 | */ |
||
138 | |||
139 | if( isset( $args ) ) { |
||
140 | $arCallArgs = $args; |
||
141 | } else { |
||
142 | $arCallArgs = @array_pop($ARCurrent->arCallStack); |
||
143 | @array_push($ARCurrent->arCallStack, $arCallArgs); |
||
144 | } |
||
145 | |||
146 | $eventData = new baseObject(); |
||
147 | $eventData->arCallPath = $path; |
||
0 ignored issues
–
show
The property
arCallPath does not seem to exist in baseObject .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
148 | $eventData->arCallFunction = ldGetCurrentTemplate( $function ); |
||
0 ignored issues
–
show
The property
arCallFunction does not seem to exist in baseObject .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
149 | $eventData->arCallArgs = $arCallArgs; |
||
0 ignored issues
–
show
The property
arCallArgs does not seem to exist in baseObject .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
150 | $eventData->arLoginMessage = $message; |
||
0 ignored issues
–
show
The property
arLoginMessage does not seem to exist in baseObject .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
151 | $eventData->arReason = 'access denied'; |
||
0 ignored issues
–
show
The property
arReason does not seem to exist in baseObject .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
152 | |||
153 | $eventData = ar_events::fire( 'onaccessdenied', $eventData ); |
||
154 | |||
155 | if ( $eventData ) { |
||
156 | |||
157 | $arCallArgs = $eventData->arCallArgs; |
||
158 | $arCallArgs["arLoginMessage"] = $eventData->message; |
||
159 | |||
160 | if (!$ARCurrent->arLoginSilent) { |
||
161 | $ARCurrent->arLoginSilent = true; |
||
162 | $store->call("user.login.html", |
||
163 | $arCallArgs, |
||
164 | $store->get($path) ); |
||
165 | } |
||
166 | } |
||
167 | } |
||
168 | |||
169 | View Code Duplication | function ldAccessPasswordExpired($path, $message, $args=null, $function = null) { |
|
0 ignored issues
–
show
This function seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
170 | global $ARCurrent, $store; |
||
171 | /* |
||
172 | since there is no 'peek' function, we need to pop and push |
||
173 | the arCallArgs variable. |
||
174 | */ |
||
175 | |||
176 | if( isset( $args ) ) { |
||
177 | $arCallArgs = $args; |
||
178 | } else { |
||
179 | $arCallArgs = @array_pop($ARCurrent->arCallStack); |
||
180 | @array_push($ARCurrent->arCallStack, $arCallArgs); |
||
181 | } |
||
182 | |||
183 | $eventData = new baseObject(); |
||
184 | $eventData->arCallPath = $path; |
||
0 ignored issues
–
show
The property
arCallPath does not seem to exist in baseObject .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
185 | $eventData->arCallFunction = ldGetCurrentTemplate( $function ); |
||
0 ignored issues
–
show
The property
arCallFunction does not seem to exist in baseObject .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
186 | $eventData->arLoginMessage = $message; |
||
0 ignored issues
–
show
The property
arLoginMessage does not seem to exist in baseObject .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
187 | $eventData->arReason = 'password expired'; |
||
0 ignored issues
–
show
The property
arReason does not seem to exist in baseObject .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
188 | $eventData->arCallArgs = $arCallArgs; |
||
0 ignored issues
–
show
The property
arCallArgs does not seem to exist in baseObject .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
189 | $eventData = ar_events::fire( 'onaccessdenied', $eventData ); |
||
190 | if ( $eventData ) { |
||
191 | |||
192 | $arCallArgs = $eventData->arCallArgs; |
||
193 | $arCallArgs["arLoginMessage"] = $eventData->arLoginMessage; |
||
194 | |||
195 | if (!$ARCurrent->arLoginSilent) { |
||
196 | $ARCurrent->arLoginSilent = true; |
||
197 | $store->call("user.password.expired.html", |
||
198 | $arCallArgs, |
||
199 | $store->get($path) ); |
||
200 | } |
||
201 | } |
||
202 | |||
203 | } |
||
204 | |||
205 | View Code Duplication | function ldGenerateSessionKeyCheck() { |
|
0 ignored issues
–
show
This function seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
206 | global $ARCurrent; |
||
207 | $session_key = $ARCurrent->session->get('ARSessionKey', true); |
||
208 | $ARUserDir = $ARCurrent->session->get('ARUserDir', true); |
||
209 | $login = $ARCurrent->session->get('ARLogin'); |
||
210 | return "{".md5($login.$ARUserDir.$session_key)."}"; |
||
211 | } |
||
212 | |||
213 | function ldGetCredentials() { |
||
0 ignored issues
–
show
The function
ldGetCredentials() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L124-125) is considered.
This check looks for functions that have already been defined in other files. Some Codebases, like WordPress, make a practice of defining functions multiple times. This
may lead to problems with the detection of function parameters and types. If you really
need to do this, you can mark the duplicate definition with the /**
* @ignore
*/
function getUser() {
}
function getUser($id, $realm) {
}
See also the PhpDoc documentation for @ignore. ![]() ldGetCredentials uses the super-global variable $_COOKIE which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: // Bad
class Router
{
public function generate($path)
{
return $_SERVER['HOST'].$path;
}
}
// Better
class Router
{
private $host;
public function __construct($host)
{
$this->host = $host;
}
public function generate($path)
{
return $this->host.$path;
}
}
class Controller
{
public function myAction(Request $request)
{
// Instead of
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
// Better (assuming you use the Symfony2 request)
$page = $request->query->get('page', 1);
}
}
![]() |
|||
214 | debug("ldGetCredentials()","object"); |
||
215 | $ARSessionCookie = $_COOKIE["ARSessionCookie"]; |
||
216 | return $ARSessionCookie; |
||
217 | } |
||
218 | |||
219 | View Code Duplication | function ldCheckCredentials($login) { |
|
0 ignored issues
–
show
The function
ldCheckCredentials() has been defined more than once; this definition is ignored, only the first definition in lib/includes/loader.cmd.php (L130-131) is considered.
This check looks for functions that have already been defined in other files. Some Codebases, like WordPress, make a practice of defining functions multiple times. This
may lead to problems with the detection of function parameters and types. If you really
need to do this, you can mark the duplicate definition with the /**
* @ignore
*/
function getUser() {
}
function getUser($id, $realm) {
}
See also the PhpDoc documentation for @ignore. ![]() This function seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() ldCheckCredentials uses the super-global variable $_GET which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: // Bad
class Router
{
public function generate($path)
{
return $_SERVER['HOST'].$path;
}
}
// Better
class Router
{
private $host;
public function __construct($host)
{
$this->host = $host;
}
public function generate($path)
{
return $this->host.$path;
}
}
class Controller
{
public function myAction(Request $request)
{
// Instead of
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
// Better (assuming you use the Symfony2 request)
$page = $request->query->get('page', 1);
}
}
![]() ldCheckCredentials uses the super-global variable $_POST which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: // Bad
class Router
{
public function generate($path)
{
return $_SERVER['HOST'].$path;
}
}
// Better
class Router
{
private $host;
public function __construct($host)
{
$this->host = $host;
}
public function generate($path)
{
return $this->host.$path;
}
}
class Controller
{
public function myAction(Request $request)
{
// Instead of
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
// Better (assuming you use the Symfony2 request)
$page = $request->query->get('page', 1);
}
}
![]() |
|||
220 | global $ARCurrent, $AR; |
||
221 | debug("ldCheckCredentials($login)","object"); |
||
222 | $result=false; |
||
223 | $cookie=ldGetCredentials(); |
||
224 | $data = ldDecodeCookie($cookie[$ARCurrent->session->id]); |
||
225 | if ($login === $data['login'] |
||
226 | && ($saved=$data['check'])) { |
||
227 | $check=ldGenerateSessionKeyCheck(); |
||
228 | if ($check === $saved && !$ARCurrent->session->get('ARSessionTimedout', 1)) { |
||
229 | $result=true; |
||
230 | } else { |
||
231 | debug("login check failed","all"); |
||
232 | } |
||
233 | } else { |
||
234 | $ARSessionKeyCheck = $_GET['ARSessionKeyCheck']; |
||
235 | if (!$ARSessionKeyCheck) { |
||
236 | $ARSessionKeyCheck = $_POST['ARSessionKeyCheck']; |
||
237 | } |
||
238 | if ($ARSessionKeyCheck) { |
||
239 | debug("ldCheckCredentials: trying ARSessionKeyCheck ($ARSessionKeyCheck)"); |
||
240 | if ($ARSessionKeyCheck == ldGenerateSessionKeyCheck()) { |
||
241 | $result = true; |
||
242 | } |
||
243 | } else { |
||
244 | debug("wrong login or corrupted cookie","all"); |
||
245 | } |
||
246 | } |
||
247 | return $result; |
||
248 | } |
||
249 | |||
250 | View Code Duplication | function ldDecodeCookie($cookie) { |
|
0 ignored issues
–
show
This function seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
251 | global $AR; |
||
252 | $data = json_decode($cookie,true); |
||
253 | if(is_null($data)){ |
||
254 | if(isset($AR->sessionCryptoKey) && function_exists('mcrypt_encrypt') ) { |
||
255 | $key = base64_decode($AR->sessionCryptoKey); |
||
256 | $crypto = new ar_crypt($key,MCRYPT_RIJNDAEL_256,1); |
||
257 | $data = json_decode($crypto->decrypt($cookie),true); |
||
258 | } |
||
259 | } |
||
260 | |||
261 | return $data; |
||
262 | } |
||
263 | |||
264 | View Code Duplication | function ldEncodeCookie($cookie) { |
|
0 ignored issues
–
show
This function seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
265 | global $AR; |
||
266 | $data = json_encode($cookie); |
||
267 | if(isset($AR->sessionCryptoKey) && function_exists('mcrypt_encrypt') ) { |
||
268 | $key = base64_decode($AR->sessionCryptoKey); |
||
269 | $crypto = new ar_crypt($key,MCRYPT_RIJNDAEL_256,1); |
||
270 | $encdata = $crypto->crypt($data); |
||
271 | if($encdata !== false) { |
||
272 | $data = $encdata; |
||
273 | } |
||
274 | } |
||
275 | return $data; |
||
276 | } |
||
277 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: