PHP 7.3.0 alpha 1 & 2 released
CompileError
exception.JSON_THROW_ON_ERROR
flag allows json_encode()
and json_decode()
to throw
JsonException
on error instead of just setting global error state to be retrieved by json_last_error()
.is_countable()
function. See https://wiki.php.net/rfc/is-countable21 Jun 2018: PHP 7.2.7 Released
25 Jun 2018: PHP 7.1.19 Released
09 Apr 2018: CVE-2018-9857
<script>alert('PHP July 2018')</script>
22 Dec 2016: CVE-2016-10033
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-10033
The mailSend function in the isMail transport in PHPMailer before 5.2.18 might allow remote attackers to pass extra parameters to the mail command and consequently execute arbitrary code via a \" (backslash double quote) in a crafted Sender property.
Vulnerability
setFrom: https://github.com/PHPMailer/PHPMailer/blob/v5.2.17/class.phpmailer.php#L1018
validateAddress: https://github.com/PHPMailer/PHPMailer/blob/v5.2.17/class.phpmailer.php#L1068
Validation does not cover use case where email address has quotation marks. This allows additional parameters
to be injected in the address in the form: "Attacker \" -Param2 -Param3"@test.com
mailSend: https://github.com/PHPMailer/PHPMailer/blob/v5.2.17/class.phpmailer.php#L1445
Demo
$params = sprintf('-f%s', $this->Sender);
$params:
-f"evil\" -oQ/tmp/ -X/var/www/html/asg1/demo/footer.php sender"@vulnerable.com
// This will cause sendmail to execute with (other options omitted for brevity):
Arg no. 0 = [/usr/sbin/sendmail] // binary
Arg no. 1 = [-fevil\] // set sender name
Arg no. 2 = [-oQ/tmp/] // set queue group
Arg no. 3 = [-X/var/www/html/cs4239-asg1-patch/footer.php] // path of log file
Arg no. 4 = [-sender"@vulnerable.com] // invalid option
Patch in PHPMailer 5.2.18
escapeshellarg
function applied on the sender email address in PHPMailer::mailSend()
Demo
$params = sprintf('-f%s', escapeshellarg($this->Sender));
$params: // note the single quotes
-f'"evil\" -oQ/tmp/ -X/var/www/html/cs4239-asg1-patch/footer.php sender"@vulnerable.com'
// This will cause sendmail to execute with (other options omitted for brevity):
Arg no. 0 = [/usr/sbin/sendmail]
Arg no. 1 = [-f"evil\" -oQ/tmp/ -X/var/www/html/cs4239-asg1-patch/footer.php sender"@vulnerable.com] // valid email local-part within quotes
Bypass
isShellSafe
method to prevent usage of single quotes to bypass v5.2.18 patch.