Bug 16067 - pcre new security issues fixed upstream (including CVE-2015-232[78], CVE-2015-3217, CVE-2015-838[0-9], CVE-2015-839[0-5])
Summary: pcre new security issues fixed upstream (including CVE-2015-232[78], CVE-2015...
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: Security (show other bugs)
Version: 5
Hardware: i586 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: QA Team
QA Contact: Sec team
URL: http://lwn.net/Vulnerabilities/647305/
Whiteboard: MGA4TOO has_procedure advisory MGA4-3...
Keywords: validated_update
Depends on:
Blocks:
 
Reported: 2015-06-01 13:15 CEST by David Walser
Modified: 2016-05-11 20:57 CEST (History)
3 users (show)

See Also:
Source RPM: pcre-8.33-2.1.mga4.src.rpm
CVE:
Status comment:


Attachments

Description David Walser 2015-06-01 13:15:05 CEST
CVEs have been requested for two stack overflow issues fixed last year in PCRE:
http://openwall.com/lists/oss-security/2015/05/31/4
http://openwall.com/lists/oss-security/2015/05/31/5

The issues were in pcre_compile.c, the log for which is here:
http://vcs.pcre.org/pcre/code/trunk/pcre_compile.c?view=log

The exim#1503 issue was fixed in PCREr1495 and the exim#1515 issue was fixed in PCREr1498.  Both of those fixes were included in 8.36, so Cauldron already has them.

However, there are some other commits for overflow issues in that log.

PCREr1537 and PCREr1542 say they also fix stack overflow bugs.  Those commits were included in 8.37, so Cauldron also has those.

PCREr1557-1560 say they fix buffer overflow bugs.  Cauldron would be affected by those.

Reproducible: 

Steps to Reproduce:
Comment 1 David Walser 2015-06-01 23:34:12 CEST
(In reply to David Walser from comment #0)
> PCREr1557-1560 say they fix buffer overflow bugs.  Cauldron would be
> affected by those.

There was an announcement alluding to this on oss-security, but it's completely unclear.  CVE-2015-3210 has been allocated, but they didn't indicate which of those four commits it refers to.  Apparently, though, the other commits are for similar issues.

Version: 4 => Cauldron
Summary: pcre new security issues fixed upstream => pcre new security issues fixed upstream (including CVE-2015-3210)
Whiteboard: (none) => MGA5TOO, MGA4TOO

Comment 2 David Walser 2015-06-03 18:52:07 CEST
CVE-2015-3217 has also been reported:
http://openwall.com/lists/oss-security/2015/06/03/7

I don't think there's a fix for that one yet.
Comment 3 David Walser 2015-06-03 18:52:57 CEST
(In reply to David Walser from comment #1)
> (In reply to David Walser from comment #0)
> > PCREr1557-1560 say they fix buffer overflow bugs.  Cauldron would be
> > affected by those.
> 
> There was an announcement alluding to this on oss-security, but it's
> completely unclear.  CVE-2015-3210 has been allocated, but they didn't
> indicate which of those four commits it refers to.  Apparently, though, the
> other commits are for similar issues.

http://openwall.com/lists/oss-security/2015/06/01/7

That was the announcement I mentioned earlier, I forgot to post the link.
Sander Lepik 2015-06-06 13:51:09 CEST

CC: (none) => mageia
Assignee: bugsquad => warrendiogenese

David Walser 2015-06-06 17:52:28 CEST

URL: (none) => http://lwn.net/Vulnerabilities/647305/

Comment 4 David Walser 2015-06-13 19:15:14 CEST
Needed in just mga4:
http://vcs.pcre.org/pcre?view=revision&revision=1495
http://vcs.pcre.org/pcre?view=revision&revision=1498
http://vcs.pcre.org/pcre?view=revision&revision=1537
http://vcs.pcre.org/pcre?view=revision&revision=1542

Needed for both:
http://vcs.pcre.org/pcre?view=revision&revision=1557
http://vcs.pcre.org/pcre?view=revision&revision=1558
http://vcs.pcre.org/pcre?view=revision&revision=1559
http://vcs.pcre.org/pcre?view=revision&revision=1560
http://vcs.pcre.org/pcre?view=revision&revision=1562
http://vcs.pcre.org/pcre?view=revision&revision=1563
http://vcs.pcre.org/pcre?view=revision&revision=1565

PCREr1562 and PCREr1563 are fixes for a buffer overflow and integer overflow also in pcre_compile.c.  PCREr1565 is in pcre_exec.c.

It's not entirely clear which CVEs or upstream bugs each commit corresponds to.

1565 might be this one:
https://bugs.exim.org/show_bug.cgi?id=1638 (CVE-2015-3217)

1562 might be this one:
https://bugs.exim.org/show_bug.cgi?id=1636 (CVE-2015-3210)

Other older bugs only affecting Mageia 4 that I referenced in Comment 0 are here.  All of these upstream bugs have PoCs:
https://bugs.exim.org/show_bug.cgi?id=1503
https://bugs.exim.org/show_bug.cgi?id=1515

Summary: pcre new security issues fixed upstream (including CVE-2015-3210) => pcre new security issues fixed upstream (including CVE-2015-3210 and CVE-2015-3217)

Comment 5 David Walser 2015-06-13 21:27:56 CEST
Patch committed in Cauldron SVN.  Freeze push requested.
Comment 6 David Walser 2015-06-13 21:34:57 CEST
Fixed in pcre-8.37-2.mga5 before the Mageia 5 release.

Rediffing these patches for Mageia 4 appears to be non-trivial.

Version: Cauldron => 4
Whiteboard: MGA5TOO, MGA4TOO => (none)

Comment 7 David Walser 2015-06-26 16:30:03 CEST
Another CVE has been issued for an issue fixed upstream in pcre_compile.c:
http://openwall.com/lists/oss-security/2015/06/26/3

At least the patch for this one (pasted in the upstream bug linked in the message above and also checked into Mageia 5 and Cauldron) applies cleanly to the mga4 version, but we still have to sort out what to do with these other issues.

The Mageia 5 update for this issue is in Bug 16217.

Summary: pcre new security issues fixed upstream (including CVE-2015-3210 and CVE-2015-3217) => pcre new security issues fixed upstream (including CVE-2015-3210, CVE-2015-3217, and CVE-2015-5073)

Comment 8 David Walser 2015-07-04 19:28:56 CEST
(In reply to David Walser from comment #7)
> Another CVE has been issued for an issue fixed upstream in pcre_compile.c:
> http://openwall.com/lists/oss-security/2015/06/26/3
> 
> At least the patch for this one (pasted in the upstream bug linked in the
> message above and also checked into Mageia 5 and Cauldron) applies cleanly
> to the mga4 version, but we still have to sort out what to do with these
> other issues.
> 
> The Mageia 5 update for this issue is in Bug 16217.

Possibly not an issue on Mageia 4.

PoC attachmed to https://bugs.exim.org/show_bug.cgi?id=1651

Can anyone verify that Mageia 4 is not affected on x86_64?  I get this on i586:
$ php poc.php 
PHP Warning:  preg_match(): Compilation failed: lookbehind assertion is not fixed length at offset 125 in /tmp/poc.php on line 2
Comment 9 David Walser 2015-07-05 05:32:07 CEST
Some more playing with this, I don't think CVE-2015-3210 affects the Mageia 4 version either.  I am also pretty sure that CVE-2015-3217 was not effectively fixed upstream at all.

I have a patch that has I think all the relevant components of the upstream patches I cited earlier except for the overflow in PCREr1559 which is still a valid bug for us.  The code has changed too much to figure out how to fix that one.
http://vcs.pcre.org/pcre?view=revision&revision=1559

My patch definitely fixes upstream bugs 1503 and 1515 though, so that's nice.  It's checked into SVN.
Comment 10 Sander Lepik 2015-07-25 13:10:03 CEST
Which issues are still not fixed for mga4?
Comment 11 David Walser 2015-07-25 16:51:16 CEST
(In reply to Sander Lepik from comment #10)
> Which issues are still not fixed for mga4?

See Comment 9.  Note that the fixes are only in SVN as of now.
Comment 12 Sander Lepik 2015-08-02 13:43:01 CEST
I'm probably getting something wrong here :/ You mention PCREr1559 but changes there seem to be included in pcre-8.37-overflows.patch

Something else we are missing that you didn't link in your comment?
Comment 13 Sander Lepik 2015-08-02 13:43:56 CEST
Oh.. my bad, I checked out mga5 :(
Comment 14 Sander Lepik 2015-08-02 14:39:01 CEST
I checked Fedora's updates and it seems that they didn't include this patch in their update. So maybe we should just release the update before mga4 reaches its EOL. Better fix some issues than nothing at all. WDYT?
Comment 15 David Walser 2015-08-04 13:30:17 CEST
So right now we have PCREr1559 not fixed in Mageia 4, CVE-2015-3217 not fixed in any version, and a CVE request for another issue in pcre_exec.c, which needs to be backported to Mageia 4 as well:
http://openwall.com/lists/oss-security/2015/08/04/2
Comment 16 David Walser 2015-08-05 19:45:05 CEST
(In reply to David Walser from comment #15)
> So right now we have PCREr1559 not fixed in Mageia 4, CVE-2015-3217 not
> fixed in any version, and a CVE request for another issue in pcre_exec.c,
> which needs to be backported to Mageia 4 as well:
> http://openwall.com/lists/oss-security/2015/08/04/2

Fix for that one is here:
http://vcs.pcre.org/pcre?view=revision&revision=1510

CVE request for yet another issue:
http://openwall.com/lists/oss-security/2015/08/05/3

which is fixed here:
http://vcs.pcre.org/pcre?view=revision&revision=1585

I also noticed a new buffer overflow fix:
http://vcs.pcre.org/pcre?view=revision&revision=1571
Comment 17 David Walser 2015-08-14 18:33:21 CEST
(In reply to David Walser from comment #16)
> CVE request for yet another issue:
> http://openwall.com/lists/oss-security/2015/08/05/3
> 
> which is fixed here:
> http://vcs.pcre.org/pcre?view=revision&revision=1585

Fedora has issued an advisory for this on August 13:
https://lists.fedoraproject.org/pipermail/package-announce/2015-August/163731.html

LWN reference:
http://lwn.net/Vulnerabilities/654544/
Comment 18 David Walser 2015-08-24 13:50:33 CEST
CVE request for yet another issue:
http://openwall.com/lists/oss-security/2015/08/24/1

which is fixed here:
http://vcs.pcre.org/pcre?view=revision&revision=1594

I also noticed an integer overflow fix:
http://vcs.pcre.org/pcre?view=revision&revision=1589
Comment 19 David Walser 2015-09-02 18:39:56 CEST
Changing the version since there are unresolved issues for current.

Removing CVE-2015-3210 and CVE-2015-5073 from the bug title since they don't affect Mageia 4 and are fixed in Mageia 5.

Version: 4 => Cauldron
Summary: pcre new security issues fixed upstream (including CVE-2015-3210, CVE-2015-3217, and CVE-2015-5073) => pcre new security issues fixed upstream (including CVE-2015-3217)
Whiteboard: (none) => MGA5TOO, MGA4TOO

Comment 20 David Walser 2015-09-02 22:20:07 CEST
We probably would be better off pulling the latest code from upstream CVS and checking if CVE-2015-3217 is fixed there.  I wonder when they'll do a new release.
Comment 21 David Walser 2015-09-05 00:37:43 CEST
Test cases:

$ pcretest
PCRE version 8.38-RC1 2015-05-03

  re> /^(?:(?(1)\\.|([^\\\\W_])?)+)+$/
data> abcd
No match
data> 

$ pcretest
PCRE version 8.38-RC1 2015-05-03

  re> /^(?P=B)((?P=B)(?J:(?P<B>c)(?P<B>a(?P=B)))>WGXCREDITS)/
data> ADLAB
No match
data> 

$ pcretest
PCRE version 8.38-RC1 2015-05-03

  re> /(((a\2)|(a*)\g<-1>))*a?/
data> abcd
 0: a
 1: 
 2: 
 3: <unset>
 4: 
data> 

$ pcretest
PCRE version 8.38-RC1 2015-05-03

  re> /((?(R)a|(?1)))*/
data> abcd
 0: a
 1: a
data> 

$ pcretest
PCRE version 8.38-RC1 2015-05-03

  re> /(?:((abcd))|(((?:(?:(?:(?:abc|(?:abcdef))))b)abcdefghi)abc)|((*ACCEPT)))/
data> 1234abcd
 0: 
 1: <unset>
 2: <unset>
 3: <unset>
 4: <unset>
 5: 
data> 

$ pcretest
PCRE version 8.38-RC1 2015-05-03

  re> /(?J:(?|(:(?|(?'R')(\k'R')|((?'R')))H'Rk'Rf)|s(?'R'))))/
Failed: unmatched parentheses at offset 53
  re> 

$ pcretest
  re> /(?J:(?|(:(?|(?'R')(\z(?|(?'R')(\k'R')|((?'R')))k'R')|((?'R')))H'Ak'Rf)|s(?'R')))/
data> abcd
No match
data> 

$ php poc.php # from https://bugs.exim.org/show_bug.cgi?id=1651
PHP Warning:  preg_match(): Compilation failed: unmatched parentheses at offset 125 in /tmp/poc.php on line 2

The important thing, no stack traces or segmentation faults.

Whiteboard: MGA5TOO, MGA4TOO => MGA5TOO, MGA4TOO has_procedure

Comment 22 David Walser 2015-09-05 01:01:18 CEST
I updated to the current CVS (last modified 20150902), aka 8.38-RC1.

See the test cases in Comment 21.

Updated packages uploaded for Mageia 4, Mageia 5, and Cauldron.

Advisory:
========================

Updated pcre packages fix security vulnerabilities:

The pcre package has been updated to the latest CVS as of September 2, 2015,
aka 8.38-RC1, which fixes several bugs, including many buffer, stack, and
integer overflows.

References:
http://vcs.pcre.org/pcre/code/trunk/ChangeLog?revision=1600&view=markup
========================

Updated packages in core/updates_testing:
========================
pcre-8.37-1.mga4
libpcre1-8.37-1.mga4
libpcre16_0-8.37-1.mga4
libpcre32_0-8.37-1.mga4
libpcrecpp0-8.37-1.mga4
libpcreposix1-8.37-1.mga4
libpcreposix0-8.37-1.mga4
libpcre-devel-8.37-1.mga4
libpcrecpp-devel-8.37-1.mga4
libpcreposix-devel-8.37-1.mga4
pcre-8.37-2.2.mga5
libpcre1-8.37-2.2.mga5
libpcre16_0-8.37-2.2.mga5
libpcre32_0-8.37-2.2.mga5
libpcrecpp0-8.37-2.2.mga5
libpcreposix1-8.37-2.2.mga5
libpcreposix0-8.37-2.2.mga5
libpcre-devel-8.37-2.2.mga5
libpcrecpp-devel-8.37-2.2.mga5
libpcreposix-devel-8.37-2.2.mga5

from SRPMS:
pcre-8.37-1.mga4.src.rpm
pcre-8.37-2.2.mga5.src.rpm

Version: Cauldron => 5
Assignee: warrendiogenese => qa-bugs
Whiteboard: MGA5TOO, MGA4TOO has_procedure => MGA4TOO has_procedure

Comment 23 Yann Cantin 2015-09-06 13:04:15 CEST
mga4 x86_64 (VM) :
==================

Installed :
 lib64pcre-devel-8.37-1.mga4
 pcre-8.37-1.mga4
 lib64pcreposix1-8.37-1.mga4
 lib64pcre32_0-8.37-1.mga4
 lib64pcre16_0-8.37-1.mga4
 lib64pcre1-8.37-1.mga4

All test OK ; php.poc OK

mga5 x86_64 (VM) :
==================

Installed :
 lib64pcre16_0-8.37-2.2.mga5
 lib64pcre1-8.37-2.2.mga5
 lib64pcre32_0-8.37-2.2.mga5
 lib64pcre-devel-8.37-2.2.mga5
 pcre-8.37-2.2.mga5
 lib64pcreposix1-8.37-2.1.mga5

All test OK ; php.poc OK

=========
Update OK.

CC: (none) => yann.cantin
Whiteboard: MGA4TOO has_procedure => MGA4TOO has_procedure MGA4-64-OK MGA5-64-OK

Comment 24 David Walser 2015-09-07 01:40:50 CEST
Tested successfully Mageia 4 i586 and Mageia 5 i586.

Whiteboard: MGA4TOO has_procedure MGA4-64-OK MGA5-64-OK => MGA4TOO has_procedure MGA4-32-OK MGA4-64-OK MGA5-32-OK MGA5-64-OK

Comment 25 Rémi Verschelde 2015-09-07 07:29:35 CEST
Validating.

Keywords: (none) => validated_update
CC: (none) => sysadmin-bugs

Comment 26 claire robinson 2015-09-08 15:23:05 CEST
Advisory uploaded.

Whiteboard: MGA4TOO has_procedure MGA4-32-OK MGA4-64-OK MGA5-32-OK MGA5-64-OK => MGA4TOO has_procedure advisory MGA4-32-OK MGA4-64-OK MGA5-32-OK MGA5-64-OK

Comment 27 Mageia Robot 2015-09-08 19:57:20 CEST
An update for this issue has been pushed to Mageia Updates repository.

http://advisories.mageia.org/MGASA-2015-0343.html

Status: NEW => RESOLVED
Resolution: (none) => FIXED

Comment 28 David Walser 2015-11-27 17:33:53 CET
(In reply to David Walser from comment #4)
> http://vcs.pcre.org/pcre?view=revision&revision=1565
> 
> PCREr1565 is in pcre_exec.c.
> 
> 1565 might be this one:
> https://bugs.exim.org/show_bug.cgi?id=1638 (CVE-2015-3217)

RedHat says that PCREr1565 was https://bugs.exim.org/show_bug.cgi?id=1637

https://bugzilla.redhat.com/show_bug.cgi?id=1285413

LWN reference:
http://lwn.net/Vulnerabilities/665977/
Comment 29 David Walser 2015-12-02 13:39:12 CET
Several CVEs have been assigned:
http://openwall.com/lists/oss-security/2015/12/02/3

(In reply to David Walser from comment #4)
> Other older bugs only affecting Mageia 4 that I referenced in Comment 0 are
> here.  All of these upstream bugs have PoCs:
> https://bugs.exim.org/show_bug.cgi?id=1503
> https://bugs.exim.org/show_bug.cgi?id=1515

These are now CVE-2015-2327 and CVE-2015-2328 respectively.

(In reply to David Walser from comment #28)
> (In reply to David Walser from comment #4)
> > http://vcs.pcre.org/pcre?view=revision&revision=1565
> > 
> > PCREr1565 is in pcre_exec.c.
> > 
> > 1565 might be this one:
> > https://bugs.exim.org/show_bug.cgi?id=1638 (CVE-2015-3217)
> 
> RedHat says that PCREr1565 was https://bugs.exim.org/show_bug.cgi?id=1637
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1285413
> 
> LWN reference:
> http://lwn.net/Vulnerabilities/665977/

This is now CVE-2015-8380.
Comment 30 David Walser 2015-12-02 13:43:11 CET
(In reply to David Walser from comment #17)
> (In reply to David Walser from comment #16)
> > CVE request for yet another issue:
> > http://openwall.com/lists/oss-security/2015/08/05/3
> > 
> > which is fixed here:
> > http://vcs.pcre.org/pcre?view=revision&revision=1585
> 
> Fedora has issued an advisory for this on August 13:
> https://lists.fedoraproject.org/pipermail/package-announce/2015-August/
> 163731.html
> 
> LWN reference:
> http://lwn.net/Vulnerabilities/654544/

This is CVE-2015-8381:
https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2015-8381
Comment 31 David Walser 2015-12-02 13:45:04 CET
(In reply to David Walser from comment #16)
> (In reply to David Walser from comment #15)
> > CVE request for another issue in pcre_exec.c,
> > http://openwall.com/lists/oss-security/2015/08/04/2
> 
> Fix for that one is here:
> http://vcs.pcre.org/pcre?view=revision&revision=1510

CVE-2015-8382:
https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2015-8382
Comment 32 David Walser 2015-12-02 13:52:00 CET
The other issues fixed between PCRE 8.37 and 8.38-RC1 (which this update was) are CVE-2015-8383 through CVE-2015-8395.

Summary: pcre new security issues fixed upstream (including CVE-2015-3217) => pcre new security issues fixed upstream (including CVE-2015-232[78], CVE-2015-3217, CVE-2015-838[0-9], CVE-2015-839[0-5])

Comment 33 David Walser 2015-12-02 20:04:29 CET
(In reply to David Walser from comment #4)
> 1562 might be this one:
> https://bugs.exim.org/show_bug.cgi?id=1636 (CVE-2015-3210)

Or not :o(

RedHat thinks that 1558 was CVE-2015-3210 (which also corresponds to CVE-2015-8384 apparently):
http://openwall.com/lists/oss-security/2015/12/02/8
Comment 34 David Walser 2016-01-05 18:51:35 CET
(In reply to David Walser from comment #32)
> The other issues fixed between PCRE 8.37 and 8.38-RC1 (which this update
> was) are CVE-2015-8383 through CVE-2015-8395.

LWN reference for all of those except for 8395:
http://lwn.net/Vulnerabilities/670250/
Comment 35 David Walser 2016-02-17 20:48:57 CET
LWN reference for the remaining CVEs:
http://lwn.net/Vulnerabilities/676094/
Comment 36 David Walser 2016-03-30 19:29:27 CEST
LWN reference for CVE-2015-2327 CVE-2015-2328 CVE-2015-8382:
http://lwn.net/Vulnerabilities/681755/
Comment 37 David Walser 2016-05-11 20:57:24 CEST
LWN reference for CVE-2015-3217:
http://lwn.net/Vulnerabilities/687040/

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