Bug 1332872 (CVE-2016-4540, CVE-2016-4541) - CVE-2016-4540 CVE-2016-4541 php: OOB read in grapheme_stripos and grapheme_strpos when negative offset is used
Summary: CVE-2016-4540 CVE-2016-4541 php: OOB read in grapheme_stripos and grapheme_st...
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2016-4540, CVE-2016-4541
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1332882
Blocks: 1332879
TreeView+ depends on / blocked
 
Reported: 2016-05-04 09:11 UTC by Adam Mariš
Modified: 2019-11-14 07:56 UTC (History)
14 users (show)

Fixed In Version: php 5.5.35, php 5.6.21, php 7.0.6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-13 08:58:05 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2750 0 normal SHIPPED_LIVE Moderate: rh-php56 security, bug fix, and enhancement update 2016-11-15 16:40:02 UTC

Description Adam Mariš 2016-05-04 09:11:17 UTC
It was found that grapheme_stripos reads from arbitrary memory when negative value is passed as an offset and the first parameter is an array element.

Upstream bug:

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

Upstream patch:

https://git.php.net/?p=php-src.git;a=commit;h=16d0b9c836b793f9338c5a6296fba1b272bbae06

Comment 1 Adam Mariš 2016-05-04 09:25:57 UTC
Created php tracking bugs for this issue:

Affects: fedora-all [bug 1332882]

Comment 2 Andrej Nemec 2016-05-06 06:54:18 UTC
As per CVE assignment:

http://seclists.org/oss-sec/2016/q2/259

Use CVE-2016-4540 for the grapheme_stripos issue.

Use CVE-2016-4541 for the grapheme_strpos issue (separately discovered).

Comment 3 Fedora Update System 2016-05-07 11:47:31 UTC
php-5.6.21-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 4 Fedora Update System 2016-05-12 07:22:32 UTC
php-5.6.21-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 5 Tomas Hoger 2016-06-13 08:57:40 UTC
This is an out-of-bound read issue.  To trigger it, a negative attacker-supplied value must be passed as $offset to one of the affected functions (grapheme_strpos or grapheme_stripos).  Negative offset leads to buffer under-read (memory read before the start of the buffer).  How far the out-of-bounds read can reach is controlled by the length of the $haystack argument.  Interpreter crash or disclosure of the memory are possible impacts.

Note that neither of the affected functions is documented as allowing negative $offset.  Their regular counterparts - strpos and stripos functions - are explicitly documented as not allowing negative offsets.  As the use of untrusted values for $offset does not seem to be likely or commonly done, there's currently no plan to backport the fix to affected Red Hat products.

This issue is in the intl (Internationalization) extension.  In Red Hat products, this extension is packaged separately in php-intl sub-RPM.  Systems without that package installed can not be affected by this issue.

Comment 6 errata-xmlrpc 2016-11-15 11:51:57 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.2 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.3 EUS

Via RHSA-2016:2750 https://rhn.redhat.com/errata/RHSA-2016-2750.html


Note You need to log in before you can comment on or make changes to this bug.