PortGate

Advisories · Linux & SSH

CVE-2022-24765 High CVSS 7.8

Git directory ownership on multi-user machines

Disclosed 2022 · Last reviewed 2 Dec 2026

On a shared machine, another local user who could write a parent .git directory could change config that applied to git commands you ran below it.

What happened

Git walked parent directories for .git and did not require that directory to be owned by the current user.

Affected and patched versions

Affected
Git before 2.35.2, and the matching patches on older supported lines.
Patched
Git 2.35.2 and the distro updates that name CVE-2022-24765.

How to check your server

Check

git --version

How to fix and harden

  1. Upgrade Git.
  2. Avoid running git from a directory a less trusted user can write to.
  3. safe.directory is the exception list. Do not set it to a wildcard on a shared host.

Fix

git --version

Sources

Version ranges and fixes follow the vendor advisory. When a distribution backports a fix, trust its security tracker over the upstream version number. New advisories: RSS · JSON