CVE-2017-0899: Rubygems update RubyGems Code Injection Vulnerability Vulnerability

CRITICAL
Advisory Identifier: GHSA-7gcp-2gmq-w3xh
CVSS 9.8
CWE-94 CWE-150
Published
Advisory Summary

CVE-2017-0899 is a CRITICAL (CVSS 9.8) rubygems code injection vulnerability vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Rubygems update libraries in the RubyGems ecosystem. The issue involves rubygems code injection vulnerability. Remediation is available by upgrading affected packages to version 2.6.13.

CVE-2017-0899 at a Glance

CVE Identifier CVE-2017-0899
GHSA Identifier GHSA-7gcp-2gmq-w3xh
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Rubygems update
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 9.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2017-0899

To remediate this vulnerability, upgrade all affected Rubygems update dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

rubygems-update fixed: 2.6.13
Upgrade rubygems-update to 2.6.13
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for rubygems-update

How to Check if You Are Affected

To determine whether your application is affected by CVE-2017-0899, inspect your project dependencies for Rubygems update:

inspect dependencies for rubygems-update

Analyze the terminal output to locate any version of Rubygems update in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.6.13), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Rubygems update, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

RubyGems prior to 2.6.13 is vulnerable to maliciously crafted gem specifications that include terminal escape characters. Printing the gem specification would execute terminal escape sequences.

CVE-2017-0899 Affected Rubygems update Versions

1 component(s)
Fixed Versions:
2.6.13
Product / Package Ecosystem Affected Versions Fixed Version
rubygems-update
RubyGems
< 2.6.13
2.6.13

References

NVD — CVE-2017-0899 NVD
https://nvd.nist.gov/vuln/detail/CVE-2017-0899
Security Fix Commit FIX COMMIT
https://github.com/rubygems/rubygems/commit/1bcbc7fe637b03145401ec9c094066285934a7f1
Security Fix Commit FIX COMMIT
https://github.com/rubygems/rubygems/commit/ef0aa611effb5f54d40c7fba6e8235eb43c5a491
hackerone.com/reports/226335 WEB
https://hackerone.com/reports/226335
access.redhat.com/errata/rhsa-2017:34... WEB
https://access.redhat.com/errata/RHSA-2017:3485
access.redhat.com/errata/rhsa-2018:03... WEB
https://access.redhat.com/errata/RHSA-2018:0378
access.redhat.com/errata/rhsa-2018:05... WEB
https://access.redhat.com/errata/RHSA-2018:0583
access.redhat.com/errata/rhsa-2018:05... WEB
https://access.redhat.com/errata/RHSA-2018:0585
Rubygems update Source Repository REPOSITORY
https://github.com/rubygems/rubygems
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2018/07/msg00012.html
Rubygems update Security Information SECURITY
https://security.gentoo.org/glsa/201710-01
Rubygems update Security Information SECURITY
https://web.archive.org/web/20170907215801/http://www.securitytracker.com/id/1039249
Rubygems update Security Information SECURITY
https://web.archive.org/web/20170915000000*/http://www.securityfocus.com/bid/100576#:~:text=1%20snapshot-,11%3A49%3A33,-Note
Rubygems update Security Information SECURITY
https://www.debian.org/security/2017/dsa-3966
blog.rubygems.org/2017/08/27/2.6.13-r... WEB
http://blog.rubygems.org/2017/08/27/2.6.13-released.html

Frequently Asked Questions

What is CVE-2017-0899?
CVE-2017-0899 is a security vulnerability in Rubygems update involving RubyGems Code Injection vulnerability under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Rubygems update versions are affected?
Affected versions include releases prior to 2.6.13 across affected packages: rubygems-update.
What version fixes CVE-2017-0899?
Upgrading to 2.6.13 (or the latest patched release for your respective branch) resolves the vulnerability.
Is rubygems-update affected?
Yes, rubygems-update is affected in releases prior to 2.6.13. Upgrade your dependency to 2.6.13 or later.
What is the CVSS score of CVE-2017-0899?
CVE-2017-0899 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2017-0899?
CVE-2017-0899 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check RubyGems dependencies for CVE-2017-0899?
Run the dependency tree command: 'inspect dependencies for rubygems-update'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-7gcp-2gmq-w3xh",
  "modified" : "2023-03-09T00:37:49Z",
  "published" : "2022-05-13T01:38:25Z",
  "aliases" : [ "CVE-2017-0899" ],
  "summary" : "RubyGems Code Injection vulnerability",
  "details" : "RubyGems prior to 2.6.13 is vulnerable to maliciously crafted gem specifications that include terminal escape characters. Printing the gem specification would execute terminal escape sequences.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "rubygems-update"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.6.13"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-0899"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubygems/rubygems/commit/1bcbc7fe637b03145401ec9c094066285934a7f1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubygems/rubygems/commit/ef0aa611effb5f54d40c7fba6e8235eb43c5a491"
  }, {
    "type" : "WEB",
    "url" : "https://hackerone.com/reports/226335"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2017:3485"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2018:0378"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2018:0583"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2018:0585"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rubygems/rubygems"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2018/07/msg00012.html"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/201710-01"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20170907215801/http://www.securitytracker.com/id/1039249"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20170915000000*/http://www.securityfocus.com/bid/100576#:~:text=1%20snapshot-,11%3A49%3A33,-Note"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2017/dsa-3966"
  }, {
    "type" : "WEB",
    "url" : "http://blog.rubygems.org/2017/08/27/2.6.13-released.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-150", "CWE-94" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-03-09T00:37:49Z",
    "nvd_published_at" : "2017-08-31T20:29:00Z"
  }
}