A logic error in libarchive’s RAR5 decoder can be driven into an infinite loop when a specially crafted RAR5 archive contains a trailing compressed block that produces no output; the loop occurs inside the RAR5 read path and can hang processes that call archive_read_data(), producing a denial-of-service until the process is killed or the extraction is otherwise interrupted. (github.com)
libarchive is a widely used open‑source library that provides a single API for reading and writing a variety of archive formats (tar, zip, 7z, rar5, etc.). It is embedded in countless tools and packaging systems, and it is shipped by Linux distributions and BSDs in their base or package repositories. The RAR5 reader in libarchive (the rar5 format implementation) is one of the more complex format handlers because it must interoperate with compressed blocks and streaming decompression semantics. The libarchive project addressed a specific RAR5 edge case in a pull request merged in March–April 2024 that closed an infinite‑loop condition where the decompressor would never exit if the final block produced no data. (github.com)
This article explains how the bug worked, which code paths are involved, how and where it was fixed, how to determine if you are affected, and practical mitigation and detection guidance for system administrators and Windows and Linux users who consume archives or ship software that links libarchive.
This is not a simple out‑of‑bounds or buffer overflow bug; it is a correctness / control‑flow bug (CWE‑835 — loop with unreachable exit condition) that manifests as resource exhaustion or unresponsiveness, i.e., a denial‑of‑service condition.
(For clarity: searching public CVE catalogs may not always surface immediate records for every fix; when a vendor or distribution assigns a CVE, those records normally propagate to NVD, MITRE, and vendor advisories, but this propagation is not instantaneous and not all fixes are assigned CVEs. The responsible course is to verify whether the upstream code contains the fix and to apply vendor patches.)
Source: MSRC Security Update Guide - Microsoft Security Response Center
Background / Overview
libarchive is a widely used open‑source library that provides a single API for reading and writing a variety of archive formats (tar, zip, 7z, rar5, etc.). It is embedded in countless tools and packaging systems, and it is shipped by Linux distributions and BSDs in their base or package repositories. The RAR5 reader in libarchive (the rar5 format implementation) is one of the more complex format handlers because it must interoperate with compressed blocks and streaming decompression semantics. The libarchive project addressed a specific RAR5 edge case in a pull request merged in March–April 2024 that closed an infinite‑loop condition where the decompressor would never exit if the final block produced no data. (github.com)This article explains how the bug worked, which code paths are involved, how and where it was fixed, how to determine if you are affected, and practical mitigation and detection guidance for system administrators and Windows and Linux users who consume archives or ship software that links libarchive.
What the bug is (technical summary)
- The problematic behavior is an infinite loop in the RAR5 decoder when processing a file entry whose final compressed block yields zero bytes of decompressed data.
- In affected code paths the RAR5 reader attempts to process compressed blocks until some block produces output; if a trailing block is marked in such a way that it produces no data, the loop condition is never satisfied and the reader keeps trying to process blocks or reads past available input, stalling the caller.
- The condition is reached during normal archive extraction when the public API archive_read_data() is used to stream entry data to a consumer; a maliciously crafted archive can therefore make any program that blindly extracts RAR5 content hang while that process’s CPU or I/O thread is tied up. (github.com)
Where in the code it happens
The RAR5 handling code lives in libarchive’s rar5 support module (archive_read_support_format_rar5.c). The problematic loop occurs where the reader iterates compressed blocks inside the “skip / read data” path—code that ensures the decompressor consumes and produces data for the current file entry until it is complete. The maintainers’ notes and the patch show a loop that relied on data being produced by processed blocks; when the last block produced no bytes that loop had no reachable exit and the process could spin or hang while waiting for output that would never arrive.This is not a simple out‑of‑bounds or buffer overflow bug; it is a correctness / control‑flow bug (CWE‑835 — loop with unreachable exit condition) that manifests as resource exhaustion or unresponsiveness, i.e., a denial‑of‑service condition.
Timeline and vendor response
- Upstream discovery and fix — A contributor filed and merged an upstream pull request that prevents continued processing when the last compressed block produces no output. The PR was merged on April 1, 2024, and explicitly referenced RAR5 archives in the wild that exhibited the behavior. (github.com)
- Release inclusion — The fix was included in libarchive release notes for subsequent stable releases (the change appears in the 3.7.3 series and later release changelogs and downstream merges). Distribution packaging and downstream vendors subsequently backported the fix into distribution packages and product tarballs.
- Ongoing distribution packaging — Multiple distribution changelogs and packaging updates list the rar5 infinite loop fix among their libarchive updates; FreeBSD, openSUSE and many Linux distributions merged vendor updates that include the upstream PR or the release that contains the fix.
Affected versions and how to know if you’re exposed
- Affected code: libarchive RAR5 reader code prior to the merged fix (the behavior that led to the infinite loop existed in releases before the upstream PR/ release that included the fix). The fix was merged and included in libarchive v3.7.3 and in later maintenance releases. Check your shipped libarchive version against that baseline.
- Distribution packages: major distributions and BSDs updated their libarchive packages after the upstream merge; the change is visible in distribution changelogs and packaging metadata. If your distro or product packaged a libarchive release older than the fixed release, you are likely exposed until you install the updated package.
- Application embedding libarchive: some applications vendor their own libarchive copy inside application bundles. Those embedded copies must be upgraded independently of the OS package. If an application ships a vendored copy of libarchive older than the fix, the application remains vulnerable even on patched systems.
- On Debian/Ubuntu: dpkg -l | grep libarchive (or check package version with apt-cache policy libarchive)
- On RHEL/CentOS/Fedora: rpm -q libarchive
- On FreeBSD: pkg info libarchive or check the base system version
- For bundled copies: check the application’s third‑party/vendor directory or the shipped libraries in the application bundle (the vendor may document the libarchive version in release notes)
Exploitability and real‑world risk
- Exploitability: The root cause is a logic loop that leads to a denial‑of‑service (DoS) by hanging or spinning a process thread. This is not the same as a memory‑corruption (RCE) vulnerability; the immediate impact is availability, not arbitrary code execution. The practical exploit scenario is straightforward: an attacker provides a malformed RAR5 archive (for example, as an email attachment, file upload, or over a file share) to a vulnerable application that processes archives without limits, and the application’s process becomes unresponsive when extracting that entry. (github.com)
- Deployment surface: Any service or client that accepts RAR5 archives and uses libarchive’s streaming API (archive_read_data()) on an untrusted input stream is potentially at risk—this includes CLI archive tools, automated unpackers in CI/CD systems, document conversion services or any server component that accepts archives. Systems that extract untrusted archives synchronously and without resource constraints are the highest risk.
- Severity: For single‑user desktop tools the risk may be nuisance (a hung application). For servers, automated agents, CI pipelines, or malware‑scanning services that process many archives or do synchronous extraction this bug can be weaponized as a practical DoS, affecting availability and potentially amplifying across worker pools.
How the upstream fix addresses the root cause
The upstream PR detects the situation where the final block produces no data and uses the encoded “last block” indicator to determine when it should stop attempting further block processing; in short, the fix ensures the decompressor recognizes a valid end condition even when a compressed block yields zero output. The change stops the reader from looping indefinitely and allows the calling application to receive an EOF or an appropriate error condition instead of hanging. (github.com)Practical mitigation and remediation steps
- Identify and inventory:
- Check whether your OS packages for libarchive are updated to the release that includes the fix (libarchive v3.7.3 or later). On RPM systems: rpm -q libarchive; on Debian systems: dpkg -l libarchive; on FreeBSD: pkg info libarchive.
- Search for bundled/libvendored copies inside applications (scan application directories for libarchive shared objects or headers).
- Patch or upgrade:
- If your distribution provides an updated package, install it through normal package management (apt, yum/dnf, zypper, pkg, etc.). Distributors that track upstream releases included the fix in their libarchive updates; apply vendor packages rather than trying to patch locally unless necessary.
- If an application vendors libarchive, upgrade the vendored copy to a fixed release or obtain a vendor patch from the application vendor.
- Containment for unpatched systems:
- Avoid processing untrusted RAR5 archives on critical systems; require manual review or sandbox extraction.
- Use resource limits: run extractors inside short‑lived containers or with CPU and wall‑clock timeouts, and with constrained CPU and memory cgroups to reduce the blast radius of a hung extractor.
- Consider converting automated extraction flows to asynchronous workers with watchdog timers that kill workers exceeding a processing time threshold.
- Detection and monitoring:
- Watch for archival worker processes that remain in high CPU or uninterruptible states during archive handling.
- Add monitoring to track extraction durations and escalate if a normal extraction exceeds a predefined threshold.
- Vendor coordination:
- If you operate products that ship libarchive, request the vendor’s security advisory or timeline for a patched release; vendors often backport the upstream fix into product updates.
Detection and forensic guidance
- Signs of attempted exploitation:
- Long‑running extraction processes consuming CPU indefinitely while handling untrusted RAR files.
- Numerous worker restarts or timeouts in batch extraction jobs after receiving particular RAR attachments or payloads.
- Application logs that show stalled reads or repeated decompressor retries on the same archive entry.
- Forensic collection:
- Preserve the original archive sample (if available) and the process capture (strace/ltrace, core dump if safe and allowed).
- Collect the exact libarchive library binary and symbol information from the affected host; this helps trace whether the vulnerable code was linked in.
- If possible, run the archive against a patched version of libarchive under controlled conditions to confirm whether the archive triggers the previously observed behavior—do this only in an isolated lab environment.
Vendor and distribution coverage (what we verified)
- Upstream: libarcd pull request that stops processing when the last RAR5 block produces no data; the PR is public and was merged in March/April 2024. (github.com)
- Releases: The fix is included in libarchive release notes (3.7.3 and later changelogs mention rar5 infinite loop fixes and related rar5 reader improvements).
- Downstream: Several distribution changelogs and package updates list the rar5 infinite loop fix as part of their libarchive upgrades; FreeBSD merges and openSUSE and other distro packaging reference the upstream change when they imported the updated vendor sources. Administrators should prefer their distribution vendor's packaged update for remediation.
- Uploaded advisories and community notes: community and security trackers that index libarchive-related advisories show multiple libarchive CVE items over time and record vendor backports and patches in packaging metadata; those trackers also corroborate that libarchive's rar5 reader received multiple robustness fixes across releases.
Why CVE labeling can be confusing here
Open‑source projects sometimes fix correctness or denial‑of‑service problems through code merges and releases before—or without—an immediately assigned CVE identifier being published in public databases. That may create the appearance of a “no CVE, no bug” situation even though the upstream fix shipped and downstream vendors released packages that include it. The MSRC link you encountered appears not to show a published, accessible advisory for CVE‑2026‑4111 at the time you tried it; the upstream code and release notes, however, document the concrete fix and are the canonical artifacts for the code change. Always treat the upstream patch and vendor release notes as ground truth for whether your installed package contains the fix. (github.com)(For clarity: searching public CVE catalogs may not always surface immediate records for every fix; when a vendor or distribution assigns a CVE, those records normally propagate to NVD, MITRE, and vendor advisories, but this propagation is not instantaneous and not all fixes are assigned CVEs. The responsible course is to verify whether the upstream code contains the fix and to apply vendor patches.)
Risk assessment and recommended prioritization
- High priority: server‑side or automated services that automatically extract untrusted archives (mail servers, file upload processors, CI/CD extractors, automated scanning pipelines). Without mitigations, these services are easy to target for availability attacks.
- Medium priority: desktop clients that occasionally process untrusted RAR5 archives. Upgrade when possible; user interaction reduces mass exploitation risk but does not remove the possibility of targeted attacks.
- Lower priority: systems that do not process RAR5 archives or that use extraction tools that do not rely on libarchive for RAR5 support. Still audit packaging and third‑party software for embedded libarchive copies.
Practical checklist for sysadmins and developers
- Inventory libarchive versions on all hosts and inside application bundles.
- Upgrade system packages to the libarchive release that contains the rar5 fix (or to the latest stable vendor package).
- If your application vendors libarchive, rebuild or request a vendor update linking a fixed libarchive release.
- Introduce extraction timeouts and run extractors inside isolated sandboxes or containers with resource limits.
- Audit logging to detect unusually long or repeated extraction attempts.
- Where possible, block untrusted RAR5 uploads at the application layer and require safe upload types or content scanning before unpacking.
Final analysis — strengths, limitations, and unanswered items
- Strengths of the upstream response:
- The fix was implemented in a focused pull request that directly addresses the unreachable exit condition; it was merged quickly and shipped in a release, enabling vendors and distributions to backport the fix. The PR includes discussion and sample repro context from a contributor who found real-world archives that exhibited the behavior. (github.com)
- Multiple downstream distribution packages incorporate the upstream release change, which means operators can remediate by installing vendor packages.
- Limitations and risk vectors:
- The vulnerability class is availability‑oriented and therefore lends itself to opportunistic weaponization against automated extraction pipelines and large fleets of workers.
- Applications that vendor libarchive or embed older snapshots are often missed in normal OS patch cycles; those require special attention and coordination with application vendors.
- Public CVE listing inconsistencies (delays or missing assignments) can make triage harder; rely on upstream changelogs and vendor advisories rather than only on CVE catalogs when resiliency is at stake.
- Unanswered / unverifiable items:
- A public, authoritative CVE record for the precise rar5 infinite‑loop condition described here under CVE‑2026‑4111 is not apparent in the public CVE indexes at the time of writing; the upstream PR and release entries are the direct evidence of the bug and its fix. The MSRC URL referenced in your prompt either requires interactive JavaScript or did not present a human‑readable advisory at the time it was queried. Operators should rely on the upstream commits and distribution packages to confirm remediation status. (github.com)
Conclusion
A correctness bug in libarchive’s RAR5 reader could hang processes that call archive_read_data() when presented with a RAR5 entry whose last compressed block produces no output. The libarchive project merged a focused fix (PR #2105) and included it in subsequent releases; downstream distributions and BSD vendors absorbed the change in their packaging updates. Administrators and application vendors should treat this as an availability risk: inventory libarchive usage (including vendored copies), install vendor patches or upgrade libarchive to a release that includes the fix, and apply containment measures (sandboxing, timeouts, resource limits) to reduce the attack surface for untrusted archive processing. The fix is upstream and available in vendor releases—apply it promptly to close this practical DoS vector. (github.com)Source: MSRC Security Update Guide - Microsoft Security Response Center