🔍 CVE-2026-47712

3.3
CVSS Score
LOW
2026-06-10
2026-07-21 19:10
✅ 완료

🇰🇷 한글 설명

Dulwich 1.2.5 이전 버전의 format_patch 함수는 커밋 제목에서 특수 문자를 적절히 제거하지 않아 경로 트래버설 취약점이 발생합니다. 공격자는 악성 커밋 제목을 통해 생성된 패치 파일이 의도한 디렉토리를 벗어나도록 유도할 수 있습니다.

💡 쉬운 설명

이 결함은 시스템이 파일 이름을 만들 때 위험한 문자를 제대로 처리하지 않아, 파일이 잘못된 폴더에 저장되게 만듭니다. 이를 악용하면 공격자가 시스템의 다른 중요한 파일을 덮어쓰거나 손상시킬 수 있습니다.

🇺🇸 원문 (English)

Dulwich is a pure-Python implementation of the Git file formats and protocols. Starting in version 0.24.0 and prior to version 1.2.5, dulwich.porcelain.format_patch(outdir=...) derives each patch filename from the commit's subject line. Prior to this fix, get_summary only replaced spaces with dashes - path separators (/, \), parent-directory components (..), and other filename-hostile characters (e.g. :) were preserved verbatim and passed straight into os.path.join(outdir, f"{i:04d}-{summary}.patch"). A malicious commit subject could therefore direct the generated patch file outside the requested outdir. This is fixed in Dulwich 1.2.5. Users should upgrade to 1.2.5 or later. dulwich.patch.get_summary now mirrors git's format_sanitized_subject: only `[A-Za-z0-9._]` are kept, runs of other characters collapse to a single -, consecutive . collapse to a single ., trailing ./- are stripped, and the result is length-limited. This makes the returned string safe to embed as a filename component, so format_patch can no longer be steered out of outdir via the commit subject. Until upgrading, callers that pass untrusted commits to porcelain.format_patch can use stdout=True and write the patch to a destination they control, rather than letting format_patch choose the filename; validate the chosen path before opening - e.g. compare os.path.realpath(returned_path) against os.path.realpath(outdir) and reject any patch whose resolved path is not inside outdir; and/or pre-screen commits and refuse to format any whose subject's first line contains /, \, .., or other characters that are not safe on the target filesystem.

📍 영향받는 시스템

Dulwich 0.24.0 이상 1.2.5 미만

⚔️ 공격 벡터

악성 커밋 제목을 포함한 패치 생성 시 경로 트래버설을 통한 파일 시스템 조작

🛡️ 대응 방법

Dulwich를 버전 1.2.5 이상으로 업그레이드하거나, 신뢰할 수 없는 커밋 처리 시 출력 경로를 직접 검증하십시오.

🔧 검증 코드

출력된 버전이 1.2.5보다 낮으면 취약한 버전이므로 업그레이드가 필요합니다.

Shell / Script
python3 -c "import dulwich; print(dulwich.__version__)"

📊 CVSS Vector String

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

💻 영향받는 소프트웨어

Git