Vulnerabilities in pkg:gem/ruby-mysql

PACKAGE
Advisory Identifier: GHSA-73pr-g6jj-5hc9
Advisory Summary

CVE-2021-3779 is a MODERATE (CVSS 6.5) remote code execution vulnerability (CWE-610: Externally Controlled Reference to a Resource in Another Sphere) affecting Ruby mysql libraries in the RubyGems ecosystem. The issue involves externally controlled reference to a resource in another sphere in ruby-mysql. Remediation is available by upgrading affected packages to version 2.10.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:gem/ruby-mysql

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:gem/ruby-mysql. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-73pr-g6jj-5hc9 CVE-2021-3779 MODERATE Externally Controlled Reference to a Resource in Another Sphere in ruby-mysql

CVE-2021-3779 at a Glance

CVE Identifier CVE-2021-3779
GHSA Identifier GHSA-73pr-g6jj-5hc9
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-610: Externally Controlled Reference to a Resource in Another Sphere
Affected Product Ruby mysql
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 6.5

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

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

How to Fix CVE-2021-3779

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

ruby-mysql fixed: 2.10.0
Upgrade ruby-mysql to 2.10.0
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 ruby-mysql

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-3779, inspect your project dependencies for Ruby mysql:

inspect dependencies for ruby-mysql

Analyze the terminal output to locate any version of Ruby mysql in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.10.0), 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-610: Externally Controlled Reference to a Resource in Another Sphere, where the product uses an externally controlled name or reference that resolves to a resource that is outside of the intended control sphere. In Ruby mysql, 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

A malicious actor can read arbitrary files from a client that uses ruby-mysql to communicate to a rogue MySQL server and issue database queries. In these cases, the server has the option to create a database reply using the LOAD DATA LOCAL statement, which instructs the client to provide additional data from a local file readable by the client (and not a "local" file on the server).

CVE-2021-3779 Affected Ruby mysql Versions

1 component(s)
Fixed Versions:
2.10.0
Product / Package Ecosystem Affected Versions Fixed Version
ruby-mysql
RubyGems
< 2.10.0
2.10.0

References

Frequently Asked Questions

What is CVE-2021-3779?
CVE-2021-3779 is a security vulnerability in Ruby mysql involving Externally Controlled Reference to a Resource in Another Sphere in ruby-mysql under CWE-610: Externally Controlled Reference to a Resource in Another Sphere.
Which Ruby mysql versions are affected?
Affected versions include releases prior to 2.10.0 across affected packages: ruby-mysql.
What version fixes CVE-2021-3779?
Upgrading to 2.10.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ruby-mysql affected?
Yes, ruby-mysql is affected in releases prior to 2.10.0. Upgrade your dependency to 2.10.0 or later.
What is the CVSS score of CVE-2021-3779?
CVE-2021-3779 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2021-3779?
CVE-2021-3779 is classified under CWE-610: Externally Controlled Reference to a Resource in Another Sphere (The product uses an externally controlled name or reference that resolves to a resource that is outside of the intended control sphere.).
How can I check RubyGems dependencies for CVE-2021-3779?
Run the dependency tree command: 'inspect dependencies for ruby-mysql'. 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-73pr-g6jj-5hc9",
  "modified" : "2022-07-08T17:05:08Z",
  "published" : "2022-06-29T00:00:27Z",
  "aliases" : [ "CVE-2021-3779" ],
  "summary" : "Externally Controlled Reference to a Resource in Another Sphere in ruby-mysql",
  "details" : "A malicious actor can read arbitrary files from a client that uses ruby-mysql to communicate to a rogue MySQL server and issue database queries. In these cases, the server has the option to create a database reply using the LOAD DATA LOCAL statement, which instructs the client to provide additional data from a local file readable by the client (and not a \"local\" file on the server).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "ruby-mysql"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.10.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-3779"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/ruby-mysql/CVE-2021-3779.yml"
  }, {
    "type" : "WEB",
    "url" : "https://www.rapid7.com/blog/post/2022/06/28/cve-2021-3779-ruby-mysql-gem-client-file-read-fixed"
  }, {
    "type" : "PACKAGE",
    "url" : "http://github.com/tmtm/ruby-mysql"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-610" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-07-05T22:08:34Z",
    "nvd_published_at" : "2022-06-28T17:15:00Z"
  }
}