GHSA-6C4J-6PGG-XGG8
uutils mv cross-device fallback retains setuid/setgid bits when ownership cannot be preserved
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 0.10.0 | coreutils · -39 d desde divulgación | |
| Divulgación | Publicada | GHSA-6C4J-6PGG-XGG8 divulgada · CVSS 3.3 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
`mv` in uutils/coreutils can retain setuid/setgid bits on the destination during the cross-device single-file fallback. When `rename(2)` returns `EXDEV`, uutils falls back to copy+ownership+permissions logic. The fallback attempts to preserve ownership best-effort, ignores failure, and then applies the full source mode including `04000`/`02000`.
For an unprivileged user moving a readable root-owned setuid/setgid file across a filesystem boundary, ownership cannot be preserved, so the destination remains owned by the moving user. uutils still applies the full source mode, leaving a mover-owned destination with setuid/setgid bits retained. GNU `mv` and fixed uutils `cp` strip these bits when ownership cannot be preserved.
Details
Affected component:
src/uu/mv/src/mv.rs::rename_file_fallback()Vulnerable behavior:
let _ = preserve_ownership(from, to);
let _ = dst_file.set_permissions(Permissions::from_mode(src_mode));`src_mode` includes `0o6000`. `preserve_ownership()` can fail for an unprivileged mover, but the code does not track that failure before applying the final mode.
Sibling differential:
- uutils `cp` already strips `setuid|setgid` when ownership could not be preserved;
- GNU `mv` strips the same bits in this scenario;
- uutils `mv` does not.
PoC
See `poc_mv_setuid.sh` and `POC_RUN_LOG.txt`.
The PoC performs cross-device single-file moves as an unprivileged user. The vulnerable binary retains `4755`, `2755`, and `6755` on the user-owned destination. GNU `mv` and the patched negative control strip those bits to `0755`.
Impact
Bounded local improper permission preservation. This is not a direct privilege escalation, because the destination remains owned by the mover; however, it violates the expected safety rule that setuid/setgid bits should not survive when ownership was not preserved. It can break local security-policy and audit invariants, especially in privileged backup, migration, packaging, or staging workflows.
Fix
Fixed by `37b1d11d0f56b48f912ad6336a28c98601dd95a1` https://github.com/uutils/coreutils/commit/37b1d11d0f56b48f912ad6336a28c98601dd95a1
("mv: strip setuid/setgid when the cross-device copy cannot preserve ownership"),
PR #13675 https://github.com/uutils/coreutils/pull/13675, merged 2026-08-03.
First released in 0.10.0; `<= 0.9.0` is affected.
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.iocoreutils |
Corregida | 0.10.0 | -39 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-6c4j-6pgg-xgg8Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
