Issues (212)

Security Analysis    12 potential vulnerabilities

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 (2)
Response Splitting can be used to send arbitrary responses.
  File Manipulation (5)
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 (1)
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 (2)
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.
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.

web/admin/overview_certificates.php (1 issue)

1
<?php
2
/*
3
 * *****************************************************************************
4
 * Contributions to this work were made on behalf of the GÉANT project, a 
5
 * project that has received funding from the European Union’s Framework 
6
 * Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus),
7
 * Horizon 2020 research and innovation programme under Grant Agreements No. 
8
 * 691567 (GN4-1) and No. 731122 (GN4-2).
9
 * On behalf of the aforementioned projects, GEANT Association is the sole owner
10
 * of the copyright in all material which was developed by a member of the GÉANT
11
 * project. GÉANT Vereniging (Association) is registered with the Chamber of 
12
 * Commerce in Amsterdam with registration number 40535155 and operates in the 
13
 * UK as a branch of GÉANT Vereniging.
14
 * 
15
 * Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. 
16
 * UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK
17
 *
18
 * License: see the web/copyright.inc.php file in the file structure or
19
 *          <base_url>/copyright.php after deploying the software
20
 */
21
22
/**
23
 * This page edits a federation.
24
 * 
25
 * @author Stefan Winter <[email protected]>
26
 */
27
?>
28
<?php
29
require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
30
31
$auth = new \web\lib\admin\Authentication();
32
$deco = new \web\lib\admin\PageDecoration();
33
$validator = new \web\lib\common\InputValidation();
34
$uiElements = new web\lib\admin\UIElements();
35
$cat = new core\CAT();
36
37
$auth->authenticate();
38
$eduroamDb = new \core\ExternalEduroamDBData();
39
40
/// product name (eduroam CAT), then term used for "federation", then actual name of federation.
41
echo $deco->defaultPagePrelude(sprintf(_("%s: RADIUS/TLS certificate management for %s"), \config\Master::APPEARANCE['productname'], $uiElements->nomenclatureFed));
42
$langObject = new \core\common\Language();
43
$fedId = $_GET['fed_id'];
44
?>
45
<script src="js/XHR.js" type="text/javascript"></script>
46
<script src="js/option_expand.js" type="text/javascript"></script>
47
<script type="text/javascript" src="../external/jquery/jquery.js"></script> 
48
<script type="text/javascript" src="../external/jquery/jquery-migrate.js"></script> 
49
</head>
50
<body>
51
52
    <?php echo $deco->productheader("FEDERATION"); ?>
53
54
    <h1>
55
        <?php
56
        /// nomenclature for federation, then actual federation name
57
        printf(_("RADIUS/TLS certificate management for %s"), $uiElements->nomenclatureFed);
58
        ?>
59
    </h1>
60
    <?php
61
    $user = new \core\User($_SESSION['user']);
62
    $mgmt = new \core\UserManagement();
63
    $isFedAdmin = $user->isFederationAdmin();
64
65
// if not, send the user away
66
    if (!$isFedAdmin) {
67
        echo _("You do not have the necessary privileges to request server certificates.");
68
        exit(1);
69
    }
70
// okay... we are indeed entitled to "do stuff"
71
    $feds = $user->getAttributes("user:fedadmin");
72
    foreach ($feds as $oneFed) {
73
        if ($oneFed['value'] != $fedId) {
74
            continue;
75
        }
76
        $theFed = new \core\Federation($oneFed['value']);
77
        printf("<h2>" . _("Certificate Information for %s %s")."</h2>", $uiElements->nomenclatureFed, $theFed->name);
78
        foreach ($theFed->listTlsCertificates() as $oneCert) {
79
            if ($oneCert['STATUS'] == "REQUESTED") {
80
                $theFed->updateCertificateStatus($oneCert['REQSERIAL']);
81
            }
82
        }
83
        echo "<table>";
84
        echo "<tr><th>"._("Request Serial")."</th><th>"._("Distinguished Name")."</th><th>Status</th><th>"._("Expiry")."</th><th>"._("Download")."</th></tr>";
85
        foreach ($theFed->listTlsCertificates() as $oneCert) { // fetch list a second time, in case we got a cert
86
            $status = $oneCert['STATUS'];
87
            echo "<tr>";
88
            echo "<td>" . $oneCert['REQSERIAL'] . "</td><td>" . $oneCert['DN'] . "</td><td>" . $status . "</td><td>" . $oneCert['EXPIRY'] . "</td>";
89
            if ($status == "ISSUED") {
90
                ?>
91
            <td>
92
                <form action='inc/showCert.inc.php' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8' method="POST">
93
                    <input type="hidden" name="certdata" value="<?php echo $oneCert['CERT'];?>"/>
94
                <button type="submit"><?php echo _("Display");?></button>
95
                </form>
96
            <td>
97
                <?php
98
            }
99
            echo "</tr>";
100
        }
101
        echo "</table>";
102
        
103
        if (count($eduroamDb->listExternalTlsServersFederation($theFed->tld)) > 0) {
104
            ?>
105
            <form action="action_req_certificate.php" method="POST">
106
                <input type="hidden" name='fed_id' value='<?php echo $fedId; ?>'/>
0 ignored issues
show
Security Cross-Site Scripting introduced by
$fedId can contain request data and is used in html attribute with double-quotes context(s) leading to a potential security vulnerability.

1 path for user data to reach this point

  1. Read from $_GET, and $_GET['fed_id'] is assigned to $fedId
    in web/admin/overview_certificates.php on line 43

Preventing Cross-Site-Scripting Attacks

Cross-Site-Scripting allows an attacker to inject malicious code into your website - in particular Javascript code, and have that code executed with the privileges of a visiting user. This can be used to obtain data, or perform actions on behalf of that visiting user.

In order to prevent this, make sure to escape all user-provided data:

// for HTML
$sanitized = htmlentities($tainted, ENT_QUOTES);

// for URLs
$sanitized = urlencode($tainted);

General Strategies to prevent injection

In general, it is advisable to prevent any user-data to reach this point. This can be done by white-listing certain values:

if ( ! in_array($value, array('this-is-allowed', 'and-this-too'), true)) {
    throw new \InvalidArgumentException('This input is not allowed.');
}

For numeric data, we recommend to explicitly cast the data:

$sanitized = (integer) $tainted;
Loading history...
107
                <button type="submit" name="newreq" id="newreq" value="<?php echo \web\lib\common\FormElements::BUTTON_CONTINUE ?>"><?php echo _("Request new Certificate"); ?></button>
108
            </form>
109
            <?php
110
        } else {
111
            ?>
112
            <span style="color: red"><?php echo sprintf(_("You can not request certificates because there is no server information for %s in the eduroam DB."), $theFed->tld); ?></span>
113
            <?php
114
        }
115
    }
116
    echo $deco->footer();
117