GHSA-5JWQ-CX34-FX6V
pyLoad tar auto-extraction preserves setuid/setgid mode bits on regular-file members (extractall without filter=)
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-5JWQ-CX34-FX6V divulgada · CVSS 7.5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
## Summary
`UnTar._safe_extractall` extracts tar archives with `tarfile.extractall(...)` and NO `filter=` argument. On pyLoad's supported Python 3.9-3.13 the implicit extraction filter is `fully_trusted`, which preserves the archive's stored mode bits — including setuid (S_ISUID) and setgid (S_ISGID) — on regular-file members. A regular-file member with mode `04755` is extracted setuid-intact. On a root-run pyLoad instance, a setuid-root binary dropped into the download tree is a local privilege-escalation primitive. This is an incomplete fix of GHSA-fr26-jjhm-638c, whose remediation (`member.isdev()`) only blocks device/FIFO member TYPES and never inspects mode bits.
## Root Cause
The GHSA-fr26-jjhm-638c fix (commit `09eec1b`) added only a `member.isdev()` check and still calls `tar.extractall(path, members, numeric_owner=numeric_owner)` at `UnTar.py:84` with no `filter=`. `_validate_archive_entries` inspects paths only; `isdev()` and the symlink checks never touch mode bits. Python's default `fully_trusted` filter (the default on 3.9-3.13; `data` is default only on 3.14+) applies stored setuid/setgid bits to extracted regular files.
## Impact
A crafted archive member of regular-file type with mode `04755`/`06777` is extracted with setuid/setgid preserved. By default `permission/change_file=False`, so the post-extract `set_permissions` does not strip the bits. On root-run pyLoad this yields a setuid-root attacker binary = local privilege escalation. Compounds with the world-writable download tree reachable via the SETTINGS `permission/*` finding.
Proof of Concept
import tarfile, os
os.chmod("pwn", 0o4755) # attacker binary, setuid
with tarfile.open("evil.tar", "w") as t:
t.add("pwn") # REGTYPE member, mode 04755
# deliver evil.tar as a pyLoad download; ExtractArchive -> UnTar.extract
# extracted 'pwn' retains 0o4755 (setuid) on Python 3.9-3.13## Attack Chain
1. Entry: deliver `evil.tar` (regular-file member `pwn`, mode `04755`) as a pyLoad download; auto-extract runs via `ExtractArchive` -> `UnTar.extract`.
- Guard: `_validate_archive_entries` (`base/extractor.py` — path only) + `member.isdev()` + `_validate_symlink_target`. Bypass proof: `pwn` is a normal file (not device/symlink/traversal) -> all guards pass; none inspects modes.
2. Sink: `_safe_extractall` -> `tar.extractall(path, members, numeric_owner=numeric_owner)` (`UnTar.py:84`), no `filter=`.
- Guard: the extraction filter. Bypass proof: on Python 3.9-3.13 the implicit filter is `fully_trusted` -> setuid/setgid preserved.
3. Impact: setuid/setgid file in the download tree; on root-run pyLoad a setuid-root binary = LPE.
## Bypass Evidence
Empirically verified: `extractall(..., filter="fully_trusted")` preserves `0o4755` (setuid) and `0o6777` (setuid+setgid); `filter="data"` strips to `0o755`. Full file history of `UnTar.py` shows `filter=` was never added. `setup.cfg` declares `python_requires >= 3.9` (supports 3.9-3.13). Dedup: GHSA-fr26-jjhm-638c covers device-node/FIFO member types; GHSA-mvwx-582f-56r7 covers path traversal (`os.path.commonprefix`); neither addresses setuid/setgid mode-bit preservation on regular files — distinct member type (REGTYPE), mechanism (mode bits), impact (direct LPE), and fix (add `filter="data"` or strip S_ISUID/S_ISGID).
## Affected Versions
`<= 0.5.0b3.dev101` (develop HEAD `1ca8737`). Unfixed; `filter=` never added. Requires the `ExtractArchive` addon enabled (default off).
## Suggested Fix
Pass `filter="data"` to `tar.extractall(...)` (strips setuid/setgid, special files, and absolute/traversal paths), or explicitly mask `S_ISUID | S_ISGID` from each extracted member's mode.
---
Reported by zx (Jace) — GitHub: @manus-use
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-5jwq-cx34-fx6vLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
