Bug 1287629 - (CVE-2015-8385) CVE-2015-8385 pcre: buffer overflow caused by named forward reference to duplicate group number (8.38/30)
CVE-2015-8385 pcre: buffer overflow caused by named forward reference to dupl...
Status: CLOSED ERRATA
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
high Severity high
: ---
: ---
Assigned To: Red Hat Product Security
impact=important,public=20151123,repo...
: Security
Depends On: 1250946 1287630 1287631 1287632 1287634 1330455 1330456 1330508 1330509
Blocks: 1287727
  Show dependency treegraph
 
Reported: 2015-12-02 08:13 EST by Adam Mariš
Modified: 2016-11-15 08:39 EST (History)
16 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:39:08 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)
Fix-duplicate-names-memory-calculation-error (1/3) (4.08 KB, patch)
2016-04-29 07:19 EDT, Petr Pisar
no flags Details | Diff
Fix-named-forward-reference-to-duplicate-group-numbe.patch (2/3) (2.19 KB, patch)
2016-04-29 07:20 EDT, Petr Pisar
no flags Details | Diff
Fix-buffer-overflow-for-named-references-in-situatio.patch (7.66 KB, patch)
2016-04-29 07:21 EDT, Petr Pisar
no flags Details | Diff

  None (edit)
Description Adam Mariš 2015-12-02 08:13:46 EST
It was found that PCRE before 8.38 mishandles the /(?|(\k'Pm')|(?'Pm'))/ pattern and
related patterns with certain forward references to a group whose number is the same as the current group.
Comment 1 Adam Mariš 2015-12-02 08:14:41 EST
Created pcre tracking bugs for this issue:

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

Affects: fedora-all [bug 1287632]
Comment 3 Adam Mariš 2015-12-02 08:14:58 EST
Created mingw-pcre tracking bugs for this issue:

Affects: fedora-all [bug 1287631]
Affects: epel-7 [bug 1287634]
Comment 4 Adam Mariš 2015-12-02 10:23:13 EST
Correspond to item 5 in http://vcs.pcre.org/pcre/code/trunk/ChangeLog?view=markup
Comment 5 Petr Pisar 2015-12-02 10:49:22 EST
Fixed in upstream with:

commit 2fa78aa4e42bcebf2d616c4ee89c012f29dc3447
Author: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
Date:   Sat May 16 11:05:40 2015 +0000

    Fix named forward reference to duplicate group number overflow bug.
    
    
    git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1559 2f5784b3-3f2a-0410-8824-
cb99058d5e15
Comment 6 Petr Pisar 2015-12-03 03:23:18 EST
This is a duplicate of bug #1250943.
Comment 7 Tomas Hoger 2016-02-18 12:59:59 EST
(In reply to Petr Pisar from comment #5)
> commit 2fa78aa4e42bcebf2d616c4ee89c012f29dc3447
> Author: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
> Date:   Sat May 16 11:05:40 2015 +0000
> 
> Fix named forward reference to duplicate group number overflow bug.

Upstream commit link:

http://vcs.pcre.org/pcre?view=revision&revision=1559
Comment 8 Tomas Hoger 2016-02-18 13:11:38 EST
(In reply to Petr Pisar from comment #6)
> This is a duplicate of bug #1250943.

Why do you believe those are duplicates?  I see the issue in bug 1250943 is associated with upstream rev1585.  The pattern used in test for rev1559 (i.e. this issue) triggers valgrind errors down to version 8.01.
Comment 9 Petr Pisar 2016-02-19 01:39:54 EST
(In reply to Tomas Hoger from comment #8)
> (In reply to Petr Pisar from comment #6)
> > This is a duplicate of bug #1250943.
> 
> Why do you believe those are duplicates?  I see the issue in bug 1250943 is
> associated with upstream rev1585.  The pattern used in test for rev1559
> (i.e. this issue) triggers valgrind errors down to version 8.01.

I mistaken bug numbers probably.

This bug #1287629 seems to be duplicate of bug #1250943.
Comment 10 Tomas Hoger 2016-02-19 15:33:03 EST
(In reply to Petr Pisar from comment #9)
> I mistaken bug numbers probably.
> 
> This bug #1287629 seems to be duplicate of bug #1250943.

The above refers to the same bugs as comment 6.
Comment 11 Petr Pisar 2016-02-22 03:17:19 EST
(In reply to Tomas Hoger from comment #10)
> (In reply to Petr Pisar from comment #9)
> > I mistaken bug numbers probably.
> > 
> > This bug #1287629 seems to be duplicate of bug #1250943.
> 
> The above refers to the same bugs as comment 6.

I'm sorry. I got lost. I cannot find any duplicate in the Bugzilla now.
Comment 12 Tomas Hoger 2016-02-23 16:55:07 EST
My testing shows this issue was introduced in version 8.01 via the following change:

http://vcs.pcre.org/pcre?view=revision&revision=488
https://bugs.exim.org/show_bug.cgi?id=947
Comment 15 Petr Pisar 2016-04-29 07:18:46 EDT
It's difficult to port the fix to 8.32 version. The reason is upstream refactored the named/numbered group handling (from a static to dynamic look-up table) in "Refactor the code for creating the name/number table" commit that is newer than 8.32 version.

I have a patch set of tree patches that together fixes thi bug while passing all tests, but I don't have good feeling of it. I will attach them here.

Is really necessary to address this bug?
Comment 16 Petr Pisar 2016-04-29 07:19 EDT
Created attachment 1152231 [details]
Fix-duplicate-names-memory-calculation-error (1/3)
Comment 17 Petr Pisar 2016-04-29 07:20 EDT
Created attachment 1152232 [details]
Fix-named-forward-reference-to-duplicate-group-numbe.patch (2/3)
Comment 18 Petr Pisar 2016-04-29 07:21 EDT
Created attachment 1152233 [details]
Fix-buffer-overflow-for-named-references-in-situatio.patch
Comment 19 Tomas Hoger 2016-05-02 16:09:14 EDT
(In reply to Petr Pisar from comment #15)
> Is really necessary to address this bug?

Yes, this is something we should fix, as it's memory corruption issue.
Comment 20 errata-xmlrpc 2016-05-11 09:07:47 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 21 errata-xmlrpc 2016-05-26 04:41:54 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 22 errata-xmlrpc 2016-11-15 06:48:04 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.