llamaCVEVulnerability Intelligence
/
Advisory · GitHub · crates.io · uu_mv

GHSA-MCRJ-CQRC-M6RH

`mv --backup=simple` safety guard fails open when operands are spelled differently, silently destroying the source

Parche disponible
Descargar PNG JSON
CVSS 3.1
2.8
Baja
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche a -2 d de la divulgación
Exposición105 dDesde la divulgación, 7 ago 2026, 6:19 p. m.
Detección105 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir
Remediar en la ventana regular de mantenimiento
Estimación de Llama con el árbol SSVC de CISA a partir de vector CVSS 3.1 y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico parcial. Hay versiones corregidas disponibles.
Hasta mi siesta tiene más impacto.Relájate, esto es más bajo que mi siesta.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Modificada
Explotación
Remediación
Parche 0.10.0
Monitoreo
Detectada +1
5 ago 26
7 ago 26
8 ago 26
21 nov 26
5 ago 26
1 sept 26
28 sept 26
25 oct 26
21 nov 26
FechaFaseEventoDetalle
Remediación Parche 0.10.0 uu_mv · -2 d desde divulgación
Divulgación Publicada GHSA-MCRJ-CQRC-M6RH divulgada · CVSS 2.8 (GitHub)
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

`mv --backup=simple` is supposed to refuse an operation when creating the destination's backup would overwrite the source file. The guard compares the two operands as path strings byte-for-byte instead of comparing file identity, so it does not fire when the same files are named using different spellings — `a~` versus `./a`, relative versus absolute, and so on. `mv` then destroys the source file and exits 0 with no diagnostic. GNU coreutils refuses every such case with a non-zero exit and an error.

Per `SECURITY.md` this is both a bypass of a documented safety guard and an unintended destructive action — a divergence from GNU where the check "fails open" instead of erroring.

Details

The guard is `src/uucore/src/lib/features/backup_control.rs:485`, called from `src/uu/mv/src/mv.rs:368`:

pub fn source_is_target_backup(source: &Path, target: &Path, suffix: &str) -> bool {
    let source_filename = source.as_os_str();
    let mut target_backup_filename = target.as_os_str().to_owned();
    target_backup_filename.push(suffix);
    source_filename == target_backup_filename
}

It appends the suffix to the destination path and compares the result to the source path as raw bytes. `"a~" != "./a" + "~"`, so the guard is skipped even though both operands name the same files. It fires only when both operands happen to use the same spelling style:

| source | destination | result |
|---|---|---|
| `a~` | `a` | exit 1 — guard fires |
| `./a~` | `./a` | exit 1 — guard fires |
| `$PWD/a~` | `$PWD/a` | exit 1 — guard fires |
| `a~` | `./a` | exit 0 — data lost |
| `./a~` | `a` | exit 0 — data lost |
| `$PWD/a~` | `a` | exit 0 — data lost |
| `a~` | `$PWD/a` | exit 0 — data lost |
| `a~` | `../sub/a` | exit 0 — data lost |

The protected cases are the ones typed by hand. The unprotected ones are what scripts generate, where one path is typically a variable (`$PWD`, `realpath`, `find` output) and the other a literal.

Suggested fix. `cp` already does this correctly — `src/uu/cp/src/cp.rs:2121`:

let backup_path = backup_control::get_backup_path(options.backup, dest, &options.backup_suffix);
if let Some(backup_path) = backup_path {
    if paths_refer_to_same_file(source, &backup_path, true) {
        return Err(translate!("cp-error-backing-up-destroy-source", ...).into());
    }
    ...
}

It computes the backup path with `get_backup_path` and decides with `uucore::fs::paths_refer_to_same_file`, so `cp` handles every spelling in the table.

PoC

Verified on:

  • 0.9.0, release tag `840c36d` (2026-05-29) — the latest release
  • `main` tip `f66e155d80df3d82798324726e460675a02c5cd5` (2026-07-27) — guard source unchanged between the two

Ubuntu 24.04.2 LTS, Linux 6.8.0 x86_64, ext4. Console output captured with `LANG=C`.

No special configuration. Default build, no environment variables, any filesystem — the defect is pure path-string logic and so is filesystem- and platform-independent. The only requirement is `--backup=simple` (or `-b` with the default suffix) and a source named `<destination><suffix>`.

$ cd "$(mktemp -d)"
$ : > a                     # destination, empty
$ echo payload > a~         # source, holds the only copy of the data

$ mv --backup=simple a~ ./a ; echo "exit=$?"
exit=0

$ ls
a
$ cat a

`payload` no longer exists anywhere.

The literal spelling is correctly refused:

$ mv --backup=simple a~ a ; echo "exit=$?"
mv: backing up 'a' might destroy source;  'a~' not moved
exit=1

Both GNU coreutils 9.7 and 9.11 refuses both forms:

$ mv --backup=simple a~ ./a ; echo "exit=$?"
mv: backing up './a' might destroy source;  'a~' not moved
exit=1
Impact

For `mv --backup=simple a~ ./a`:

  1. The destination's backup is created: `rename("a", "a~")` — this overwrites the source.
  2. The move proceeds: `rename("a~", "a")` — but `a~` now holds the destination's old contents.

The destination ends up unchanged, the source is gone, and the exit status is 0. The operation reports success while doing the opposite of what was requested.

Because the exit code is 0, defensive idioms provide no protection:

mv --backup=simple "$backup" "$target" || rollback   # rollback never runs
set -e; mv --backup=simple "$backup" "$target"       # never aborts

Concrete case:

mv --backup=simple sshd_config~ ./sshd_config
# exit 0, reported as success
# live file unchanged; the known-good copy destroyed

If the live file had been modified, the operator believes it was restored, the modified file is still in place, and the clean copy — often the only record of the pre-change state — no longer exists.

Security impact.

Recovery fails at the moment it is exercised. Restoring from a backup is what an operator reaches for after a file is tampered with or misconfigured. Here it leaves the suspect file live *and* consumes the known-good copy, so there is no second attempt.

Remediation automation cannot detect it. Exit 0 satisfies `|| rollback`, `set -e`, and configuration-management error handling alike, so a script records a restore that never happened and carries on — discarding a staging copy, or restarting a service to pick up a configuration that was never put in place.

The pre-change artifact is destroyed. Backup files are often the only on-disk record of a file's prior contents, and the baseline an investigator would diff against after an incident.

The guard is defeated by spelling, not privilege. A path-equivalence bypass (CWE-41): two spellings of one path are not recognised as equivalent, so a check meant to prevent destruction is skipped. No special permissions, timing, or crafted input is needed.

My Acknowledgement Information

Hongkai Chen of SEFCOM Lab at Arizona State University

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:L
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:L
NingunoBajosAltos
InteracciónUI:R
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:N
AltoBajoNinguno
IntegridadI:L
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
5.3/ 10Medio
Vector 5.3 (moderada) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida Última
uu_mv≤ 0.9.0
0.9.0
0.12.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
crates.iouu_mv
Corregida 0.10.0 -2 d 0.12.0 no afectada
Versiones corregidas0.10.0
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/uutils/coreutils/security/advisories/GHSA-mcrj-cqrc-m6rh

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.