Bug 1484837 (CVE-2017-12932)

Summary: CVE-2017-12932 php: Heap use after free in ext/standard/var_unserializer.re
Product: [Other] Security Response Reporter: Adam Mariš <amaris>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: fedora, hhorak, jorton, rcollet, webstack-team
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: php 7.0.23, php 7.1.9, php 7.2.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-08 03:22:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1484840, 1554333, 1628146    
Bug Blocks:    

Description Adam Mariš 2017-08-24 11:58:54 UTC
ext/standard/var_unserializer.re in PHP 7.0.x through 7.0.22 and 7.1.x
through 7.1.8 is prone to a heap use after free while unserializing
untrusted data, related to improper use of the hash API for key
deletion in a situation with an invalid array size. Exploitation of
this issue can have an unspecified impact on the integrity of PHP.

Upstream patch:

https://github.com/php/php-src/commit/1a23ebc1fff59bf480ca92963b36eba5c1b904c4

Upstream bug:

https://bugs.php.net/bug.php?id=74103

Comment 1 Adam Mariš 2017-08-24 12:00:05 UTC
Created php tracking bugs for this issue:

Affects: fedora-all [bug 1484840]

Comment 2 Adam Mariš 2017-08-24 12:04:21 UTC
This issue happens when untrusted input is deserialized. Doing so is documented as being unsafe:

http://php.net/manual/en/function.unserialize.php

"Do not pass untrusted user input to unserialize() regardless of the options value of allowed_classes. Unserialization can result in code being loaded and executed due to object instantiation and autoloading, and a malicious user may be able to exploit this. Use a safe, standard data interchange format such as JSON (via json_decode() and json_encode()) if you need to pass serialized data to the user."

"If you need to unserialize externally stored serialized data, consider to use hash_hmac() for data validation. Make sure data is not modified by anyone, but you."

Comment 4 errata-xmlrpc 2018-05-03 05:08:08 UTC
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 6
  Red Hat Software Collections for Red Hat Enterprise Linux 6.7 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7
  Red Hat Software Collections for Red Hat Enterprise Linux 7.3 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.4 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.5 EUS

Via RHSA-2018:1296 https://access.redhat.com/errata/RHSA-2018:1296

Comment 6 errata-xmlrpc 2019-08-19 08:40:57 UTC
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 7
  Red Hat Software Collections for Red Hat Enterprise Linux 7.4 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.5 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.6 EUS

Via RHSA-2019:2519 https://access.redhat.com/errata/RHSA-2019:2519