Bug 1287636 - (CVE-2015-8386) CVE-2015-8386 pcre: Buffer overflow caused by lookbehind assertion (8.38/6)
CVE-2015-8386 pcre: Buffer overflow caused by lookbehind assertion (8.38/6)
Status: CLOSED ERRATA
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
low Severity low
: ---
: ---
Assigned To: Red Hat Product Security
impact=low,public=20151123,reported=2...
: Security
Depends On: 1287639 1287640 1287641 1287642 1330455 1330456 1330508 1330509
Blocks: 1287727
  Show dependency treegraph
 
Reported: 2015-12-02 08:17 EST by Adam Mariš
Modified: 2016-11-15 08:40 EST (History)
36 users (show)

See Also:
Fixed In Version: pcre 8.38
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-15 08:40:07 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Adam Mariš 2015-12-02 08:17:16 EST
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 08:21:37 EST
Created pcre tracking bugs for this issue:

Affects: fedora-all [bug 1287639]
Comment 2 Adam Mariš 2015-12-02 08:21:46 EST
Created glib2 tracking bugs for this issue:

Affects: fedora-all [bug 1287641]
Comment 3 Adam Mariš 2015-12-02 08:21:55 EST
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 10:23:27 EST
Corresponds to item 6 in http://vcs.pcre.org/pcre/code/trunk/ChangeLog?view=markup
Comment 5 Petr Pisar 2015-12-02 10:52:18 EST
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 09:00:16 EST
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 14:54:11 EST
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 07:18:18 EST
(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 11:33:56 EST
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 09:07:56 EDT
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 04:42:06 EDT
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 06:48:15 EST
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.