Bug 1287636 (CVE-2015-8386) - CVE-2015-8386 pcre: Buffer overflow caused by lookbehind assertion (8.38/6)
Summary: CVE-2015-8386 pcre: Buffer overflow caused by lookbehind assertion (8.38/6)
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2015-8386
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: 1287639 1287640 1287641 1287642 1330455 1330456 1330508 1330509
Blocks: 1287727
TreeView+ depends on / blocked
 
Reported: 2015-12-02 13:17 UTC by Adam Mariš
Modified: 2021-09-09 11:44 UTC (History)
37 users (show)

Fixed In Version: pcre 8.38
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-15 13:40:07 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:1025 0 normal SHIPPED_LIVE Important: pcre security update 2016-05-11 17:07:01 UTC
Red Hat Product Errata RHSA-2016:1132 0 normal SHIPPED_LIVE Important: rh-mariadb100-mariadb security update 2016-05-26 12:35:06 UTC
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š 2015-12-02 13:17:16 UTC
It was discovered that PCRE before 8.38 mishandles the interaction of lookbehind assertions and mutually recursive subpatterns could provoke a buffer overflow, allowing remote attackers to cause a denial of service (buffer overflow) or possibly have unspecified other impact via a crafted regular expression.

Comment 1 Adam Mariš 2015-12-02 13:21:37 UTC
Created pcre tracking bugs for this issue:

Affects: fedora-all [bug 1287639]

Comment 2 Adam Mariš 2015-12-02 13:21:46 UTC
Created glib2 tracking bugs for this issue:

Affects: fedora-all [bug 1287641]

Comment 3 Adam Mariš 2015-12-02 13:21:55 UTC
Created mingw-pcre tracking bugs for this issue:

Affects: fedora-all [bug 1287640]
Affects: epel-7 [bug 1287642]

Comment 4 Adam Mariš 2015-12-02 15:23:27 UTC
Corresponds to item 6 in http://vcs.pcre.org/pcre/code/trunk/ChangeLog?view=markup

Comment 5 Petr Pisar 2015-12-02 15:52:18 UTC
Fixed in upstream with:

commit 9f2cf82ed9380bb4a726250833d6a0d295be8747
Author: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
Date:   Tue May 19 16:02:06 2015 +0000

    Fix buffer overflow for lookbehind within mutually recursive subroutines.
    
    
    git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1560 2f5784b3-3f2a-0410-8824-cb99058d5e15

Comment 6 Petr Pisar 2015-12-03 14:00:16 UTC
Reproducer is passing ".*?\h.+.\.+\R*?\xd(?i)(?=!(?=b`b`b`\`b\xa9b!)`\a`bbbbbbbbbbbbb`bbbbbbbbbbbb*R\x85bbbbbbb\C?{((?2)(?))((\H){8(?<=(?1){29}\xa8bbbb\x16\xd\xc6^($(?<! )(\xa9H4){4}h}1)B))\x15')" expression to pcretest under valgrind.

Comment 7 Fedora Update System 2016-01-04 19:54:11 UTC
pcre-8.38-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 8 Tomas Hoger 2016-02-17 12:18:18 UTC
(In reply to Petr Pisar from comment #5)
> Fixed in upstream with:
> 
> commit 9f2cf82ed9380bb4a726250833d6a0d295be8747
> Author: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
> Date:   Tue May 19 16:02:06 2015 +0000
> 
> Fix buffer overflow for lookbehind within mutually recursive subroutines.

Upstream SVN commit link is:

http://vcs.pcre.org/pcre?view=revision&revision=1560

Comment 9 Tomas Hoger 2016-02-17 16:33:56 UTC
The issue corrected in r1560 seems to date back to very old PCRE versions.  Version 3.9 (in Red Hat Enterprise Linux 3) was not affected, while version 4.5 (in Red Hat Enterprise Linux 4) already contains the bug.  I've not tried to pin point specific version.  Upstream SVN also only seems to have code as of version 6.0.

I could reduce the pattern noted in comment 6 down to:

  /(?=((?2))((x){(?<=(?1){29}\xaaXABCDE(x(?<!)(\xaaXA){4}A}B)C)))/

This pattern triggers a valgrind detected out of bounds read in PCRE versions 8.34 - 8.37.  Upstream r1379 seems to be what makes this issue detectable by valgrind, as that commits adds new opcodes and consequently changes which code paths are used when compiling the above pattern.

Another symptom of this bug is an error as this:

Failed: internal error: unknown opcode in find_fixedlength() at offset 62

This has limited out of bounds read impact.

Comment 16 errata-xmlrpc 2016-05-11 13:07:56 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

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

Comment 17 errata-xmlrpc 2016-05-26 08:42:06 UTC
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 7.1 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.2 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7
  Red Hat Software Collections for Red Hat Enterprise Linux 6.6 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 6
  Red Hat Software Collections for Red Hat Enterprise Linux 6.7 EUS

Via RHSA-2016:1132 https://access.redhat.com/errata/RHSA-2016:1132

Comment 18 errata-xmlrpc 2016-11-15 11:48:15 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.