Bug 1777537 (CVE-2019-19246)

Summary: CVE-2019-19246 oniguruma: Heap-based buffer overflow in str_lower_case_match in regexec.c
Product: [Other] Security Response Reporter: Guilherme de Almeida Suckevicz <gsuckevi>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: alegrand, anpicker, bmontgom, dbecker, eparis, erooth, hhorak, jburrell, jjoyce, jkucera, jokerman, jorton, jschluet, kakkoyun, kdreyer, lcosic, lhh, lpeer, mburns, mloibl, mtasaka, no1youknowz, nstielau, palonsor, pkrupa, rcollet, ruby-maint, sclewis, slinaber, sponnaga, surbania, webstack-team
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: oniguruma 6.9.4 Doc Type: If docs needed, set a value
Doc Text:
A vulnerability was found in Oniguruma, where improper bounds checking in str_lower_case_match within regexec.c can cause a heap-based buffer overflow, a remote attacker could exploit this flaw to crash the application or, in certain scenarios, execute arbitrary code. This occurs when the application processes specially crafted regex patterns, potentially leading to unintended behavior.
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-08 13:18:25 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: 1777538, 1777539, 1777540, 1780460, 1780461, 1780462, 1781609, 1781610, 1781611, 1781612, 1781613, 1781614, 1781615, 1781616, 1781617, 1781618, 1781619, 1857702    
Bug Blocks: 1777541    

Description Guilherme de Almeida Suckevicz 2019-11-27 18:35:13 UTC
Oniguruma through 6.9.3, as used in PHP 7.3.x and other products, has a heap-based buffer over-read in str_lower_case_match in regexec.c.

Reference:
https://bugs.php.net/bug.php?id=78559

Upstream commit:
https://github.com/kkos/oniguruma/commit/d3e402928b6eb3327f8f7d59a9edfa622fec557b

Comment 1 Guilherme de Almeida Suckevicz 2019-11-27 18:35:30 UTC
Created oniguruma tracking bugs for this issue:

Affects: epel-7 [bug 1777538]
Affects: fedora-all [bug 1777540]
Affects: openstack-rdo [bug 1777539]

Comment 2 Mark Cooper 2019-12-06 05:00:21 UTC
The following containers are packaged with OpenShift 4.x and contain a vulnerable version of oniguruma (5.9.x):
 - openshift4/ose-metering-hadoop
 - openshift4/ose-metering-hive
 - openshift4/ose-metering-presto

However, these containers include oniguruma but do not use it. This includes faq and jq which may use oniguruma, and are included within the containers but likewise, are unused.

Comment 6 Stefan Cornelius 2019-12-10 10:29:46 UTC
Using the regex provided in the upstream bug report, I can't reproduce this issue until after the following commit:
https://github.com/kkos/oniguruma/commit/4d461376bd85e7994835677b2ff453a43c49cd28

I'm currently not aware of a method to trigger this in prior versions, although the additional check added to the str_lower_case_match() function as part of the upstream patch for this CVE still applies to older versions. Thus, this may very well only be a defense-in-depth patch for older versions.

Apart from that, the impact of this issue appears very limited: we read a small amount of out-of-bounds heap memory. This could potentially lead to a crash, although in the vast majority of cases, it won't even do that. Furthermore, an attacker would need to be able to provide a regex to the application using oniguruma, which is usually a bad idea in itself.

Comment 10 errata-xmlrpc 2020-09-08 09:46:25 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2020:3662 https://access.redhat.com/errata/RHSA-2020:3662

Comment 11 Product Security DevOps Team 2020-09-08 13:18:25 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2019-19246

Comment 12 errata-xmlrpc 2020-12-01 12:02:48 UTC
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 7
  Red Hat Software Collections for Red Hat Enterprise Linux 7.6 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.7 EUS

Via RHSA-2020:5275 https://access.redhat.com/errata/RHSA-2020:5275