🔍 CVE-2022-24765

6.0
CVSS Score
MEDIUM
2022-04-12
2026-06-17 04:32
✅ 완료

🇰🇷 한글 설명

Git for Windows에서 발생하는 취약점으로, 다중 사용자 환경에서 공격자가 디스크 루트에 C:\.git 폴더를 생성하여 임의의 설정을 주입할 수 있습니다. 이로 인해 Git Bash, PowerShell, Visual Studio 등 Git 관련 도구를 사용하는 사용자의 설정이 공격자가 의도한 대로 조작될 수 있습니다.

💡 쉬운 설명

컴퓨터를 같이 쓰는 다른 사람이 몰래 특정 폴더를 만들어두면, 내가 Git을 사용할 때 그 폴더의 나쁜 설정을 그대로 따라하게 되는 문제입니다. 이를 통해 내 작업 환경이 공격자의 의도대로 조작될 위험이 있습니다.

🇺🇸 원문 (English)

Git for Windows is a fork of Git containing Windows-specific patches. This vulnerability affects users working on multi-user machines, where untrusted parties have write access to the same hard disk. Those untrusted parties could create the folder `C:\.git`, which would be picked up by Git operations run supposedly outside a repository while searching for a Git directory. Git would then respect any config in said Git directory. Git Bash users who set `GIT_PS1_SHOWDIRTYSTATE` are vulnerable as well. Users who installed posh-gitare vulnerable simply by starting a PowerShell. Users of IDEs such as Visual Studio are vulnerable: simply creating a new project would already read and respect the config specified in `C:\.git\config`. Users of the Microsoft fork of Git are vulnerable simply by starting a Git Bash. The problem has been patched in Git for Windows v2.35.2. Users unable to upgrade may create the folder `.git` on all drives where Git commands are run, and remove read/write access from those folders as a workaround. Alternatively, define or extend `GIT_CEILING_DIRECTORIES` to cover the _parent_ directory of the user profile, e.g. `C:\Users` if the user profile is located in `C:\Users\my-user-name`.

📍 영향받는 시스템

Git for Windows 2.35.2 미만 버전 (Git Bash, posh-git, Visual Studio 사용자 포함)

⚔️ 공격 벡터

공격자가 공유 디스크의 루트 디렉토리에 악의적인 .git 폴더와 config 파일을 생성하여 사용자 설정을 탈취하거나 조작함

🛡️ 대응 방법

Git for Windows를 v2.35.2 이상으로 업데이트하거나, GIT_CEILING_DIRECTORIES 환경 변수를 설정하여 상위 디렉토리 탐색을 제한함

🔧 검증 코드

출력된 Git 버전이 2.35.2 이상인지 확인하여 취약 여부를 판단합니다.

Shell / Script
git --version | grep -E '2.35.[2-9]|2.3[6-9]\.|[3-9]\.' || echo 'Vulnerable or unknown version'

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:N

💻 영향받는 소프트웨어

Visual Studio