Bug 1561949 (CVE-2018-8780) - CVE-2018-8780 ruby: Unintentional directory traversal by poisoned NULL byte in Dir
Summary: CVE-2018-8780 ruby: Unintentional directory traversal by poisoned NULL byte i...
Status: NEW
Alias: CVE-2018-8780
Product: Security Response
Classification: Other
Component: vulnerability   
(Show other bugs)
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard: impact=moderate,public=20180328,repor...
Keywords: Security
Depends On: 1568494 1651798 1652037 1652038 1561956 1561957 1561958 1563873 1563874 1565258 1568495 1568496 1568497 1568498
Blocks: 1561954
TreeView+ depends on / blocked
 
Reported: 2018-03-29 09:08 UTC by Adam Mariš
Modified: 2019-02-28 22:36 UTC (History)
29 users (show)

Fixed In Version: ruby 2.2.10, ruby 2.3.7, ruby 2.4.4, ruby 2.5.1
Doc Type: If docs needed, set a value
Doc Text:
It was found that the methods from the Dir class did not properly handle strings containing the NULL byte. An attacker, able to inject NULL bytes in a path, could possibly trigger an unspecified behavior of the ruby script.
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:3729 None None None 2018-11-29 09:56 UTC
Red Hat Product Errata RHSA-2018:3730 None None None 2018-11-29 10:11 UTC
Red Hat Product Errata RHSA-2018:3731 None None None 2018-11-29 10:22 UTC

Description Adam Mariš 2018-03-29 09:08:00 UTC
Dir.open, Dir.new, Dir.entries and Dir.empty? accept the path of the target directory as their parameter. If the parameter contains NUL (\0) bytes, these methods recognize that the path is completed before the NUL bytes. So, if a script accepts an external input as the argument of these methods, the attacker can make the unintentional directory traversal.

Affected versions:

Ruby 2.2 series: 2.2.9 and earlier
Ruby 2.3 series: 2.3.6 and earlier
Ruby 2.4 series: 2.4.3 and earlier
Ruby 2.5 series: 2.5.0 and earlier

External References:

https://www.ruby-lang.org/en/news/2018/03/28/poisoned-nul-byte-dir-cve-2018-8780/

Comment 1 Adam Mariš 2018-03-29 09:16:38 UTC
Created ruby tracking bugs for this issue:

Affects: fedora-all [bug 1561957]

Comment 10 Eric Christensen 2018-04-17 19:04:54 UTC
Mitigation:

It is possible to test for presence of the NULL byte manually prior to call a Dir method with an untrusted string.

Comment 11 Cedric Buissart 🐶 2018-04-18 07:43:34 UTC
Upstream fix : 
https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62989

Comment 16 Andrej Nemec 2018-05-14 15:26:03 UTC
Statement:

This issue affects the versions of ruby as shipped with Red Hat CloudForms 4. Red Hat Product Security has rated this issue as having security impact of Moderate. A future update may address this issue. For additional information, refer to the Issue Severity Classification: https://access.redhat.com/security/updates/classification/.

This issue affects the versions of ruby as shipped with Red Hat Subscription Asset Manager 1. Red Hat Product Security has rated this issue as having security impact of Moderate. A future update may address this issue. For additional information, refer to the Issue Severity Classification: https://access.redhat.com/security/updates/classification/.

Comment 17 Jun Aruga 2018-11-15 19:19:20 UTC
Upstream patch:

> Affected versions:

trunk branch: (r62989)
https://github.com/ruby/ruby/commit/bd5661a3cbb38a8c3a3ea10cd76c88bbef7871b8

> Ruby 2.2 series: 2.2.9 and earlier

ruby_2_2 branch:
https://github.com/ruby/ruby/commit/143eb22f1877815dd802f7928959c5f93d4c7bb3

> Ruby 2.3 series: 2.3.6 and earlier
> Ruby 2.4 series: 2.4.3 and earlier
> Ruby 2.5 series: 2.5.0 and earlier

Search ruby_2_X branches by "dir.c: check NUL bytes".

Comment 20 errata-xmlrpc 2018-11-29 09:56:37 UTC
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 6
  Red Hat Software Collections for Red Hat Enterprise Linux 7
  Red Hat Software Collections for Red Hat Enterprise Linux 7.4 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.5 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.6 EUS

Via RHSA-2018:3729 https://access.redhat.com/errata/RHSA-2018:3729

Comment 21 errata-xmlrpc 2018-11-29 10:11:08 UTC
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 6
  Red Hat Software Collections for Red Hat Enterprise Linux 7
  Red Hat Software Collections for Red Hat Enterprise Linux 7.4 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.5 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.6 EUS

Via RHSA-2018:3730 https://access.redhat.com/errata/RHSA-2018:3730

Comment 22 errata-xmlrpc 2018-11-29 10:22:29 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.4 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.5 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.6 EUS

Via RHSA-2018:3731 https://access.redhat.com/errata/RHSA-2018:3731


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