kcve.ai취약점 정보 · 내 자산 확인

CVE-2022-41903 Integer overflow in `git archive`, `git log --format` leading to RCE in git

git archive`, `git log --format`에서 정수 오버플로우가 git에서 RCE로 연결

설명

Git is distributed revision control system. `git log` can display commits in an arbitrary format using its `--format` specifiers. This functionality is also exposed to `git archive` via the `export-subst` gitattribute. When processing the padding operators, there is a integer overflow in `pretty.c::format_and_pad_commit()` where a `size_t` is stored improperly as an `int`, and then added as an offset to a `memcpy()`. This overflow can be triggered directly by a user running a command which invokes the commit formatting machinery (e.g., `git log --format=...`). It may also be triggered indirectly through git archive via the export-subst mechanism, which expands format specifiers inside of files within the repository during a git archive. This integer overflow can result in arbitrary heap writes, which may result in arbitrary code execution. The problem has been patched in the versions published on 2023-01-17, going back to v2.30.7. Users are advised to upgrade. Users who are unable to upgrade should disable `git archive` in untrusted repositories. If you expose git archive via `git daemon`, disable it by running `git config --global daemon.uploadArch false`.

Git은 분산 리비전 제어 시스템이다. `git log`는 `--format` 지정자를 사용하여 커밋을 임의의 형식으로 표시할 수 있다. 이 기능은 `export-subst` giattribute를 통해 `git archive`에도 노출됩니다. 패딩 연산자를 처리할 때, `pretty.c::format_and_pad_commit()`에 정수 오버플로가 있는데, 여기서 `size_t`는 `int`로 부적절하게 저장되고, 그 다음 `memcpy()`에 오프셋으로 추가된다. 이 오버플로우는 커밋 포맷팅 머신을 호출하는 명령어를 실행하는 사용자(예를 들어, `git log --format=...`)에 의해 직접 실행될 수 있다. 또한 git 아카이브 동안 저장소 내의 파일 내부에 포맷 지정자를 확장하는 export-subst 메커니즘을 통해 git 아카이브를 통해 간접적으로 트리거될 수 있다. 이 정수 오버플로우는 임의의 힙 쓰기를 발생시킬 수 있으며, 이는 임의의 코드 실행을 초래할 수 있다. 이 문제는 2023-01-17에 게시 된 버전에서 패치되었으며 v2.30.7으로 돌아갑니다. 사용자는 업그레이드하는 것이 좋습니다. 업그레이드할 수 없는 사용자는 신뢰할 수 없는 저장소에서 `git archive`를 비활성화해야 합니다. git daemon을 통해 git archive를 노출하면, `git config --global daemon.uploadArch false`를 실행하여 비활성화합니다.

영향 받는 제품 제품 1개

  • git

    git

    해결 버전 있음

    영향 받는 버전

    • 2.30.7 미만
    • 2.31.0 이상 2.31.6 미만
    • 2.32.0 이상 2.32.5 미만
    • 2.33.0 이상 2.33.6 미만
    • 2.34.0 이상 2.34.6 미만
    • 2.35.0 이상 2.35.6 미만
    • 2.36.0 이상 2.36.4 미만
    • 2.37.0 이상 2.37.5 미만
    외 2개 구간 펼치기
    • 2.38.0 이상 2.38.3 미만
    • 2.39.0

    해결 버전

    • 2.30.7 이상
    • 2.31.6 이상
    • 2.32.5 이상
    • 2.33.6 이상
    • 2.34.6 이상
    • 2.35.6 이상
    • 2.36.4 이상
    • 2.37.5 이상
    외 1개 구간 펼치기
    • 2.38.3 이상

참고 자료 5건

‹ 목록

점검 지원 범위 문의

도입 문의