CVE-2021-3779: Ruby mysql Remote Code Execution Vulnerability
MODERATECVE-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.
CVE-2021-3779 at a Glance
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).
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.
Upgrade ruby-mysql to 2.10.0
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
CVE-2021-3779 Affected Ruby mysql Versions
1 component(s)| 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?
Which Ruby mysql versions are affected?
What version fixes CVE-2021-3779?
Is ruby-mysql affected?
What is the CVSS score of CVE-2021-3779?
What CWE is associated with CVE-2021-3779?
How can I check RubyGems dependencies for CVE-2021-3779?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}