Issues (172)

Security Analysis    13 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 (3)
Response Splitting can be used to send arbitrary responses.
  File Manipulation (6)
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
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 (1)
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/diag/adminQuery.php (5 issues)

1
<?php
2
3
/*
4
 * *****************************************************************************
5
 * Contributions to this work were made on behalf of the GÉANT project, a 
6
 * project that has received funding from the European Union’s Framework 
7
 * Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus),
8
 * Horizon 2020 research and innovation programme under Grant Agreements No. 
9
 * 691567 (GN4-1) and No. 731122 (GN4-2).
10
 * On behalf of the aforementioned projects, GEANT Association is the sole owner
11
 * of the copyright in all material which was developed by a member of the GÉANT
12
 * project. GÉANT Vereniging (Association) is registered with the Chamber of 
13
 * Commerce in Amsterdam with registration number 40535155 and operates in the 
14
 * UK as a branch of GÉANT Vereniging.
15
 * 
16
 * Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. 
17
 * UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK
18
 *
19
 * License: see the web/copyright.inc.php file in the file structure or
20
 *          <base_url>/copyright.php after deploying the software
21
 */
22
require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
23
$languageInstance = new \core\common\Language();
24
$languageInstance->setTextDomain("diagnostics");
25
$loggerInstance = new \core\common\Logging();
26
// only enable this during development - it allows random junk to be logged 
27
// without any control!
28
// $loggerInstance->debug(4, $_REQUEST);
29
$o = new stdClass();
30
if (isset($_REQUEST['data'])) {    
31
    $o = json_decode($_REQUEST['data']);
32
}
33
$sp_problem = array(
34
    'technical' => _("I suspect a Technical Problem with the IdP"),
35
    'abuse-copyright' => _("A user from this IdP has allegedly infringed copyrights"),
36
    'abuse-network' => _("A user from this IdP has conducted malicious network operations (spam, DDoS, ...)")
37
);
38
$idp_problem = array(
39
    'technical' => _("User claims connectivity problems but has been authenticated successfully"),
40
    'abuse-copyright' => _("User claims that mandatory open port is not open")
41
);
42
$queryType = filter_input(INPUT_GET, 'type'); // no need to filter - exact values are tested later
43
$realmFromURL = htmlspecialchars(strip_tags(filter_input(INPUT_GET, 'realm')));
44
if (!$realmFromURL) {
45
    $realmFromURL = '';
46
}
47
$res = '';
48
$javascript = "<script>
49
    var mac = $('#mac');
50
    mac.on('keyup', formatMAC);
51
    var now = new Date();
52
    var datefrom = new Date();
53
    datefrom.setMonth(datefrom.getMonth() - 3);
54
    $('#timestamp').datetimepicker({
55
        timeFormat: 'HH:mm z',
56
        controlType: 'select',
57
        minDateTime: datefrom,
58
        maxDateTime: now
59
    });
60
</script>
61
    ";
62
if ($queryType == 'sp') {
63
    $select = "<div id='sp_abuse_problem'>
64
<select style='margin-left: 0px;' id='select_sp_problem'>";
65
    foreach ($sp_problem as $pname => $pdesc) {
66
        $select = $select . "<option value='$pname'>$pdesc</option>\n";
67
    }
68
    $select = $select . "</select></div>";
69
    $res = "
70
<input type='hidden' name='token' id='token' value=''>
71
<input type='hidden' name='tests_result' id='tests_result' value=''>
72
<table id='sp_questions'>
73
    <tr id='sp_problem_selector'>
74
        <td>" . _("Select your problem") . "</td>
75
        <td>$select</td>
76
    </tr>
77
    <tr>
78
        <td>" . _("What is the realm of the IdP in question?") . "</td>
79
        <td>
80
                <input type='text' name='admin_realm' id='admin_realm' value='$realmFromURL'>
81
                <button class='diag_button' id='realm_in_db_admin' style='display: none;' accesskey='R' type='button'>" .
82
                _("Check this realm") .
83
                "</button>
84
                <div id='tests_info_area'></div>
85
        </td>
86
    </tr>
87
    <tr id='outer_user_row' class='hidden_row'>
88
        <td>" . _("Do you prefer to use a specific outer identity for diagnostics test?") . "</td>
89
        <td>  <input type='text' name='outer_user' id='outer_user' value=''><span id='outer_user_realm'></span>
90
    </tr>
91
    <tr class='hidden_row'>
92
        <td>" . _("What is the authentication timestamp of the user session in question?") . "</td>
93
        <td><input type='text' id='timestamp' name='timestamp'>
94
            <div id='datepicker'></div>
95
        </td>
96
    </tr>
97
    <tr class='hidden_row'>
98
        <td>" . _("What is the MAC address of the user session in question?") . "</td>
99
        <td><input type='text' id='mac' name='mac'></td>
100
    </tr>
101
    <tr class='hidden_row'>
102
        <td>" . _("Additional comments") . "</td>
103
        <td><textarea id='freetext' name='freetext' cols='60' rows='5'></textarea></td>
104
    </tr>
105
    <tr class='hidden_row'>
106
        <td>" . _("Please specify an email address on which the IdP can contact you") . "</td>
107
        <td><input type='text' id='email' name='email'></td>
108
    </tr>
109
    <tr>
110
        <td id='external_db_info'></td>
111
        <td></td>
112
    </tr>
113
    <tr class='hidden_row' id='send_query_to_idp'>
114
        <td>" . _("Now you can send your query") . "</td>
115
        <td><button type='submit' class='diag_button' id='submit_idp_query' name='go'>" . _("Send") . "</button></td>
116
    </tr>
117
 </table>";
118
    $res = $res . $javascript;
119
}
120
if ($queryType == 'idp') {
121
    $select = "<div id='idp_reported_problem' style='display:;'>
122
<select style='margin-left:0px;' id='select_idp_problem'>";
123
    foreach ($idp_problem as $pname => $pdesc) {
124
        $select = $select . "<option value='$pname'>$pdesc</option>\n";
125
    }
126
    $select = $select . "</select></div>";
127
    $res = "
128
<table id='idp_questions'>
129
    <tr>
130
        <td>" . _("Select your problem") . "</td>
131
        <td>$select</td>
132
    </tr>
133
    <tr>
134
        <td>" . _("Identify the SP by one of following means") . "</td>
135
        <td></td>
136
    </tr>
137
    <tr id='by_opname'>
138
        <td>" . _("SP Operator-Name attribute") . "</td>
139
        <td><input type='text' id='opname' name='opname' value=''></td>
140
    </tr>
141
    <tr id='spmanually'>
142
        <td>" . _("Select the SP manually:") . "</td>
143
        <td>
144
            <div id='select_asp_country'><a href='' id='asp_countries_list'>
145
            <span id='opnameselect'>" . _("click to select country and organisation") . "</a></span>
146
            </div>
147
            <div id='select_asp_area'></div>
148
        </td>
149
    </tr>
150
    <tr id='asp_desc' style='display: none;'>
151
        <td>" . _("or") . ' ' . _("at least describe the SP location") . "</td>
152
        <td><input type='text' id='asp_location' name='asp_location' value=''></td>
153
    </tr>
154
    <tr>
155
        <td>" . _("What is the outer ID of the user session in question?") . "</td>
156
        <td><input type='text' id='outer_id' name='outer_id' value=''></td>
157
    </tr>
158
    <tr>
159
        <td>" . _("What is the authentication timestamp of the user session in question?") . "</td>
160
        <td>
161
            <input type='text' id='timestamp' name='timestamp'>
162
            <div id='datepicker'></div>
163
        </td>
164
    </tr>
165
    <tr>
166
        <td>" . _("What is the MAC address of the user session in question?") . "</td>
167
        <td><input type='text' id='mac' name='mac'></td>
168
    </tr>
169
    <tr>
170
        <td>" . _("Additional comments about the problem") . "</td>
171
        <td><textarea id='freetext' name='freetext' cols='60' rows='5'></textarea></td>
172
    </tr>
173
    <tr>
174
        <td>" . _("Do you have any contact details by which the user wishes to be contacted by the SP?") . "</td>
175
        <td><textarea id='c_details' name='c_details' cols='60' rows='5'></textarea></td>
176
    </tr>
177
    <tr>
178
        <td>" . _("Please specify an email address on which the SP can contact you") . "</td>
179
        <td><input type='text' id='email' name='email'></td>
180
    </tr>
181
    <tr class='hidden_row' id='send_query_to_sp'>
182
        <td>" . _("Now you can send your query") . "</td>
183
        <td><button type='submit' class='diag_button' id='submit_sp_query' name='go'>" . _("Send") . "</button></td>
184
    </tr>
185
</table>";
186
    $res = $res . $javascript;
187
}
188
if ($queryType == 'idp_send' || $queryType == 'sp_send') {
189
    include_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
190
    $cat = new \core\CAT();
191
    $returnArray = array();
192
    if (count((array) $o) > 0) {
193
        foreach ($o as $key => $value) {
194
            $value = trim($value);
195
            switch ($key) {
196
                case 'realm':
197
                    $pos = strpos($value, '@');
198
                    if ($pos !== FALSE ) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment if this fall-through is intended.
Loading history...
199
                        $value = substr($value, $pos+1);
200
                    }
201
                case 'email':
202
                    $returnArray[$key] = filter_var($value, FILTER_VALIDATE_EMAIL);
203
                    break;
204
                case 'mac':
205
                case 'freetext':
206
                case 'timestamp':
207
                case 'opname':
208
                case 'outerid':
209
                case 'cdetails':
210
                case 'token':
211
                    // all of the above have to be printable strings, so sanitise them all in one go
212
                    $returnArray[$key] = htmlspecialchars(strip_tags($value));
213
                    break;
214
                case 'tests_result':     
215
                    $returnArray[$key] = filter_var($value, FILTER_VALIDATE_INT);
216
                    break;
217
                case 'idpcontact':
218
                    if ($value == '') {
219
                        $returnArray[$key] = '[email protected]';
220
                    } else {
221
                        $returnArray[$key] = filter_var(base64_decode($value), FILTER_VALIDATE_EMAIL);
222
                    }
223
                    break;
224
                case 'reason':
225
                    if ($queryType == 'idp_send') {
226
                        $returnArray[$key] = $sp_problem[$value];
227
                    } else {
228
                        $returnArray[$key] = $idp_problem[$value];
229
                    }
230
                    break;
231
                default:
232
                    break;
233
            }
234
        }
235
    }
236
    if ($queryType == 'idp_send') {
237
        $mail = \core\common\OutsideComm::mailHandle();
238
        $emails = ['[email protected]'];
239
        //$emails = explode(',', $returnArray['idpcontact']);
240
        $mail->FromName = \config\Master::APPEARANCE['productname'] . " Notification System";
241
        foreach ($emails as $email) {
242
            $mail->addAddress($email);
243
        }
244
        $link = '';
245
        if (isset($_SERVER['HTTPS'])) {
246
            $link = 'https://';
247
        } else {
248
            $link = 'http://';
249
        }
250
        $link .= $_SERVER['SERVER_NAME'] . \core\CAT::getRootUrlPath() . '/diag/show_realmcheck.php?token=' . $returnArray['token'];
251
        $returnArray['testurl'] = $link;
252
        $mail->Subject = _('Suspected a technical problem with the IdP');
253
        $txt = _("We suspect a technical problem with the IdP handling the realm") . ' ' . 
254
                $returnArray['realm'] . ".\n";
255
        $txt .= _("The CAT diagnostic test was run for this realm during reporting.\n");
256
        $txt .= _("The overall result was ");
257
        if ($returnArray['tests_result'] == 0) {
258
            $txt .= _("success");
259
        } else {
260
            $txt .= _("failure");
261
        }
262
        $txt .= ".\n" . _("To see details go to ");
263
        $txt .= "$link\n\n";
264
        $txt .= _("The reported problem details are as follows") . "\n";
265
        $txt .= _("timestamp") . ": " . $returnArray['timestamp'] . "\n";
266
        $txt .= _("client MAC address") . ": " . $returnArray['mac'] . "\n";
267
        if ($returnArray['freetext']) {
268
            $txt .= _("additional comments") . ': ' . $returnArray['freetext'] . "\n";
269
        }
270
        $txt .= "\n" . _("You can contact the incident reporter at") . ' ' . $returnArray['email'];
271
        
272
        $mail->Body = $txt;
0 ignored issues
show
Security File Manipulation introduced by
$Body can contain request data and is used in file manipulation context(s) leading to a potential security vulnerability.

1 path for user data to reach this point

  1. Read from $_REQUEST, and Data is passed through json_decode(), and json_decode($_REQUEST['data']) is assigned to $o
    in web/diag/adminQuery.php on line 31
  2. $o is assigned to $value
    in web/diag/adminQuery.php on line 193
  3. Data is passed through trim(), and trim($value) is assigned to $value
    in web/diag/adminQuery.php on line 194
  4. Data is passed through strip_tags(), and Data is passed through htmlspecialchars(), and htmlspecialchars(strip_tags($value)) is assigned to $returnArray
    in web/diag/adminQuery.php on line 212
  5. $link is assigned to $returnArray
    in web/diag/adminQuery.php on line 251
  6. ``' ' . _('You can contact the incident reporter at') . ' ' . $returnArray['email']`` is assigned to $txt
    in web/diag/adminQuery.php on line 270

Used in path-write context

  1. $txt is assigned to property PHPMailer::$Body
    in web/diag/adminQuery.php on line 268
  2. Read from property PHPMailer::$Body
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3022
  3. Data is passed through encodeString()
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3022
  4. $this->encodeString($this->Body, $this->Encoding) is assigned to $body
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3022
  5. $body is returned
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3082
  6. $this->createBody() is assigned to property PHPMailer::$MIMEBody
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1611
  7. Read from property PHPMailer::$MIMEBody
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1676
  8. PHPMailer::sendmailSend() is called
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1676
  9. Enters via parameter $body
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1715
  10. fwrite() is called
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1792

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...
Security File Manipulation introduced by
$Body can contain request data and is used in file manipulation context(s) leading to a potential security vulnerability.

1 path for user data to reach this point

  1. Read from $_REQUEST, and Data is passed through json_decode(), and json_decode($_REQUEST['data']) is assigned to $o
    in web/diag/adminQuery.php on line 31
  2. $o is assigned to $value
    in web/diag/adminQuery.php on line 193
  3. Data is passed through trim(), and trim($value) is assigned to $value
    in web/diag/adminQuery.php on line 194
  4. Data is passed through strip_tags(), and Data is passed through htmlspecialchars(), and htmlspecialchars(strip_tags($value)) is assigned to $returnArray
    in web/diag/adminQuery.php on line 212
  5. $link is assigned to $returnArray
    in web/diag/adminQuery.php on line 251
  6. ``' ' . _('You can contact the incident reporter at') . ' ' . $returnArray['email']`` is assigned to $txt
    in web/diag/adminQuery.php on line 270

Used in path-write context

  1. $txt is assigned to property PHPMailer::$Body
    in web/diag/adminQuery.php on line 268
  2. Read from property PHPMailer::$Body
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3022
  3. Data is passed through encodeString()
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3022
  4. $this->encodeString($this->Body, $this->Encoding) is assigned to $body
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3022
  5. $body is returned
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3082
  6. $this->createBody() is assigned to property PHPMailer::$MIMEBody
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1611
  7. Read from property PHPMailer::$MIMEBody
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1678
  8. PHPMailer::smtpSend() is called
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1678
  9. Enters via parameter $body
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 2015
  10. SMTP::data() is called
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 2050
  11. Enters via parameter $msg_data
    in vendor/phpmailer/phpmailer/src/SMTP.php on line 716
  12. Data is passed through str_replace()
    in vendor/phpmailer/phpmailer/src/SMTP.php on line 732
  13. Data is passed through explode()
    in vendor/phpmailer/phpmailer/src/SMTP.php on line 732
  14. ``explode(' ', str_replace(array(' ', ' '), ' ', $msg_data))`` is assigned to $lines
    in vendor/phpmailer/phpmailer/src/SMTP.php on line 732
  15. $lines is assigned to $line
    in vendor/phpmailer/phpmailer/src/SMTP.php on line 745
  16. $line is assigned to $lines_out
    in vendor/phpmailer/phpmailer/src/SMTP.php on line 773
  17. $lines_out is assigned to $line_out
    in vendor/phpmailer/phpmailer/src/SMTP.php on line 776
  18. SMTP::client_send() is called
    in vendor/phpmailer/phpmailer/src/SMTP.php on line 782
  19. Enters via parameter $data
    in vendor/phpmailer/phpmailer/src/SMTP.php on line 1122
  20. fwrite() is called
    in vendor/phpmailer/phpmailer/src/SMTP.php on line 1135

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...
Security File Manipulation introduced by
$Body can contain request data and is used in file manipulation context(s) leading to a potential security vulnerability.

1 path for user data to reach this point

  1. Read from $_REQUEST, and Data is passed through json_decode(), and json_decode($_REQUEST['data']) is assigned to $o
    in web/diag/adminQuery.php on line 31
  2. $o is assigned to $value
    in web/diag/adminQuery.php on line 193
  3. Data is passed through trim(), and trim($value) is assigned to $value
    in web/diag/adminQuery.php on line 194
  4. Data is passed through strip_tags(), and Data is passed through htmlspecialchars(), and htmlspecialchars(strip_tags($value)) is assigned to $returnArray
    in web/diag/adminQuery.php on line 212
  5. $link is assigned to $returnArray
    in web/diag/adminQuery.php on line 251
  6. ``' ' . _('You can contact the incident reporter at') . ' ' . $returnArray['email']`` is assigned to $txt
    in web/diag/adminQuery.php on line 270

Used in path-write context

  1. $txt is assigned to property PHPMailer::$Body
    in web/diag/adminQuery.php on line 268
  2. Read from property PHPMailer::$Body
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3022
  3. Data is passed through encodeString()
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3022
  4. $this->encodeString($this->Body, $this->Encoding) is assigned to $body
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3022
  5. file_put_contents() is called
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3039

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...
Security Header Injection introduced by
$Body can contain request data and is used in request header context(s) leading to a potential security vulnerability.

1 path for user data to reach this point

  1. Read from $_REQUEST, and Data is passed through json_decode(), and json_decode($_REQUEST['data']) is assigned to $o
    in web/diag/adminQuery.php on line 31
  2. $o is assigned to $value
    in web/diag/adminQuery.php on line 193
  3. Data is passed through trim(), and trim($value) is assigned to $value
    in web/diag/adminQuery.php on line 194
  4. Data is passed through strip_tags(), and Data is passed through htmlspecialchars(), and htmlspecialchars(strip_tags($value)) is assigned to $returnArray
    in web/diag/adminQuery.php on line 212
  5. $link is assigned to $returnArray
    in web/diag/adminQuery.php on line 251
  6. ``' ' . _('You can contact the incident reporter at') . ' ' . $returnArray['email']`` is assigned to $txt
    in web/diag/adminQuery.php on line 270

Used in request-header context

  1. $txt is assigned to property PHPMailer::$Body
    in web/diag/adminQuery.php on line 268
  2. Read from property PHPMailer::$Body
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3022
  3. Data is passed through encodeString()
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3022
  4. $this->encodeString($this->Body, $this->Encoding) is assigned to $body
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3022
  5. $body is returned
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 3082
  6. $this->createBody() is assigned to property PHPMailer::$MIMEBody
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1611
  7. Read from property PHPMailer::$MIMEBody
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1645
  8. Data is passed through DKIM_Add()
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1642
  9. $this->DKIM_Add($this->MIMEHeader . $this->mailHeader, $this->encodeHeader($this->secureHeader($this->Subject)), $this->MIMEBody) is assigned to $header_dkim
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1642
  10. Data is passed through normalizeBreaks()
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1648
  11. static::stripTrailingWSP($this->MIMEHeader) . static::LE . static::normalizeBreaks($header_dkim) . static::LE is assigned to property PHPMailer::$MIMEHeader
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1647
  12. Read from property PHPMailer::$MIMEHeader
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1687
  13. PHPMailer::mailSend() is called
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1687
  14. Enters via parameter $header
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1902
  15. Data is passed through stripTrailingWSP()
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1904
  16. static::stripTrailingWSP($header) . static::LE . static::LE is assigned to $header
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1904
  17. PHPMailer::mailPassthru() is called
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 1945
  18. Enters via parameter $header
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 858
  19. mail() is called
    in vendor/phpmailer/phpmailer/src/PHPMailer.php on line 877

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...
273
        $sent = $mail->send();
274
        if ($sent === FALSE) {
275
            $returnArray['emailsent'] = 0;
276
            $loggerInstance->debug(1, 'Mailing  failed');
277
        } else {
278
            $returnArray['emailsent'] = 1;
279
        }
280
    }
281
    $returnArray['status'] = 1;
282
    $res = json_encode($returnArray);
283
}
284
echo $res;
285