BREW-GIT-CVE-2022-41903 (CVE-2022-41903)

Vulnerability from osv_homebrew – Published: 2026-10-15 03:31 – Updated: 2026-10-15 03:31 – Source website
VLAI
Summary
Integer overflow in `git archive`, `git log --format` leading to RCE in git
Details

Git is distributed revision control system. git log can display commits in an arbitrary format using its --format specifiers. This functionality is also exposed to git archive via the export-subst gitattribute. When processing the padding operators, there is a integer overflow in pretty.c::format_and_pad_commit() where a size_t is stored improperly as an int, and then added as an offset to a memcpy(). This overflow can be triggered directly by a user running a command which invokes the commit formatting machinery (e.g., git log --format=...). It may also be triggered indirectly through git archive via the export-subst mechanism, which expands format specifiers inside of files within the repository during a git archive. This integer overflow can result in arbitrary heap writes, which may result in arbitrary code execution. The problem has been patched in the versions published on 2023-01-17, going back to v2.30.7. Users are advised to upgrade. Users who are unable to upgrade should disable git archive in untrusted repositories. If you expose git archive via git daemon, disable it by running git config --global daemon.uploadArch false.


{
  "affected": [
    {
      "ecosystem_specific": {
        "fix": "bump",
        "range_state": "fixed",
        "upstream_fixed_in": "2.39.1"
      },
      "package": {
        "ecosystem": "Homebrew",
        "name": "git",
        "purl": "pkg:brew/git"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "1.8.3"
            },
            {
              "fixed": "2.39.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "database_specific": {
    "confidence": "low",
    "source": "matched",
    "strategy": "distro",
    "upstream_evidence": [
      {
        "ecosystem": "Debian",
        "key": "Debian/git",
        "name": "git",
        "strategy": "distro"
      },
      {
        "ecosystem": "GIT",
        "key": "upstream:https://github.com/git/git",
        "name": "https://github.com/git/git",
        "strategy": "distro",
        "subject_version": "2.56.0"
      },
      {
        "ecosystem": "Ubuntu",
        "key": "Ubuntu/git",
        "name": "git",
        "strategy": "distro"
      }
    ]
  },
  "details": "Git is distributed revision control system. `git log` can display commits in an arbitrary format using its `--format` specifiers. This functionality is also exposed to `git archive` via the `export-subst` gitattribute. When processing the padding operators, there is a integer overflow in `pretty.c::format_and_pad_commit()` where a `size_t` is stored improperly as an `int`, and then added as an offset to a `memcpy()`. This overflow can be triggered directly by a user running a command which invokes the commit formatting machinery (e.g., `git log --format=...`). It may also be triggered indirectly through git archive via the export-subst mechanism, which expands format specifiers inside of files within the repository during a git archive. This integer overflow can result in arbitrary heap writes, which may result in arbitrary code execution. The problem has been patched in the versions published on 2023-01-17, going back to v2.30.7. Users are advised to upgrade. Users who are unable to upgrade should disable `git archive` in untrusted repositories. If you expose git archive via `git daemon`, disable it by running `git config --global daemon.uploadArch false`.",
  "id": "BREW-git-CVE-2022-41903",
  "modified": "2026-10-15T03:31:21Z",
  "published": "2026-10-15T03:31:21Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_export_subst"
    },
    {
      "type": "WEB",
      "url": "https://git-scm.com/docs/pretty-formats#Documentation/pretty-formats.txt-emltltNgttruncltruncmtruncem"
    },
    {
      "type": "ADVISORY",
      "url": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/41xxx/CVE-2022-41903.json"
    },
    {
      "type": "ADVISORY",
      "url": "https://github.com/git/git/security/advisories/GHSA-475x-2q3q-hvwq"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-41903"
    },
    {
      "type": "ADVISORY",
      "url": "https://security.gentoo.org/glsa/202312-15"
    },
    {
      "type": "FIX",
      "url": "https://github.com/git/git/commit/508386c6c5857b4faa2c3e491f422c98cc69ae76"
    }
  ],
  "schema_version": "1.7.3",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Integer overflow in `git archive`, `git log --format` leading to RCE in git",
  "upstream": [
    "CVE-2022-41903",
    "GHSA-475x-2q3q-hvwq"
  ]
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.