GHSA-7XFQ-P2XF-2PGW
rm -r: --preserve-root bypassed for a bind mount of "/"
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 0.12.0 | coreutils · -49 d desde divulgación | |
| Divulgación | Publicada | GHSA-7XFQ-P2XF-2PGW divulgada · CVSS 6.6 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
uutils `rm -r` decides "is this the root filesystem?" with a string identity test: only a literal `/` or a path whose `canonicalize()` result equals `/` is protected. A bind mount of `/` is a real directory (not a symlink, no cycle), so it shares `st_dev`/`st_ino` with `/` yet `canonicalize()` returns the mountpoint path itself, the check never matches, and `--preserve-root` (on by default) is silently bypassed.
The bind mount capability is not trivial. But I find there is an explicit `Privilege-boundary violations` section in SECURITY.md, which should make the issue in scope of report.
### Details
the line numbers are based on commit `1a367403`. But I've checked the tag `0.10.0` version and the logic is similar.
- `src/uu/rm/src/rm.rs:761-773` `is_root_path`: only tests whether the path is literally `/` or canonicalizes to `/`.
PoC
mount --bind / /tmp/rootcopy
rm -r /tmp/rootcopy Tested on a ubuntu server. The former `rm` is default GNU one. The later `/home/ubuntu/rm` is compiled from the repo.
root@VM-0-5-ubuntu:~# mount --bind / /tmp/rootcopy
root@VM-0-5-ubuntu:~# rm -r /tmp/rootcopy/
rm: it is dangerous to operate recursively on '/ tmp/rootcopy/' (same as "/')
rm: use --no-preserve-root to override this failsafe
root@VM-0-5-ubuntu:~# /home/ubuntu/rm -r /tmp/rootcopy/
rm: cannot remove '/tmp/rootcopy/dev': Device or resource busy
rm: cannot remove '/tmp/rootcopy/tmp/rootcopy': Device or resource busy
rm: remove write-protected regular file '/tmp/rootcopy/etc/machine-id'? ^C
bash: history: /root/ bash_history: cannot create: No such file or directory### Impact
Bypass of a documented safety guard leading to destructive operation
### Credit
SecBuddyF - Tencent KeenLab (@KeenSecurityLab https://github.com/KeenSecurityLab)
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.12.0 | -49 d | 0.12.0 no afectada |
0.12.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-7xfq-p2xf-2pgwLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
