Bug 1287659 (CVE-2015-8389)

Summary: CVE-2015-8389 pcre: infinite recursion in JIT compiler when processing certain patterns (8.38/21)
Product: [Other] Security Response Reporter: Adam Mariš <amaris>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: adam.stokes, andrew, carnil, erik-fedora, jgrulich, jorton, lkundrak, mclasen, mmaslano, ppisar, rcollet, rmeggins, sardella, slawomir, walters, webstack-team
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: pcre 8.38 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-23 22:25:06 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: 1287660, 1287661, 1287662, 1287663    
Bug Blocks: 1287727    

Description Adam Mariš 2015-12-02 13:37:36 UTC
It was found that PCRE before 8.38 mishandles the /(?:|a|){100}x/ pattern and related
patterns, causing infinite recursion in the JIT compiler and allowing remote attackers to cause a denial of service (infinite recursion) or possibly have unspecified other impact via a crafted regular expression.

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

Affects: fedora-all [bug 1287660]

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

Affects: fedora-all [bug 1287662]

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

Affects: fedora-all [bug 1287661]
Affects: epel-7 [bug 1287663]

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

Comment 5 Petr Pisar 2015-12-02 16:02:41 UTC
Fixed in upstream with:

commit 32c5e4cd1777e53d0da4e5e7bbd227725d12fc14
Author: zherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>
Date:   Mon Jul 20 07:53:12 2015 +0000

    Fix infinite recursion in the JIT compiler when certain patterns when certai
n patterns are analysed.
    
    git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1577 2f5784b3-3f2a-0410-8824-
cb99058d5e15

Comment 6 Petr Pisar 2015-12-03 14:16:23 UTC
Reproducer is to pass /(?:|a|){100}x/S++ expression to pcretest.

Comment 7 Fedora Update System 2016-01-04 19:54:31 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-23 22:25:06 UTC
(In reply to Petr Pisar from comment #5)
> commit 32c5e4cd1777e53d0da4e5e7bbd227725d12fc14
> Author: zherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>
> Date:   Mon Jul 20 07:53:12 2015 +0000
> 
> Fix infinite recursion in the JIT compiler when certain patterns when
> certain patterns are analysed.

Upstream commit link:

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

This problem was introduced in version 8.35.  While PHP and MariaDB versions embed recent PCRE versions, they do not enable JIT and hence are not affected.