🇰🇷 한글 설명
GitPython 3.1.49 이전 버전의 GitConfigParser.set_value()가 개행문자를 검증하지 않아, 공격자가 설정 파일에 악의적인 core.hooksPath를 주입할 수 있습니다. Git 작업 시 주입된 경로의 스크립트가 자동 실행됩니다.
💡 쉬운 설명
GitPython 라이브러리에서 설정값을 저장할 때 특수 문자를 검증하지 않아, 해커가 Git 훅 경로를 변조할 수 있습니다. 이로 인해 Git 작업마다 해커의 악성 스크립트가 자동 실행됩니다.
🇺🇸 원문 (English)
GitPython is a python library used to interact with Git repositories. Prior to version 3.1.49, GitConfigParser.set_value() passes values to Python's configparser without validating for newlines. GitPython's own _write() converts embedded newlines into indented continuation lines (e.g. \n becomes \n\t), but Git still accepts an indented [core] stanza as a section header — so the injected core.hooksPath becomes effective configuration. Any Git operation that invokes hooks (commit, merge, checkout) will then execute scripts from the attacker-controlled path. This issue has been patched in version 3.1.49.
📍 영향받는 시스템
GitPython < 3.1.49
⚔️ 공격 벡터
GitConfigParser.set_value()에 개행문자를 포함한 설정값을 주입하여 core.hooksPath 설정 변조
🛡️ 대응 방법
GitPython을 3.1.49 이상으로 업그레이드
🔧 검증 코드
버전이 3.1.49 이상이면 PATCHED 출력, 미만이면 VULNERABLE 출력
python3 -c "import git; print(git.__version__)" | awk -F. '{if($1>3 || ($1==3 && $2>1) || ($1==3 && $2==1 && $3>=49)) print "PATCHED"; else print "VULNERABLE"}'