🇰🇷 한글 설명
GitPython 라이브러리의 create_submodule() 함수가 공격자가 조작한 서브모듈 경로를 검증하기 전에 _clone_repo()를 호출하는 취약점이 발견되었습니다. 이로 인해 공격자는 .git/hooks와 같은 경로에 실행 가능한 후크 파일을 심을 수 있으며, 이후 Git 작업 시 해당 코드가 실행될 수 있습니다. 이 문제는 3.2.1 버전에서 수정되었습니다.
💡 쉬운 설명
Git을 다루는 프로그램이 나쁜 의도를 가진 경로를 제대로 확인하지 않고 파일을 복사하는 문제입니다. 공격자가 몰래 악성 명령어를 숨겨두면, 나중에 사용자가 Git을 사용할 때 그 명령어가 자동으로 실행될 수 있습니다.
🇺🇸 원문 (English)
GitPython is a python library used to interact with Git repositories. Prior to 3.2.1, create_submodule() in git/objects/submodule/base.py accepts an attacker-influenced submodule path such as .git/hooks and invokes _clone_repo() before safely rejecting the destination. In 3.1.x, _validate_repo_path() does not exist and the call succeeds silently, while in 3.2.0 and later affected revisions the check in git/index/base.py raises ValueError only after the clone has written to disk and does not remove the planted file. An attacker-controlled submodule can therefore place an executable post-checkout hook that a later Git operation executes. Exploitation requires an application to accept an untrusted submodule path and a clone destination such as .git/hooks that is empty enough for Git to clone into it, which commonly means that default sample hooks are absent. This issue is fixed in version 3.2.1.
📍 영향받는 시스템
GitPython versions prior to 3.2.1
⚔️ 공격 벡터
신뢰할 수 없는 서브모듈 경로를 통해 .git/hooks 디렉토리에 악성 실행 파일을 배치하는 방식
🛡️ 대응 방법
GitPython 라이브러리를 3.2.1 버전 이상으로 업데이트하십시오.
🔧 검증 코드
출력된 버전이 3.2.1 미만이면 취약한 상태이며, 3.2.1 이상이면 안전합니다.
pip show GitPython | grep Version