🇰🇷 한글 설명
Dulwich 1.2.5 이전 버전은 악의적으로 조작된 Git 패킷의 delta 헤더에 기재된 부풀려진 dest_size 값을 기반으로 실제 데이터 크기와 무관하게 수백 MB의 메모리를 할당하는 취약점이 있습니다. 이로 인해 git-receive-pack을 통해 푸시를 허용하는 서버가 메모리 고갈 공격에 노출될 수 있습니다.
💡 쉬운 설명
공격자가 작은 크기의 데이터를 보내지만, 시스템이 이를 매우 큰 파일로 인식하도록 속여 서버의 메모리를 고갈시킬 수 있습니다. 이는 서버가 응답을 멈추거나 충돌하게 만들어 서비스 거부 상태를 유발합니다.
🇺🇸 원문 (English)
Dulwich is a pure-Python implementation of the Git file formats and protocols. Starting in version 0.1.0 and prior to version 1.2.5, a client with push access could push a tiny crafted thin pack (~174 bytes) whose delta header declares a huge dest_size. When dulwich ingested it via add_thin_pack / apply_delta, it would allocate hundreds of MB of memory based on that attacker-controlled size, with no relationship to the actual bytes received. Operators running a Dulwich-based Git server that exposes git-receive-pack (i.e. accepts pushes) - for example via dulwich.server functionality, the HTTP smart server, or anything built on ReceivePackHandler - are impacted. The issue is patched in 1.2.5. add_thin_pack now accepts a max_input_size keyword (bytes; 0/None = unlimited, matching git's semantics), and ReceivePackHandler reads receive.maxInputSize from the repository config and passes it through. Wire reads are counted and a PackInputTooLarge exception is raised once the cap is exceeded - equivalent to git index-pack --max-input-size. Users should upgrade to Dulwich 1.2.5 or later and set receive.maxInputSize in their server's repository config to a sane bound for their environment. On unpatched versions, receive.maxInputSize has no effect, so it cannot be used as a workaround. Until upgrading, operators should restrict dulwich-receive-pack (push) access to trusted, authenticated clients only, or disable it entirely on servers that only need to serve fetches and/or run the server under an OS-level memory limit (e.g. ulimit, cgroups/MemoryMax, or a container memory limit) so a malicious push is killed rather than taking down the host.
📍 영향받는 시스템
Dulwich 0.1.0 이상 1.2.5 미만
⚔️ 공격 벡터
git-receive-pack을 통해 악성 thin pack을 푸시하여 메모리 할당 과부하 유도
🛡️ 대응 방법
Dulwich 1.2.5 이상으로 업그레이드하고 receive.maxInputSize 설정을 적용하며, 업그레이드 전까지 푸시 접근을 제한하거나 OS 메모리 제한을 설정하십시오.
🔧 검증 코드
출력된 버전이 1.2.5 미만이면 취약한 버전이므로 업그레이드가 필요합니다.
python -c "import dulwich; print(dulwich.__version__)"