GHSA-H85F-WCQC-8JF9
cp: a symlinked destination is followed (no O_NOFOLLOW), writing outside the destination tree
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 0.10.0 | uu_cp · -3 d desde divulgación | |
| Divulgación | Publicada | GHSA-H85F-WCQC-8JF9 divulgada · CVSS 5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
During a recursive copy, uutils treats a destination subdirectory that is actually a symlink as an existing directory (path-based `.exists()` at `copydir.rs:282`) and writes through it, instead of refusing as GNU does (GNU follows destination directory symlinks only under `--keep-directory-symlink`).
Verified: with `dst/hooks -> outside` preexisting, `cp -a src/. dst` wrote `src/hooks/*` into the off-tree `outside/`; GNU did not.
Impact: an attacker who can pre-place a symlink in a destination tree can redirect a privileged recursive `cp` to write attacker-influenced content outside the intended destination. Fix: detect destination subdirectory symlinks via `symlink_metadata()` and refuse (or honor `--keep-directory-symlink` semantics like GNU).
Same root cause, single-file data-write open: every `cp` platform copy hardcodes `create_dest_restrictive(dest, false)` (`src/uu/cp/src/platform/linux.rs`, `other_unix.rs`), so the destination is opened without `O_NOFOLLOW`; `mv` correctly passes `true` (`src/uu/mv/src/mv.rs:1311`), and `safe_copy.rs` documents the risk. Reported separately as draft GHSA-95x2-59mg-f69w (no CVE) — a duplicate of this finding.
---
_Source: Cantina audit (2026-05-03). Independently verified 2026-05-30 against uutils/coreutils `e0ad63471` with a sandboxed PoC; GNU coreutils 9.7 used as control. See cantina-report/VERIFICATION-2026-05-30.md._
Fix
Fixed in 0.10.0 (released 2026-08-05), commit `e05072e26`, https://github.com/uutils/coreutils/pull/13624 (merged 2026-07-28).
Root cause: `copy_direntry` tested the destination with `exists()`, which resolves symlinks, so a destination entry that was itself a symlink to a directory looked like an already-existing directory and was descended into.
Re-confirmed on `0.9.0-575-g0d02663c6`:
$ mkdir -p src/hooks dst outside && echo PAYLOAD > src/hooks/evil
$ ln -s "$PWD/outside" dst/hooks
$ cp -a src/. dst
GNU 9.10 : cp: cannot overwrite non-directory 'dst/./hooks' with directory 'src/./hooks' (exit 1)
uutils : exit 0 -- outside/evil == PAYLOAD, escaped the destination treeThe fix treats a symlink at the destination as the non-directory it is, matching GNU. A symlinked directory named as the *target* itself stays allowed; only entries discovered inside the tree are refused. Both behaviours are pinned by tests.
Correction affecting the related draft GHSA-vwj2-hp86-chj8
The single-file destination open (`create_dest_restrictive(dest, false)`, no `O_NOFOLLOW`) is not part of this defect. Measured against GNU 9.10:
$ ln -s victim/file out/dest ; cp src out/dest
GNU 9.10 : exit 0 -- victim/file == NEW (writes through the symlink)
uutils : exit 0 -- victim/file == NEW (identical)Following a symlinked file destination is GNU's documented behaviour, which is why `cp` passes `nofollow = false` while `mv` passes `true`. Flipping the flag would be a GNU-compatibility regression, not a fix.
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 |
|---|---|---|---|---|
crates.iouu_cp |
Corregida | 0.10.0 | -3 d | 0.12.0 no afectada |
0.10.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/uutils/coreutils/security/advisories/GHSA-h85f-wcqc-8jf9Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
