Bug 1802068 (CVE-2019-19204) - CVE-2019-19204 oniguruma: Heap-based buffer over-read in function fetch_interval_quantifier in regparse.c
Summary: CVE-2019-19204 oniguruma: Heap-based buffer over-read in function fetch_inter...
Keywords:
Status: NEW
Alias: CVE-2019-19204
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1802072 1802073 1802382 1802383 1802384 1802385 1803720 1803721 1803722 1803723 1803724 1803725 1803726 1803727 1803728 1803730 1803731 1803732 1814169 1857709
Blocks: 1802075
TreeView+ depends on / blocked
 
Reported: 2020-02-12 10:02 UTC by Dhananjay Arunesh
Modified: 2024-03-27 08:22 UTC (History)
33 users (show)

Fixed In Version: Oniguruma 6.9.4
Doc Type: If docs needed, set a value
Doc Text:
An out-of-bounds read vulnerability was found in Oniguruma in the way it handled regular expression quantifiers. A remote attacker could abuse this flaw by providing a malformed regular expression that, when processed by an application linked to Oniguruma, could possibly crash the application, resulting in a denial of service.
Clone Of:
Environment:
Last Closed: 2020-09-08 13:18:54 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2020:3662 0 None None None 2020-09-08 09:47:07 UTC
Red Hat Product Errata RHSA-2020:5275 0 None None None 2020-12-01 12:03:13 UTC
Red Hat Product Errata RHSA-2024:0409 0 None None None 2024-01-24 16:42:07 UTC
Red Hat Product Errata RHSA-2024:0572 0 None None None 2024-01-30 13:20:42 UTC
Red Hat Product Errata RHSA-2024:0889 0 None None None 2024-02-20 12:30:45 UTC

Description Dhananjay Arunesh 2020-02-12 10:02:16 UTC
An issue was discovered in Oniguruma 6.x before 6.9.4_rc2. In the function fetch_interval_quantifier (formerly known as fetch_range_quantifier) in regparse.c, PFETCH is called without checking PEND. This leads to a heap-based buffer over-read.

Reference:
https://github.com/kkos/oniguruma/issues/162
https://github.com/kkos/oniguruma/releases/tag/v6.9.4_rc2
https://github.com/ManhNDd/CVE-2019-19204
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NO267PLHGYZSWX3XTRPKYBKD4J3YOU5V/
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/V3MBNW6Z4DOXSCNWGBLQ7OA3OGUJ44WL/

Comment 1 Dhananjay Arunesh 2020-02-12 10:05:04 UTC
Created oniguruma tracking bugs for this issue:

Affects: epel-7 [bug 1802072]
Affects: fedora-30 [bug 1802073]

Comment 2 Mark Cooper 2020-02-13 01:13:02 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 5 Mauro Matteo Cascella 2020-02-14 09:03:49 UTC
Upstream fix:
https://github.com/kkos/oniguruma/commit/6eb4aca6a7f2f60f473580576d86686ed6a6ebec

Comment 8 Mauro Matteo Cascella 2020-02-14 16:29:51 UTC
While handling regular expressions quantifiers, function fetch_range_quantifier() in regparse.c repeatedly calls PFETCH() to fetch the current OnigCodePoint and increment the associated pointer to a heap-allocated buffer storing the regular expression.

In some cases it may end up calling PFETCH() two consecutive times on the last element, causing a heap out-of-bounds read of (at most) 4 bytes (OnigCodePoint is a typedef unsigned int).

Comment 9 Mauro Matteo Cascella 2020-02-15 12:33:35 UTC
Note that the versions of Ruby as shipped with Red Hat Enterprise Linux and Red Hat Software Collections 3 do not use Oniguruma but rather Onigmo, a regular expressions library forked from Oniguruma focusing on new expressions supported in Perl 5.10+.

It turns out this flaw affects Onigmo as well, as both Onigmo and Oniguruma share the same vulnerable code.

Comment 10 Mark Cooper 2020-03-02 06:41:29 UTC
Update to Comment 2: Red Hat Core OS also includes oniguruma (6.8.3 which is also vulnerable) as a dependency of jq.

Comment 11 Mauro Matteo Cascella 2020-03-17 09:22:13 UTC
Created oniguruma tracking bugs for this issue:

Affects: openstack-rdo [bug 1814169]

Comment 12 Vít Ondruch 2020-05-04 14:39:13 UTC
I don't think that Ruby is vulnerable. Ruby is doing its own pre-processing of the string, which is already sanitized before it is fed into Oniguruma. E.g. this example fails on Ruby side:

~~~
$ ruby -e 'Regexp.new "_\\{21\\"'
-e:1:in `initialize': too short escape sequence: /_\{21\/ (RegexpError)
	from -e:1:in `new'
	from -e:1:in `<main>'

$ rpm -q ruby
ruby-2.0.0.648-36.el7.x86_64
~~~

Also, Ruby 2.4.0+ is not affected:

https://github.com/ruby/ruby/commit/2873edeafb6f6df1fc99bb9b1167591b99dd378c

because the same issue in Onigmo was fixed way earlier:

https://github.com/k-takata/Onigmo/commit/29e7e6aedebafd5efbbd90655c8e0d495035d7b4

Comment 15 errata-xmlrpc 2020-09-08 09:47:00 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 16 Product Security DevOps Team 2020-09-08 13:18:54 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-19204

Comment 17 errata-xmlrpc 2020-12-01 12:03:08 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

Comment 21 errata-xmlrpc 2024-01-24 16:42:04 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.6 Extended Update Support

Via RHSA-2024:0409 https://access.redhat.com/errata/RHSA-2024:0409

Comment 22 errata-xmlrpc 2024-01-30 13:20:39 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.8 Extended Update Support

Via RHSA-2024:0572 https://access.redhat.com/errata/RHSA-2024:0572

Comment 23 errata-xmlrpc 2024-02-20 12:30:43 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2024:0889 https://access.redhat.com/errata/RHSA-2024:0889


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