Issues (51)

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.

util/idpquery.php (1 issue)

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
set_include_path(
4
    '/var/www/html' . PATH_SEPARATOR .
5
    '/var/www/html/vendor/pear/pear-core-minimal/src' . PATH_SEPARATOR .
6
    '/var/www/html/vendor/pear/pear_exception' . PATH_SEPARATOR .
7
    '/var/www/html/vendor/pear/log' . PATH_SEPARATOR .
8
    '/var/www/html/vendor/pear/db' . PATH_SEPARATOR .
9
    '/var/www/html/vendor/pear/net_ldap2' . PATH_SEPARATOR .
10
    '/var/www/html/vendor/cilogon/service-lib/src/Service' . PATH_SEPARATOR .
11
    '.'
12
);
13
14
require_once 'config.php';
15
include_once 'config.secrets.php';
16
require_once 'DBService.php';
17
require_once 'Util.php';
18
require_once 'IdpList.php';
19
20
use CILogon\Service\IdpList;
21
22
if ($argc >= 2) {
23
    $regbyincommon = null;
24
    $incommonrands = null;
25
    $refedsrands = null;
26
    $sirtfi = null;
27
    $rands = null;
28
    $bronze = null;
29
    $silver = null;
30
31
    // Scan command line for attributes to match
32
    for ($v = 1; $v < $argc; $v++) {
33
        $param = strtolower($argv[$v]);
34
        if (preg_match('/^registeredbyincommon=?([01]?)$/', $param, $matches)) {
35
            if ((isset($matches[1])) && ($matches[1] == '0')) {
36
                $regbyincommon = 0;
37
            } else {
38
                $regbyincommon = 1;
39
            }
40
        } elseif (preg_match('/^incommonrands=?([01]?)$/', $param, $matches)) {
41
            if ((isset($matches[1])) && ($matches[1] == '0')) {
42
                $incommonrands = 0;
43
            } else {
44
                $incommonrands = 1;
45
            }
46
        } elseif (preg_match('/^refedsrands=?([01]?)$/', $param, $matches)) {
47
            if ((isset($matches[1])) && ($matches[1] == '0')) {
48
                $refedsrands = 0;
49
            } else {
50
                $refedsrands = 1;
51
            }
52
        } elseif (preg_match('/^sirtfi=?([01]?)$/', $param, $matches)) {
53
            if ((isset($matches[1])) && ($matches[1] == '0')) {
54
                $sirtfi = 0;
55
            } else {
56
                $sirtfi = 1;
57
            }
58
        } elseif (preg_match('/^rands=?([01]?)$/', $param, $matches)) {
59
            if ((isset($matches[1])) && ($matches[1] == '0')) {
60
                $rands = 0;
61
            } else {
62
                $rands = 1;
63
            }
64
        } elseif (preg_match('/^bronze=?([01]?)$/', $param, $matches)) {
65
            if ((isset($matches[1])) && ($matches[1] == '0')) {
66
                $bronze = 0;
67
            } else {
68
                $bronze = 1;
69
            }
70
        } elseif (preg_match('/^silver=?([01]?)$/', $param, $matches)) {
71
            if ((isset($matches[1])) && ($matches[1] == '0')) {
72
                $silver = 0;
73
            } else {
74
                $silver = 1;
75
            }
76
        } else {
77
            echo "ERROR: Unknown query attribute '$param'.\n";
78
            exit;
79
        }
80
    }
81
82
    $idplist = new IdpList();
83
    $allidps = $idplist->getEntityIDs();
84
    $idps = array();
85
86
    // Loop through all IdPs and try to match command line parameters
87
    foreach ($allidps as $idp) {
88
        if (!is_null($regbyincommon)) {
89
            $param = $idplist->isRegisteredByInCommon($idp);
90
            if ($regbyincommon xor $param) {
91
                continue;
92
            }
93
        }
94
        if (!is_null($incommonrands)) {
95
            $param = $idplist->isInCommonRandS($idp);
96
            if ($incommonrands xor $param) {
97
                continue;
98
            }
99
        }
100
        if (!is_null($refedsrands)) {
101
            $param = $idplist->isREFEDSRandS($idp);
102
            if ($refedsrands xor $param) {
103
                continue;
104
            }
105
        }
106
        if (!is_null($sirtfi)) {
107
            $param = $idplist->isSIRTFI($idp);
108
            if ($sirtfi xor $param) {
109
                continue;
110
            }
111
        }
112
        if (!is_null($rands)) {
113
            $param = $idplist->isRandS($idp);
114
            if ($rands xor $param) {
115
                continue;
116
            }
117
        }
118
        if (!is_null($bronze)) {
119
            $param = $idplist->isBronze($idp);
120
            if ($bronze xor $param) {
121
                continue;
122
            }
123
        }
124
        if (!is_null($silver)) {
125
            $param = $idplist->isSilver($idp);
126
            if ($silver xor $param) {
127
                continue;
128
            }
129
        }
130
        // If we made it this far, add the idp to the list of matched idps.
131
        $idps[] = $idp;
132
    }
133
134
    foreach ($idps as $idp) {
135
        echo $idp . "\t" . $idplist->getOrganizationName($idp) . "\n";
136
    }
137
    echo count($idps) . " IdPs found matching these conditions.\n";
138
} else {
139
    printUsage();
140
}
141
142
function printUsage()
0 ignored issues
show
The function printUsage() has been defined more than once; this definition is ignored, only the first definition in util/convertidplist.php (L54-63) 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 annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
143
{
144
    echo "Usage: php idpquery.php <RegisteredByInCommon=0|1> <InCommonRandS=0|1>\n";
145
    echo "                        <REFEDSRandS=0|1> <SIRTFI=0|1> <RandS=0|1>\n";
146
    echo "                        <Bronze=0|1> <Silver=0|1>\n\n";
147
    echo "This script allows you to query the idplist.xml file for IdPs with attributes\n";
148
    echo "that satisfy a certain set of conditions. The conditions you specify can be\n";
149
    echo "either 'must have' (=1) or 'must not have' (=0). These are joined together\n";
150
    echo "with a logical 'AND'. For example, to get a list of all eduGAIN IdPs that\n";
151
    echo "are SIRTFI but not REFEDSRandS:\n";
152
    echo "    php idpquery.php RegisteredByInCommon=0 SIRTFI=1 REFEDSRandS=0\n";
153
    echo "The attributes are case-insensitive. If you neglect to specify =0 or =1,\n";
154
    echo "=1 is assumed (i.e., 'RandS' is equivalent to 'RandS=1').\n";
155
}
156