gix-pack Denial-of-Service Vulnerabilities
Multiple denial-of-service vulnerabilities exist in `gix-pack`; crafted delta data can cause unchecked array indexing, leading to panics, and uncapped attacker-controlled size headers enable out-of-memory process kills, triggered by malicious pack data during clone/fetch operations.
The gix-pack library, a Rust implementation of Git packfile handling, contains multiple denial-of-service (DoS) vulnerabilities. Specifically, unchecked array indexing in delta processing can lead to panics, and uncapped memory allocation based on attacker-controlled size headers allows for out-of-memory (OOM) attacks. These vulnerabilities are triggered when processing malicious pack data during clone or fetch operations. The affected versions are gix-pack <= 0.68.0. This poses a risk to any application built on gitoxide that clones or fetches from an untrusted remote, including the gix CLI, applications using the gix crate, and CI/CD systems cloning repositories using gitoxide. A crafted pack entry claiming a multi-terabyte size triggers an immediate process kill, which constitutes a single-packet process kill with no recovery.
Attack Chain
- An attacker crafts a malicious Git packfile containing either truncated delta data or an entry with an extremely large
decompressed_size. - A user or automated system initiates a
git cloneorgit fetchoperation from a repository controlled by the attacker. - The
gix-packlibrary attempts to parse the crafted packfile. - If the packfile contains truncated delta data, the
apply()function ingix-pack/src/data/delta.rsattempts to access array indices beyond the bounds of the data buffer, leading to a panic. Alternatively, theparse_header_info()function ingix-pack/src/data/entry/decode.rscan also panic due to unchecked indexing. - If the packfile contains an entry with an extremely large
decompressed_size, the library attempts to allocate a large buffer usingVec::with_capacity(size as usize)inbytes_to_entries.rsorVec::resize()inresolve.rs. - The allocation of the excessively large buffer exhausts available memory, triggering an out-of-memory (OOM) condition.
- The operating system terminates the process to prevent further memory exhaustion.
- The application using
gix-packcrashes, resulting in a denial-of-service.
Impact
Successful exploitation of these vulnerabilities leads to a denial-of-service (DoS) condition. For the panic vulnerability, a small amount of crafted data causes an immediate process abort. For the OOM vulnerability, a single crafted pack entry header causes the process to attempt a multi-terabyte allocation, leading to process termination by the operating system. This can affect various applications and systems, including the gix CLI, applications using the gix crate, and CI/CD systems, potentially disrupting software development workflows. The OOM vector represents a severe risk, as it is a single-packet process kill with no recovery.
Recommendation
- Upgrade to a patched version of
gix-packwhen available. - Implement input validation on packfile data before processing to mitigate the OOM vulnerability. Specifically, implement a configurable maximum object size and validate claimed sizes against it before allocation, as suggested in the advisory.
- Monitor for process crashes or OOM events related to applications using
gix-pack. Deploy the Sigma ruleDetect Gix-Pack Uncapped Memory Allocationto identify potential OOM attacks. - Consider blocking or filtering network traffic from untrusted Git repositories to prevent malicious packfiles from reaching vulnerable systems.
Detection coverage 2
Detect Gix-Pack Uncapped Memory Allocation
mediumDetects potential out-of-memory (OOM) conditions caused by gix-pack attempting to allocate extremely large buffers, which can indicate a denial-of-service attack.
Detect Gix-Pack Panic via Delta Apply
mediumDetects potential denial-of-service conditions caused by gix-pack panicking due to malformed delta data during clone/fetch operations.
Detection queries are kept inside the platform. Get full rules →