Vulnerabilities in pkg:gem/git

PACKAGE
Advisory Identifier: GHSA-pfpr-3463-c6jh
Advisory Summary

CVE-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.

3 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:gem/git

3 Known Advisory Record(s)

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

CVE Identifier CVE-2022-46648
GHSA Identifier GHSA-pfpr-3463-c6jh
Severity HIGH
CVSS v3.1 Base Score 8.0
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Git
Package Ecosystem RubyGems
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (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.

git fixed: 1.13.0
Upgrade git to 1.13.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 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

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.

CVE-2022-46648 Affected Git Versions

1 component(s)
Fixed Versions:
1.13.0
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?
CVE-2022-46648 is a security vulnerability in Git involving ruby-git has potential remote code execution vulnerability under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Git versions are affected?
Affected versions include releases prior to 1.13.0 across affected packages: git.
What version fixes CVE-2022-46648?
Upgrading to 1.13.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is git affected?
Yes, git is affected in releases prior to 1.13.0. Upgrade your dependency to 1.13.0 or later.
What is the CVSS score of CVE-2022-46648?
CVE-2022-46648 has a CVSS v3.1 base score of 8.0 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-46648?
CVE-2022-46648 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-2022-46648?
Run the dependency tree command: 'inspect dependencies for git'. 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-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"
  }
}