Skip to content
Heist/ feed
Back to feed
High

Bypass of safe.directory protections in Git

Type: advisorySources: OSV

Git is a distributed revision control system. Git prior to versions 2.37.1, 2.36.2, 2.35.4, 2.34.4, 2.33.4, 2.32.3, 2.31.4, and 2.30.5, is vulnerable to privilege escalation in all platforms. An unsuspecting user could still be affected by the issue reported in CVE-2022-24765, for example when navigating as root into a shared tmp directory that is owned by them, but where an attacker could create a git repository. Versions 2.37.1, 2.36.2, 2.35.4, 2.34.4, 2.33.4, 2.32.3, 2.31.4, and 2.30.5 contain a patch for this issue. The simplest way to avoid being affected by the exploit described in the example is to avoid running git as root (or an Administrator in Windows), and if needed to reduce its use to a minimum. While a generic workaround is not possible, a system could be hardened from the exploit described in the example by removing any such repository if it exists already and creating one as root to block any future attacks.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2022-29187
Confirmed fixed CVEs
Not specified
Updated in this feed
3 Nov 2026, 15:18 UTC · Revision 1

Source evidence

Bypass of safe.directory protections in Git

core-osv · Original source

Published 12 Jul 2022, 00:00 UTC

Git is a distributed revision control system. Git prior to versions 2.37.1, 2.36.2, 2.35.4, 2.34.4, 2.33.4, 2.32.3, 2.31.4, and 2.30.5, is vulnerable to privilege escalation in all platforms. An unsuspecting user could still be affected by the issue reported in CVE-2022-24765, for example when navigating as root into a shared tmp directory that is owned by them, but where an attacker could create a git repository. Versions 2.37.1, 2.36.2, 2.35.4, 2.34.4, 2.33.4, 2.32.3, 2.31.4, and 2.30.5 contain a patch for this issue. The simplest way to avoid being affected by the exploit described in the example is to avoid running git as root (or an Administrator in Windows), and if needed to reduce its use to a minimum. While a generic workaround is not possible, a system could be hardened from the exploit described in the example by removing any such repository if it exists already and creating one as root to block any future attacks.

osv:CVE-2022-29187
Complete source record
{
  "id": "4ecffccce6b192a1f6b97d47fad5487eb52bc7c238d9e1bddd0edfc8a73261c8",
  "url": "https://osv.dev/vulnerability/CVE-2022-29187",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Bypass of safe.directory protections in Git",
    "summary": "Git is a distributed revision control system. Git prior to versions 2.37.1, 2.36.2, 2.35.4, 2.34.4, 2.33.4, 2.32.3, 2.31.4, and 2.30.5, is vulnerable to privilege escalation in all platforms. An unsuspecting user could still be affected by the issue reported in CVE-2022-24765, for example when navigating as root into a shared tmp directory that is owned by them, but where an attacker could create a git repository. Versions 2.37.1, 2.36.2, 2.35.4, 2.34.4, 2.33.4, 2.32.3, 2.31.4, and 2.30.5 contain a patch for this issue. The simplest way to avoid being affected by the exploit described in the example is to avoid running git as root (or an Administrator in Windows), and if needed to reduce its use to a minimum. While a generic workaround is not possible, a system could be hardened from the exploit described in the example by removing any such repository if it exists already and creating one as root to block any future attacks.",
    "evidence": "osv:CVE-2022-29187",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2022-29187",
      "aliases": [
        "CVE-2022-29187",
        "GHSA-j342-m5hw-rr3v"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/git-for-windows/git",
              "type": "GIT",
              "events": [
                {
                  "introduced": "518ccba2352ce721cabbbf2933869c3c3313d1c3"
                },
                {
                  "fixed": "9a2f22d016b61018668f8dd2f53faf92c40c6bb8"
                },
                {
                  "introduced": "ea1e13f73339d57cbe81a0bae6fba669aaccf656"
                },
                {
                  "fixed": "ea4bc1e1df4bce2db1c07f1d1e1b2a19717015c8"
                },
                {
                  "introduced": "989c3a6832b035f6124b0a23da9c0f8f18afa550"
                },
                {
                  "fixed": "323a69709944b193bb5cee81ff09fe9a4a686df5"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:git-scm:git:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.35.2"
                      },
                      {
                        "fixed": "2.35.4"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:git-scm:git:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.36.0"
                      },
                      {
                        "fixed": "2.36.2"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:git-scm:git:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.37.0"
                      },
                      {
                        "fixed": "2.37.1"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            },
            {
              "repo": "https://github.com/git/git",
              "type": "GIT",
              "events": [
                {
                  "introduced": "cb95038137e9e66fc6a6b4a0e8db62bcc521b709"
                },
                {
                  "fixed": "88b7be68a4bf9f39b84ed438d8d776c0d752b316"
                },
                {
                  "introduced": "44de39c45c65134f4a6e02e7702a5db70a71041d"
                },
                {
                  "fixed": "5b1c746c352e85211770e5cbd26a433b3affd3b4"
                },
                {
                  "introduced": "9bcd7a8ecac1c9196bc927647bd06c38ec1feabe"
                },
                {
                  "fixed": "656d9a24f624039831bc2e865f4cc42f393caf70"
                },
                {
                  "introduced": "87ed4fc046840706138d46e0033a009e74c3887a"
                },
                {
                  "fixed": "80c525c4acaf6072697d4bd2a3a5137f91665b55"
                },
                {
                  "introduced": "4d0b43aa765a0056c88381eea862364c95e358ca"
                },
                {
                  "fixed": "f2eed22852b0a21556f0c9f56732913eba553e62"
                },
                {
                  "introduced": "53ef17d3ee0f7fcb151f428ee3bd736b8046825f"
                },
                {
                  "fixed": "359da658ae32d9a7e5e93ac173fc221352b62917"
                },
                {
                  "introduced": "6cd33dceed60949e2dbc32e3f0f5e67c4c882e1e"
                },
                {
                  "fixed": "fd59c5bdeeb50f18e86f36cbf7a0b82554621690"
                },
                {
                  "introduced": "e4a4b31577c7419497ac30cebe30d755b97752c5"
                },
                {
                  "fixed": "bbea4dcf42b28eb7ce64a6306cdde875ae5d09ca"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:git-scm:git:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.30.3"
                      },
                      {
                        "fixed": "2.30.5"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:git-scm:git:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.31.2"
                      },
                      {
                        "fixed": "2.31.4"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:git-scm:git:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.32.1"
                      },
                      {
                        "fixed": "2.32.3"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:git-scm:git:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.33.2"
                      },
                      {
                        "fixed": "2.33.4"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:git-scm:git:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.34.2"
                      },
                      {
                        "fixed": "2.34.4"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:git-scm:git:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.35.2"
                      },
                      {
                        "fixed": "2.35.4"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:git-scm:git:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.36.0"
                      },
                      {
                        "fixed": "2.36.2"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:git-scm:git:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.37.0"
                      },
                      {
                        "fixed": "2.37.1"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v2.37.0",
            "v2.36.0",
            "v2.35.3",
            "v2.34.3",
            "v2.33.3",
            "v2.32.2",
            "v2.31.3",
            "v2.30.4",
            "v2.36.1",
            "v2.35.2",
            "v2.34.2",
            "v2.33.2",
            "v2.32.1",
            "v2.31.2",
            "v2.30.3"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-29187.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:29.703761527Z",
      "provider": "osv",
      "references": [
        "https://lore.kernel.org/git/xmqqv8s2fefi.fsf%40gitster.g/T/#u",
        "https://support.apple.com/kb/HT213496",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/29xxx/CVE-2022-29187.json",
        "https://github.com/git/git/security/advisories/GHSA-j342-m5hw-rr3v",
        "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/DDI325LOO2XBDDKLINOAQJEG6MHAURZE/",
        "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/DIKWISWUDFT2FAITYIA6372BVLH3OOOC/",
        "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/HVOLER2PIGMHPQMDGG4RDE2KZB74QLA2/",
        "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/TRZG5CDUQ27OWTPC5MQOR4UASNXHWEZS/",
        "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UDZRZAL7QULOB6V7MKT66MOMWJLBJPX4/",
        "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/YROCMBWYFKRSS64PO6FUNM6L7LKBUKVW/",
        "https://nvd.nist.gov/vuln/detail/CVE-2022-29187",
        "https://security.gentoo.org/glsa/202312-15",
        "https://security.gentoo.org/glsa/202401-17",
        "https://github.blog/2022-04-12-git-security-vulnerability-announced",
        "https://lists.debian.org/debian-lts-announce/2022/12/msg00025.html"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-282",
          "CWE-427"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/29xxx/CVE-2022-29187.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2022-29187",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 496755,
  "published_at": "2022-07-12T00:00:00+00:00"
}