Summary
From the report:
An unprivileged process with filesystem access can become root during system shutdown
A local attacker can write to /run/initramfs
, because the directory permissions are unsafe. The systemd-shutdown
binary becomes PID 1 whenever the systemd poweroff
, halt
, reboot
, or kexec
target is reached. It then makes /run/initramfs
the root file system and executes /shutdown
, which further executes other programs in the shutdown tmpfs (aka exitrd
). These programs are executed with full privileges, and the original root file system is mounted at /oldroot
.
Am I affected?
Every NixOS configuration with systemd.shutdownRamfs.enable
enabled. This is the default for all NixOS installations, introduced during the NixOS 22.05 development cycle (30a00c2, 69d8047).
Patches
Patches were provided for NixOS 24.11 and Unstable. Older releases are not supported.
- NixOS unstable: make-initrd-ng: Restore stripped file permissions by ElvishJerricco · Pull Request #398396 · NixOS/nixpkgs · GitHub
- NixOS 24.11: Backport #398396: make-initrd-ng: Restore stripped file permissions by ElvishJerricco · Pull Request #398397 · NixOS/nixpkgs · GitHub
Workaround
Disable systemd.shutdownRamfs.enable
by setting it to false
.
Acknowledgement
Two similar issues were reported by @sudoBash4218 to the NixOS security team on 2025-03-30 and 2025-04-01. They included a root cause analysis, suggestions on how to patch these issues and a PoC exploit.