Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-55195

CVE-2026-55195: py7zr Library DOS Vulnerability

CVE-2026-55195 is a denial of service flaw in py7zr Python library that allows crafted 7z archives to exhaust disk or memory resources during decompression. This article covers technical details, affected versions, and mitigations.

Published:

CVE-2026-55195 Overview

CVE-2026-55195 affects py7zr, a Python library and utility that supports 7zip archive compression, decompression, encryption, and decryption. Versions prior to 1.1.3 fail to track the total decompressed size during extraction in the Worker.decompress() function. A crafted .7z archive as small as 15.6 KB can expand to 100 MB or more, exhausting disk space or memory before extraction completes. This weakness is classified as [CWE-409: Improper Handling of Highly Compressed Data (Data Amplification)]. The maintainer resolved the issue in version 1.1.3 by introducing a max_extract_size parameter and a new DecompressionBombError exception.

Critical Impact

A remote, unauthenticated attacker can trigger denial of service by supplying a small crafted 7z archive that expands to consume all available memory or disk space on the host processing it.

Affected Products

  • py7zr Python library versions prior to 1.1.3
  • Applications and services that use py7zr to decompress untrusted .7z archives
  • Automated pipelines, mail scanners, and file-processing workflows relying on py7zr

Discovery Timeline

  • 2026-07-08 - CVE-2026-55195 published to the National Vulnerability Database
  • 2026-07-08 - Last updated in NVD database

Technical Details for CVE-2026-55195

Vulnerability Analysis

The flaw is a classic decompression bomb condition, tracked under [CWE-409]. The Worker.decompress() method in py7zr iterates over archive entries and writes decompressed data to the output target without accumulating and checking a total decompressed byte count. Because 7zip supports high compression ratios through LZMA and LZMA2, an attacker can craft an archive where the compressed-to-decompressed ratio exceeds several thousand to one. The advisory documents a 15.6 KB archive expanding to 100 MB, and the ratio scales linearly with attacker effort.

Processes that ingest archives from untrusted sources will exhaust available memory or disk before extraction returns. This produces service-level denial of service, and on shared systems it can affect co-located workloads. The vulnerability requires no authentication and no user interaction beyond triggering the extraction path.

Root Cause

The root cause is missing enforcement of a decompression size limit. The extraction loop did not maintain a running total of bytes written and did not compare that total against any configured ceiling. The fix in commit 28faf107b64374fa5a02bfb93aa2024e281ca97b adds a max_extract_size parameter and raises DecompressionBombError when the threshold is exceeded.

python
# Source: https://github.com/miurahr/py7zr/commit/28faf107b64374fa5a02bfb93aa2024e281ca97b
# py7zr/exceptions.py - New exception added by the patch
class DecompressionBombError(ArchiveError):
    """Exception raised when decompressed size exceeds the configured limit."""

    pass

Attack Vector

Exploitation requires the target to decompress an attacker-supplied .7z file. Delivery channels include email attachments, upload endpoints, artifact repositories, backup ingestion, and any automated py7zr consumer. The attacker only needs to place a small, highly compressible payload such as long runs of null bytes inside a 7z container.

python
# Source: https://github.com/miurahr/py7zr/commit/28faf107b64374fa5a02bfb93aa2024e281ca97b
# py7zr/__init__.py - Import updated to expose new exception
from py7zr.exceptions import Bad7zFile, DecompressionBombError, DecompressionError, PasswordRequired, UnsupportedCompressionMethodError

Detection Methods for CVE-2026-55195

Indicators of Compromise

  • Sudden memory or disk exhaustion on hosts running Python processes that import py7zr
  • .7z files with extreme compressed-to-decompressed size ratios, for example under 20 KB compressed but decompressing to tens of megabytes or more
  • Repeated MemoryError, OSError: No space left on device, or OOM-killer events tied to Python workers handling archive uploads

Detection Strategies

  • Inventory Python environments for installed py7zr versions using pip show py7zr or Software Composition Analysis tooling and flag any version below 1.1.3
  • Add pre-extraction inspection that samples archive header metadata and rejects files whose declared uncompressed size exceeds a policy limit
  • Instrument extraction code paths to log the ratio of input bytes to decompressed bytes and alert when it exceeds a configured threshold

Monitoring Recommendations

  • Monitor process-level RSS and disk usage for services that call py7zr.SevenZipFile.extractall() and alert on rapid growth
  • Enable audit logging on file-upload endpoints capturing filename, size, and content hash for correlation during incident response
  • Track exceptions of type DecompressionBombError after upgrading to identify probing attempts

How to Mitigate CVE-2026-55195

Immediate Actions Required

  • Upgrade py7zr to version 1.1.3 or later in all environments, including containers, CI runners, and serverless packages
  • Rebuild and redeploy any application artifacts that vendor py7zr as a transitive dependency
  • Pass an explicit max_extract_size value in code paths that decompress untrusted archives
  • Restrict who can submit archives to processing pipelines using authentication and rate limits

Patch Information

The fix is available in py7zr v1.1.3. Commit 28faf107b64374fa5a02bfb93aa2024e281ca97b introduces the DecompressionBombError exception and the max_extract_size guard. Refer to the GitHub Security Advisory GHSA-gjrg-mpp7-g774 and the GitHub Release v1.1.3 notes for details.

Workarounds

  • Enforce a maximum input file size at the application boundary before invoking py7zr
  • Run extraction inside a sandbox with strict cgroup memory and disk quotas so an oversize decompression fails safely
  • Scan archives with a separate tool that reports uncompressed size and reject files exceeding a policy threshold
  • Isolate archive-processing workers on dedicated hosts to prevent resource exhaustion from affecting other services
bash
# Upgrade py7zr to the patched release
pip install --upgrade 'py7zr>=1.1.3'

# Verify the installed version
python -c "import py7zr; print(py7zr.__version__)"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.