main/streams/xp_socket.c in PHP 7.x before 2017-03-07 misparses fsockopen calls, such as by interpreting fsockopen('127.0.0.1:80', 443) as if the address/port were 127.0.0.1:80:443, which is later truncated to 127.0.0.1:80. This behavior has a security risk if the explicitly provided port number (i.e., 443 in this example) is hardcoded into an application as a security policy, but the hostname argument (i.e., 127.0.0.1:80 in this example) is obtained from untrusted input. Upstream Commit: https://github.com/php/php-src/commit/bab0b99f376dac9170ac81382a5ed526938d595a
Created php tracking bugs for this issue: Affects: fedora-all [bug 1734757]
Statement: This issue affects the php version as shipped with Red Hat Enterprise Linux 5, 6, 7, 8 and it was rated as having a security impact of 'Moderate'. It also affects the versions rh-php71-php, rh-php70-php, rh-php72-php distributed with Red Hat Software Collection 3.
There's an issue with parse_ip_address_ex() used by PHP function fsockopen(). The fsockopen() function is used to open a new socket, two of its parameters are the hostname and port. When passing the host name in the format of "<hostname>:<port>", parse_ip_address_ex() function ignores the port function's parameter and tries to connect to the one informed in the hostname string. This would allow an attacker to force a connection to other port then the expected if the hostname parameter is controlled by the user or obtained from an untrusted source.