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/edit_federation.php (1 issue)

Severity
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
36
$auth->authenticate();
37
38
$fedPost = $_POST['fed_id'];
39
40
$wizard = new \web\lib\admin\Wizard(false);
41
$wizard->setMessages();
42
43
[$my_fed, $editMode] = $validator->existingFederationInt($fedPost, $_SESSION['user']);
44
$fed_options = $my_fed->getAttributes();
45
$availableFedOptions = \web\lib\admin\OptionDisplay::enumerateOptionsToDisplay("fed", $my_fed->tld);
46
$wizard->setOptionsHelp($availableFedOptions);
47
$wizard->setMessages();
48
49
50
51
/// product name (eduroam CAT), then term used for "federation", then actual name of federation.
52
echo $deco->defaultPagePrelude(sprintf(_("%s: Editing %s '%s'"), \config\Master::APPEARANCE['productname'], $uiElements->nomenclatureFed, $my_fed->name));
53
?>
54
<script src="js/XHR.js" type="text/javascript"></script>
55
<script src="js/option_expand.js" type="text/javascript"></script>
56
<script type="text/javascript" src="../external/jquery/jquery-ui.js"></script> 
57
<link rel="stylesheet" type="text/css" href="../external/jquery/jquery-ui.css" />
58
<script type="text/javascript" src="js/wizard.js"></script> 
59
<link rel='stylesheet' type='text/css' href='css/wizard.css.php' />
60
<?php
61
if ($editMode == 'readonly') {
62
    print('<style>'
63
            . 'button.newoption {visibility: hidden}'
64
            . 'input {pointer-events: none} '
65
            . '.ui-sortable-handle {pointer-events: none}'
66
            . '</style>');
67
}
68
?>
69
</head>
70
<body>
71
72
    <?php echo $deco->productheader("FEDERATION"); ?>
73
    <div id="wizard_help_window"><img id="wizard_menu_close" src="../resources/images/icons/button_cancel.png" ALT="Close"/><div></div></div>
74
    <h1>
75
        <?php
76
        /// nomenclature for federation, then actual federation name
77
        printf(_("Editing %s information for '%s'"), $uiElements->nomenclatureFed, $my_fed->name);
78
        ?>
79
    </h1>
80
    <div class='infobox'>
81
        <h2><?php $tablecaption = sprintf(_("%s Properties"),$uiElements->nomenclatureFed); echo $tablecaption?></h2>
82
        <table>
83
            <caption><?php echo $tablecaption;?></caption>
84
            <tr>
85
                <th class="wai-invisible" scope="col"><?php echo _("Property Type");?></th>
86
                <th class="wai-invisible" scope="col"><?php echo _("Language if applicable");?></th>
87
                <th class="wai-invisible" scope="col"><?php echo _("Property Value");?></th>
88
            </tr>
89
            <tr>
90
                <td><?php echo _("Country:"); ?></td>
91
                <td></td>
92
                <td><strong><?php echo $my_fed->name; ?></strong></td>
93
            </tr>
94
            <?php echo $uiElements->infoblock($fed_options, "fed", "FED"); ?>
95
        </table>
96
    </div>
97
    <?php
98
    echo "<form enctype='multipart/form-data' action='edit_federation_result.php?fed_id=$my_fed->tld" . "' method='post' accept-charset='UTF-8'>
99
              <input type='hidden' name='MAX_FILE_SIZE' value='" . \config\Master::MAX_UPLOAD_SIZE . "'>";
100
    ?>
101
    <fieldset class="option_container">
102
        <legend><strong><?php echo sprintf(_("%s Properties"),$uiElements->nomenclatureFed); ?></strong></legend>
103
        <?php
104
        $options = [
105
            'level' => 'fed',
106
            'fed_id'=> $my_fed->tld
107
        ];
108
        echo $wizard->displayHelp("fed_general", $options);
109
        $optionDisplay = new \web\lib\admin\OptionDisplay($fed_options, \core\Options::LEVEL_FED);
110
        echo $optionDisplay->prefilledOptionTable("fed", $my_fed->tld);
111
        ?>
112
        <button type='button' class='newoption' onclick='getXML("fed", "<?php echo $my_fed->tld ?>")'><?php echo _("Add new option"); ?></button>
113
    </fieldset>
114
    <?php
115
    echo "<div>";
116
    if ($editMode === 'fullaccess') {
117
        echo "<button type='submit' name='submitbutton' value='" . web\lib\common\FormElements::BUTTON_SAVE . "'>" . _("Save data") . "</button>";
0 ignored issues
show
Security Cross-Site Scripting introduced by
'<button type='submit' n...ve data') . '</button>' can contain request data and is used in output context(s) leading to a potential security vulnerability.

3 paths for user data to reach this point

  1. Path: Read tainted data from array, and $protocol . '://' . $hostname . $port . $_SERVER['REQUEST_URI'] is returned in vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 823
  1. Read tainted data from array, and $protocol . '://' . $hostname . $port . $_SERVER['REQUEST_URI'] is returned
    in vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 823
  2. $httpUtils->getSelfURL() is assigned to $returnTo
    in vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Auth/Simple.php on line 137
  2. Path: Read tainted data from array, and Data is passed through substr(), and $this->getBaseURL() . $url_path . substr($_SERVER['REQUEST_URI'], $uri_pos + strlen($url_path)) is returned in vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 826
  1. Read tainted data from array, and Data is passed through substr(), and $this->getBaseURL() . $url_path . substr($_SERVER['REQUEST_URI'], $uri_pos + strlen($url_path)) is returned
    in vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 826
  2. $httpUtils->getSelfURL() is assigned to $returnTo
    in vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Auth/Simple.php on line 137
  3. Path: Read tainted data from array, and $_SERVER['HTTP_HOST'] is assigned to $current in vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 113
  1. Read tainted data from array, and $_SERVER['HTTP_HOST'] is assigned to $current
    in vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 113
  2. $current is returned
    in vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 131
  3. $this->getServerHost() is assigned to $hostname
    in vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 820
  4. $protocol . '://' . $hostname . $port . $_SERVER['REQUEST_URI'] is returned
    in vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php on line 823
  5. $httpUtils->getSelfURL() is assigned to $returnTo
    in vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Auth/Simple.php on line 137

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...
118
        $discardLabel = _("Discard changes");
119
    } else {
120
        $discardLabel = _("Return");
121
    }
122
    echo "<button type='button' class='delete' name='abortbutton' value='abort' onclick='javascript:window.location = \"overview_federation.php?fed_id=$fedPost\"'>" . $discardLabel . "</button></div></form>";
123
    echo $deco->footer();
124