Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 597498

Summary: <sys-libs/musl-1.1.15-r2: libc regex integer overflows in buffer size computations (CVE-2016-8859)
Product: Gentoo Security Reporter: Thomas Deutschmann (RETIRED) <whissi>
Component: VulnerabilitiesAssignee: Gentoo Security <security>
Status: RESOLVED FIXED    
Severity: normal CC: blueness, felix.janda, lu_zero, toolchain
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://www.openwall.com/lists/musl/2016/10/18/2
See Also: https://bugs.gentoo.org/show_bug.cgi?id=597616
Whiteboard: B2 [glsa cve]
Package list:
Runtime testing required: ---

Description Thomas Deutschmann (RETIRED) gentoo-dev 2016-10-19 00:11:09 UTC
From $URL:

Due to incorrect use of integer types and missing overflow checks in
the tre_tnfa_run_parallel function's buffer overflow logic, the TRE
regex implementation (both original version and the one used in musl
libc) are subject to integer overflows in buffer size computation.

If the caller passes to regcomp a regular expression whose internal
representation requires a large number of states and/or a large number
of tags, too little space will be allocated during regexec, resulting
in out-of-bound memory writes.

An attacker who controls the regular expression and/or the string
being searched can potentially exploit these writes to achieve
controlled heap corruption.

All versions of the TRE library and musl libc are affected. The
attached patch fixes the issue in musl and should be easy to adapt for
use with original TRE. musl git master is fixed as of commit https://git.musl-libc.org/cgit/musl/commit/?id=c3edc06d1e1360f3570db9155d6b318ae0d0f0f7
Comment 1 Anthony Basile gentoo-dev 2016-10-19 00:15:10 UTC
I just put musl-1.1.15-r2.ebuild on the tree which has this fix.  Since I do the stabilization I will test in a few days and stabilize on all supported arches.
Comment 2 Thomas Deutschmann (RETIRED) gentoo-dev 2016-10-19 00:21:22 UTC
Like Anthony wrote a patched ebuild is already in tree:

> commit 82e8189213284403928b9ffe36eded866609991d
> Author: Felix Janda
> Date:   Tue Oct 18 19:08:21 2016 -0400
> 
>     sys-libs/musl: add two upstream patches
> 
>     The first patch fixes the bug reported at
> 
>     https://lists.freedesktop.org/archives/xcb/2016-October/010864.html
> 
>     A CVE has been requested for the second patch:
> 
>     http://www.openwall.com/lists/musl/2016/10/18/2


@ Maintainer: Please start stabilization (CC arches & set keyword) when ready and let us know about the progress.
Comment 3 Anthony Basile gentoo-dev 2016-10-23 09:13:34 UTC
(In reply to Thomas Deutschmann from comment #2)
> 
> @ Maintainer: Please start stabilization (CC arches & set keyword) when
> ready and let us know about the progress.

It has been stabilized.
Comment 4 GLSAMaker/CVETool Bot gentoo-dev 2017-01-02 14:37:28 UTC
This issue was resolved and addressed in
 GLSA 201701-11 at https://security.gentoo.org/glsa/201701-11
by GLSA coordinator Thomas Deutschmann (whissi).
Comment 5 Thomas Deutschmann (RETIRED) gentoo-dev 2017-01-02 14:38:51 UTC
Re-opening for cleanup.

@ Maintainer(s): Please drop =sys-libs/musl-1.1.15
Comment 6 Thomas Deutschmann (RETIRED) gentoo-dev 2017-01-08 22:53:07 UTC
Cleanup PR: https://github.com/gentoo/gentoo/pull/3387
Comment 7 Thomas Deutschmann (RETIRED) gentoo-dev 2017-01-08 23:12:11 UTC
Cleaned up via https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=78404f8f8ea9b5dde8d59e4fec442c090328ee65

All done, closing ...