CVE-2019-15845
ruby: NUL injection vulnerability of File.fnmatch and File.fnmatch?
Severity
ModerateRed Hat Product Security
CVSS 3.1
Review impact separately from score.
Published · October 1, 2019
Updated · November 2, 2026
Description
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.
CVSS score applicability
The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.
Mitigation
It is possible to test for presence of the NULL byte manually prior to call the affected methods with an untrusted string.
CVSS / CWE
CVSS 3.1 · 6.5CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N
CWE-22 · Improper Limitation of a Pathname to a Restricted Directory