Bug 1789407 (CVE-2019-15845) - CVE-2019-15845 ruby: NUL injection vulnerability of File.fnmatch and File.fnmatch?
Summary: CVE-2019-15845 ruby: NUL injection vulnerability of File.fnmatch and File.fnm...
Keywords:
Status: NEW
Alias: CVE-2019-15845
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: 1789408 1796784 1796785 1796786 1796787 1796788 1796789
Blocks: 1789409
TreeView+ depends on / blocked
 
Reported: 2020-01-09 13:58 UTC by Guilherme de Almeida Suckevicz
Modified: 2020-04-23 19:17 UTC (History)
13 users (show)

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.
Clone Of:
Environment:
Last Closed:


Attachments (Terms of Use)

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.


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