Bug 1561947 (CVE-2018-6914) - CVE-2018-6914 ruby: Unintentional file and directory creation with directory traversal in tempfile and tmpdir
Summary: CVE-2018-6914 ruby: Unintentional file and directory creation with directory ...
Status: NEW
Alias: CVE-2018-6914
Product: Security Response
Classification: Other
Component: vulnerability   
(Show other bugs)
Version: unspecified
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard: impact=low,public=20180328,reported=2...
Keywords: Security
Depends On: 1568981 1651798 1652037 1652038 1561956 1561957 1561958 1563873 1563874 1565258 1568980 1568982 1568983 1568984
Blocks: 1561954
TreeView+ depends on / blocked
 
Reported: 2018-03-29 09:07 UTC by Adam Mariš
Modified: 2019-01-02 22:45 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 tmpdir and tempfile modules did not sanitize their file name argument. An attacker with control over the name could create temporary files and directories outside of the dedicated directory.
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:10 UTC
Red Hat Product Errata RHSA-2018:3731 None None None 2018-11-29 10:22 UTC

Description Adam Mariš 2018-03-29 09:07:06 UTC
Dir.mktmpdir method introduced by tmpdir library accepts the prefix and the suffix of the directory which is created as the first parameter. The prefix can contain relative directory specifiers "../", so this method can be used to target any directory. So, if a script accepts an external input as the prefix, and the targeted directory has inappropriate permissions or the ruby process has inappropriate privileges, the attacker can create a directory or a file at any directory.

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/unintentional-file-and-directory-creation-with-directory-traversal-cve-2018-6914/

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

Affects: fedora-all [bug 1561957]

Comment 8 Cedric Buissart 🐶 2018-04-18 14:24:45 UTC
Low impact because of the filename requirements : path will still contain unpredictable characters. Thus the attacker does not have full control over the filename, or the directory.

Comment 9 Andrej Nemec 2018-05-14 15:26:40 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 10 Jun Aruga 2018-11-16 19:20:14 UTC
Upstream patch:

> Affected versions:

trunk (r62990):
https://github.com/ruby/ruby/commit/10b96900b90914b0cc1dba36f9736c038db2859d

> Ruby 2.2 series: 2.2.9 and earlier

On ruby_2_2 branch:
https://github.com/ruby/ruby/commit/e9ddf2ba41a0bffe1047e33576affd48808c5d0b

> 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

Check ruby_2_N branches.

Comment 13 errata-xmlrpc 2018-11-29 09:56:21 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 14 errata-xmlrpc 2018-11-29 10:10:50 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 15 errata-xmlrpc 2018-11-29 10:22:11 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.