PHP fixes more vulnerabilities

Content:

Original link: PHP Fixes 7 Critical Flaws, Including Bugs That Could Allow Remote Code Execution / TheHackerNews.

One of them is almost funny. file_get_contents silently fall back from HTTPS to HTTP if the s in the URL is not lowercase.

Demo:

$ type another.php
<?php

echo file_get_contents("http://arnepc5.vajhoej.dk/reveal.aspx") . "\n";
echo file_get_contents("https://arnepc5.vajhoej.dk/reveal.aspx") . "\n";
echo file_get_contents("HTTPS://arnepc5.vajhoej.dk/reveal.aspx") . "\n";
echo file_get_contents("httpS://arnepc5.vajhoej.dk/reveal.aspx") . "\n";

?>
$ php another.php
Port = 80
Port = 443
Port = 80
Port = 80

reveal.aspx contains:

Port = <%= Request.Url.Port %>

C code before fix:

use_ssl = resource->scheme && (ZSTR_LEN(resource->scheme) > 4) && ZSTR_VAL(resource->scheme)[4] == 's';

After:

use_ssl = zend_string_equals_literal_ci(resource->scheme, "https");

Comments: