Vulnerabilities in pkg:gem/git
PACKAGECVE-2022-46648 is a HIGH (CVSS 8.0) remote code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Git libraries in the RubyGems ecosystem. The issue involves ruby-git has potential remote code execution vulnerability. Remediation is available by upgrading affected packages to version 1.13.0.
pkg:gem/git
Vulnerability advisories affecting package pkg:gem/git. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-pfpr-3463-c6jh | CVE-2022-46648 | HIGH | ruby-git has potential remote code execution vulnerability |
| GHSA-69p6-wvmq-27gg | CVE-2022-25648 | CRITICAL | Command injection in ruby-git |
| GHSA-pphf-gfrm-v32r | CVE-2022-47318 | HIGH | Code injection in ruby git |
CVE-2022-46648 at a Glance
Security Impact
CVSS: 8.0
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H).
How to Fix CVE-2022-46648
To remediate this vulnerability, upgrade all affected Git 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 git to 1.13.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for git
How to Check if You Are Affected
To determine whether your application is affected by CVE-2022-46648, inspect your project dependencies for Git:
inspect dependencies for git
Analyze the terminal output to locate any version of Git in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.13.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-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 Git, 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-2022-46648 Affected Git Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
git
|
RubyGems |
≥ 1.2.0
< 1.13.0
|
1.13.0
|
References
Frequently Asked Questions
What is CVE-2022-46648?
Which Git versions are affected?
What version fixes CVE-2022-46648?
Is git affected?
What is the CVSS score of CVE-2022-46648?
What CWE is associated with CVE-2022-46648?
How can I check RubyGems dependencies for CVE-2022-46648?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-pfpr-3463-c6jh",
"modified" : "2025-04-04T21:59:57Z",
"published" : "2023-01-09T21:55:14Z",
"aliases" : [ "CVE-2022-46648" ],
"summary" : "ruby-git has potential remote code execution vulnerability",
"details" : "The git gem, between versions 1.2.0 and 1.12.0, incorrectly parsed the output of the `git ls-files` command using `eval()` to unescape quoted file names. If a file name was added to the git repository contained special characters, such as `\\n`, then the `git ls-files` command would print the file name in quotes and escape any special characters. If the `Git#ls_files` method encountered a quoted file name it would use `eval()` to unquote and unescape any special characters, leading to potential remote code execution. Version 1.13.0 of the git gem was released which correctly parses any quoted file names.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "git"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.2.0"
}, {
"fixed" : "1.13.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-46648"
}, {
"type" : "WEB",
"url" : "https://github.com/ruby-git/ruby-git/pull/602"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/ruby-git/ruby-git"
}, {
"type" : "WEB",
"url" : "https://github.com/ruby-git/ruby-git/releases/tag/v1.13.0"
}, {
"type" : "WEB",
"url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/git/CVE-2022-46648.yml"
}, {
"type" : "WEB",
"url" : "https://jvn.jp/en/jp/JVN16765254/index.html"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2023/01/msg00043.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2023-01-09T21:55:14Z",
"nvd_published_at" : "2023-01-17T10:15:00Z"
}
}