CVE-2018-16395: Openssl Ruby Openssl Allows Incorrect Value Vulnerability

CRITICAL
Advisory Identifier: GHSA-mmrq-6999-72v8
CVSS 9.8
Published
Advisory Summary

CVE-2018-16395 is a CRITICAL (CVSS 9.8) ruby openssl allows incorrect value vulnerability (General Security Weakness) affecting Openssl libraries in the RubyGems ecosystem. The issue involves ruby openssl allows incorrect value comparison. Remediation is available by upgrading affected packages to version 2.0.9, 2.1.2.

CVE-2018-16395 at a Glance

CVE Identifier CVE-2018-16395
GHSA Identifier GHSA-mmrq-6999-72v8
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification General Security Weakness
Affected Product Openssl
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-2018-16395

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

openssl fixed: 2.0.9
Upgrade openssl to 2.0.9
openssl fixed: 2.1.2
Upgrade openssl to 2.1.2
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 openssl

How to Check if You Are Affected

To determine whether your application is affected by CVE-2018-16395, inspect your project dependencies for Openssl:

inspect dependencies for openssl

Analyze the terminal output to locate any version of Openssl in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.9), 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 General Security Weakness. In Openssl, 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

An issue was discovered in the OpenSSL library in Ruby when two `OpenSSL::X509::Name` objects are compared using `==`, depending on the ordering, non-equal objects may return true. When the first argument is one character longer than the second, or the second argument contains a character that is one less than a character in the same position of the first argument, the result of `==` will be true. This could be leveraged to create an illegitimate certificate that may be accepted as legitimate and then used in signing or encryption operations.

CVE-2018-16395 Affected Openssl Versions

2 component(s)
Fixed Versions:
2.0.92.1.2
Product / Package Ecosystem Affected Versions Fixed Version
openssl
RubyGems
< 2.0.9
2.0.9
openssl
RubyGems
≥ 2.1.0
< 2.1.2
2.1.2

References

NVD — CVE-2018-16395 NVD
https://nvd.nist.gov/vuln/detail/CVE-2018-16395
Security Fix Commit FIX COMMIT
https://github.com/ruby/openssl/commit/f653cfa43f0f20e8c440122ea982382b6228e7f5
hackerone.com/reports/387250 WEB
https://hackerone.com/reports/387250
www.ruby-lang.org/en/news/2018/11/06/... WEB
https://www.ruby-lang.org/en/news/2018/11/06/ruby-2-6-0-preview3-released
www.ruby-lang.org/en/news/2018/10/17/... WEB
https://www.ruby-lang.org/en/news/2018/10/17/ruby-2-5-2-released
www.ruby-lang.org/en/news/2018/10/17/... WEB
https://www.ruby-lang.org/en/news/2018/10/17/ruby-2-4-5-released
www.ruby-lang.org/en/news/2018/10/17/... WEB
https://www.ruby-lang.org/en/news/2018/10/17/ruby-2-3-8-released
www.ruby-lang.org/en/news/2018/10/17/... WEB
https://www.ruby-lang.org/en/news/2018/10/17/openssl-x509-name-equality-check-does-not-work-correctly-cve-2018-16395
Openssl Security Information SECURITY
https://www.oracle.com/security-alerts/cpujan2020.html
Openssl Security Information SECURITY
https://www.debian.org/security/2018/dsa-4332
Openssl Security Information SECURITY
https://web.archive.org/web/20211206015239/https://securitytracker.com/id/1042105
usn.ubuntu.com/3808-1 WEB
https://usn.ubuntu.com/3808-1
Openssl Security Information SECURITY
https://security.netapp.com/advisory/ntap-20190221-0002
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2018/10/msg00020.html
Openssl Source Repository REPOSITORY
https://github.com/rubysec/ruby-advisory-db/blob/master/gems/openssl/CVE-2018-16395.yml
access.redhat.com/errata/rhsa-2019:25... WEB
https://access.redhat.com/errata/RHSA-2019:2565
access.redhat.com/errata/rhsa-2019:19... WEB
https://access.redhat.com/errata/RHSA-2019:1948
access.redhat.com/errata/rhsa-2018:37... WEB
https://access.redhat.com/errata/RHSA-2018:3738
access.redhat.com/errata/rhsa-2018:37... WEB
https://access.redhat.com/errata/RHSA-2018:3731
access.redhat.com/errata/rhsa-2018:37... WEB
https://access.redhat.com/errata/RHSA-2018:3730
access.redhat.com/errata/rhsa-2018:37... WEB
https://access.redhat.com/errata/RHSA-2018:3729
Openssl Security Information SECURITY
http://lists.opensuse.org/opensuse-security-announce/2019-07/msg00036.html

Frequently Asked Questions

What is CVE-2018-16395?
CVE-2018-16395 is a security vulnerability in Openssl involving Ruby Openssl Allows Incorrect Value Comparison under General Security Weakness.
Which Openssl versions are affected?
Affected versions include releases prior to 2.0.9, 2.1.2 across affected packages: openssl.
What version fixes CVE-2018-16395?
Upgrading to 2.0.9, 2.1.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is openssl affected?
Yes, openssl is affected in releases prior to 2.0.9, 2.1.2. Upgrade your dependency to 2.0.9, 2.1.2 or later.
What is the CVSS score of CVE-2018-16395?
CVE-2018-16395 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-2018-16395?
CVE-2018-16395 is classified under General Security Weakness.
How can I check RubyGems dependencies for CVE-2018-16395?
Run the dependency tree command: 'inspect dependencies for openssl'. 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-mmrq-6999-72v8",
  "modified" : "2023-07-24T20:06:51Z",
  "published" : "2022-05-13T01:50:20Z",
  "aliases" : [ "CVE-2018-16395" ],
  "summary" : "Ruby Openssl Allows Incorrect Value Comparison",
  "details" : "An issue was discovered in the OpenSSL library in Ruby when two `OpenSSL::X509::Name` objects are compared using `==`, depending on the ordering, non-equal objects may return true. When the first argument is one character longer than the second, or the second argument contains a character that is one less than a character in the same position of the first argument, the result of `==` will be true. This could be leveraged to create an illegitimate certificate that may be accepted as legitimate and then used in signing or encryption operations.",
  "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" : "openssl"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "openssl"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.1.0"
      }, {
        "fixed" : "2.1.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-16395"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/openssl/commit/f653cfa43f0f20e8c440122ea982382b6228e7f5"
  }, {
    "type" : "WEB",
    "url" : "https://hackerone.com/reports/387250"
  }, {
    "type" : "WEB",
    "url" : "https://www.ruby-lang.org/en/news/2018/11/06/ruby-2-6-0-preview3-released"
  }, {
    "type" : "WEB",
    "url" : "https://www.ruby-lang.org/en/news/2018/10/17/ruby-2-5-2-released"
  }, {
    "type" : "WEB",
    "url" : "https://www.ruby-lang.org/en/news/2018/10/17/ruby-2-4-5-released"
  }, {
    "type" : "WEB",
    "url" : "https://www.ruby-lang.org/en/news/2018/10/17/ruby-2-3-8-released"
  }, {
    "type" : "WEB",
    "url" : "https://www.ruby-lang.org/en/news/2018/10/17/openssl-x509-name-equality-check-does-not-work-correctly-cve-2018-16395"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujan2020.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2018/dsa-4332"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20211206015239/https://securitytracker.com/id/1042105"
  }, {
    "type" : "WEB",
    "url" : "https://usn.ubuntu.com/3808-1"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20190221-0002"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2018/10/msg00020.html"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/openssl/CVE-2018-16395.yml"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2019:2565"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2019:1948"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2018:3738"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2018:3731"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2018:3730"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2018:3729"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-security-announce/2019-07/msg00036.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-06-09T22:57:50Z",
    "nvd_published_at" : "2018-11-16T18:29:00Z"
  }
}