🔍 CVE-2023-29007

7.0
CVSS Score
HIGH
2023-04-25
2026-11-02 23:17
✅ 완료

🇰🇷 한글 설명

Git의 `.gitmodules` 파일에 1024자를 초과하는 특수하게 조작된 서브모듈 URL이 포함되면, `config.c::git_config_copy_or_rename_section_in_file()`의 버그를 이용해 `git submodule deinit` 실행 시 사용자의 `$GIT_DIR/config`에 임의 설정을 주입할 수 있습니다. 주입된 `core.pager`, `core.editor`, `core.sshCommand` 등의 실행 파일 설정으로 원격 코드 실행이 가능해질 수 있습니다.

💡 쉬운 설명

악성 저장소의 특정 설정 파일을 이용하면 Git 설정이 몰래 바뀌어 공격자의 프로그램이 실행될 수 있습니다. 신뢰하지 않는 저장소에서 서브모듈 해제 명령을 실행하지 않으면 피해를 막을 수 있습니다.

🇺🇸 원문 (English)

Git is a revision control system. Prior to versions 2.30.9, 2.31.8, 2.32.7, 2.33.8, 2.34.8, 2.35.8, 2.36.6, 2.37.7, 2.38.5, 2.39.3, and 2.40.1, a specially crafted `.gitmodules` file with submodule URLs that are longer than 1024 characters can used to exploit a bug in `config.c::git_config_copy_or_rename_section_in_file()`. This bug can be used to inject arbitrary configuration into a user's `$GIT_DIR/config` when attempting to remove the configuration section associated with that submodule. When the attacker injects configuration values which specify executables to run (such as `core.pager`, `core.editor`, `core.sshCommand`, etc.) this can lead to a remote code execution. A fix A fix is available in versions 2.30.9, 2.31.8, 2.32.7, 2.33.8, 2.34.8, 2.35.8, 2.36.6, 2.37.7, 2.38.5, 2.39.3, and 2.40.1. As a workaround, avoid running `git submodule deinit` on untrusted repositories or without prior inspection of any submodule sections in `$GIT_DIR/config`.

📍 영향받는 시스템

Git 2.30.9 미만, 2.31.8 미만, 2.32.7 미만, 2.33.8 미만, 2.34.8 미만, 2.35.8 미만, 2.36.6 미만, 2.37.7 미만, 2.38.5 미만, 2.39.3 미만, 2.40.1 미만 버전

⚔️ 공격 벡터

공격자가 조작된 .gitmodules 파일을 포함한 저장소를 제공하고, 사용자가 git submodule deinit을 실행하면 설정 주입을 통해 원격 코드 실행이 발생

🛡️ 대응 방법

Git을 2.30.9, 2.31.8, 2.32.7, 2.33.8, 2.34.8, 2.35.8, 2.36.6, 2.37.7, 2.38.5, 2.39.3, 2.40.1 이상으로 업데이트

🔧 검증 코드

출력된 버전이 해당 브랜치의 수정 버전(예: 2.40.1 이상) 이상이면 패치된 것이며, 그보다 낮으면 취약하므로 업데이트가 필요합니다.

Shell / Script
git --version 2>/dev/null

📊 CVSS Vector String

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

💻 영향받는 소프트웨어

Git