Bug 1789407 (CVE-2019-15845)

Summary: CVE-2019-15845 ruby: NUL injection vulnerability of File.fnmatch and File.fnmatch?
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: amasferr, chazlett, hhorak, jorton, mo, mtasaka, pvalena, ruby-maint, ruby-packagers-sig, s, strzibny, vanmeeuwen+fedora, vondruch
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: ruby 2.4.8, ruby 2.5.7, ruby 2.6.5, ruby 2.7.0 Doc Type: If docs needed, set a value
Doc Text:
A flaw was discovered in Ruby in the way certain functions handled strings containing NULL bytes. Specifically, the built-in methods File.fnmatch and its alias File.fnmatch? did not properly handle path patterns containing the NULL byte. A remote attacker could exploit this flaw to make a Ruby script access unexpected files and to bypass intended file system access restrictions.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-26 11:32:05 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: 1789408, 1796784, 1796785, 1796786, 1796787, 1796788, 1796789, 1954949, 1955053, 1957122, 2055232, 2055241    
Bug Blocks: 1789409    

Description Guilherme de Almeida Suckevicz 2020-01-09 13:58:32 UTC
Ruby through 2.4.7, 2.5.x through 2.5.6, and 2.6.x through 2.6.4 mishandles path checking within File.fnmatch functions.

References:
https://www.ruby-lang.org/en/news/2019/10/01/nul-injection-file-fnmatch-cve-2019-15845/
https://hackerone.com/reports/449617

Comment 1 Guilherme de Almeida Suckevicz 2020-01-09 13:59:30 UTC
Created ruby tracking bugs for this issue:

Affects: fedora-all [bug 1789408]

Comment 2 Mauro Matteo Cascella 2020-01-30 14:45:38 UTC
Upstream fix:
https://github.com/ruby/ruby/commit/a0a2640b398cffd351f87d3f6243103add66575b

Comment 3 Mauro Matteo Cascella 2020-01-30 15:07:57 UTC
External References:

https://www.ruby-lang.org/en/news/2019/10/01/nul-injection-file-fnmatch-cve-2019-15845/

Comment 6 Mauro Matteo Cascella 2020-01-31 09:20:48 UTC
Mitigation:

It is possible to test for presence of the NULL byte manually prior to call the affected methods with an untrusted string.

Comment 8 errata-xmlrpc 2021-05-25 13:14:03 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-2021:2104 https://access.redhat.com/errata/RHSA-2021:2104

Comment 9 Product Security DevOps Team 2021-05-26 11:32:05 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-15845

Comment 10 errata-xmlrpc 2021-06-03 11:25:49 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.7 EUS

Via RHSA-2021:2230 https://access.redhat.com/errata/RHSA-2021:2230

Comment 11 errata-xmlrpc 2021-06-29 16:03:20 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2021:2587 https://access.redhat.com/errata/RHSA-2021:2587

Comment 12 errata-xmlrpc 2021-06-29 16:04:02 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2021:2588 https://access.redhat.com/errata/RHSA-2021:2588

Comment 13 errata-xmlrpc 2022-02-21 10:10:54 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.1 Update Services for SAP Solutions

Via RHSA-2022:0581 https://access.redhat.com/errata/RHSA-2022:0581

Comment 14 errata-xmlrpc 2022-02-21 10:11:52 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.2 Extended Update Support

Via RHSA-2022:0582 https://access.redhat.com/errata/RHSA-2022:0582