Bug 1692520 (CVE-2019-8324)

Summary: CVE-2019-8324 rubygems: Installing a malicious gem may lead to arbitrary code execution
Product: [Other] Security Response Reporter: Pedro Sampaio <psampaio>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: dajohnso, dmetzger, gblomqui, gmccullo, gtanzill, hhorak, jaruga, jfrey, jhardy, jorton, jprause, jschluet, kdixon, lutter, mastahnke, mtasaka, obarenbo, roliveri, ruby-maint, security-response-team, simaishi, s, tkonishi, vanmeeuwen+fedora, vondruch
Target Milestone: ---Keywords: Reopened, Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in RubyGems. A crafted gem with a multi-line name is not handled correctly allowing an attacker to inject arbitrary code to the stub line of gemspec. The highest threat from this vulnerability is to data confidentiality and integrity as well as system availability.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-07-12 13:06:50 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: 1692530, 1695768, 1695769, 1695771, 1695772, 1695773, 1695774, 1695775, 1695776, 1695777, 1695778, 1695779, 1695781, 1712500, 1837065    
Bug Blocks: 1692529    

Description Pedro Sampaio 2019-03-25 19:05:30 UTC
An issue was discovered in RubyGems 2.6 and later through 3.0.2. A crafted gem with a multi-line name is not handled correctly. Therefore, an attacker could inject arbitrary code to the stub line of gemspec, which is eval-ed by code in ensure_loadable_spec during the preinstall check.

Upstream patch:

https://bugs.ruby-lang.org/attachments/7669

References:

https://www.ruby-lang.org/en/news/2019/03/05/multiple-vulnerabilities-in-rubygems/
https://blog.rubygems.org/2019/03/05/security-advisories-2019-03.html

Comment 1 Pedro Sampaio 2019-03-25 19:14:42 UTC
Created rubygems tracking bugs for this issue:

Affects: fedora-all [bug 1692530]

Comment 2 Scott Gayou 2019-04-02 17:02:13 UTC
The changeset in lib/rubygems/installer.rb has the fix for this. See the addition of verify_spec:

```
    # The name and require_paths must be verified first, since it could contain
    # ruby code that would be eval'ed in #ensure_loadable_spec
    verify_spec
```

Comment 4 Scott Gayou 2019-04-03 18:02:20 UTC
Red Hat Enterprise Linux 6 does not look impacted based on a look at the source code. I was able to reproduce this on 7 and various software collections.

This one seems pretty nasty. A malicious gem can execute shell commands if an install is run on one. I don't believe the gem install process is supposed to execute any of the package code at any point, but I may be mistaken on that. If so, I'd probably downgrade this.

Otherwise, leaving at Important as this could lead to root code execution if a user did the lazy sudo gem install.

Comment 9 Doran Moppert 2019-04-29 05:57:43 UTC
rhvm-appliance presently includes affected versions of ruby, but installation of custom gems is not part of normal operation of the rhvm-appliance. Customers will be able to consume updates from Red Hat Enterprise Linux channels when they are made available.

Comment 10 errata-xmlrpc 2019-05-13 09:02:53 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-2019:1148 https://access.redhat.com/errata/RHSA-2019:1148

Comment 11 errata-xmlrpc 2019-05-13 09:18:56 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-2019:1150 https://access.redhat.com/errata/RHSA-2019:1150

Comment 12 errata-xmlrpc 2019-05-13 09:22:59 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-2019:1151 https://access.redhat.com/errata/RHSA-2019:1151

Comment 13 errata-xmlrpc 2019-05-15 17:53:13 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2019:1235 https://access.redhat.com/errata/RHSA-2019:1235

Comment 20 errata-xmlrpc 2019-06-11 05:32:42 UTC
This issue has been addressed in the following products:

  CloudForms Management Engine 5.10

Via RHSA-2019:1429 https://access.redhat.com/errata/RHSA-2019:1429

Comment 21 Product Security DevOps Team 2019-07-12 13:06:50 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-8324

Comment 22 errata-xmlrpc 2019-07-30 15:59:56 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2019:1972 https://access.redhat.com/errata/RHSA-2019:1972

Comment 26 errata-xmlrpc 2020-06-30 12:09:29 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7.4 Advanced Update Support
  Red Hat Enterprise Linux 7.4 Update Services for SAP Solutions
  Red Hat Enterprise Linux 7.4 Telco Extended Update Support

Via RHSA-2020:2769 https://access.redhat.com/errata/RHSA-2020:2769