
ram-wipe - Wipe RAM on shutdown and reboot

Preventing Cold Boot Attacks. Wipe RAM at shutdown to prevent information extraction from memory.
ram-wipe is a software project that aims to defend against cold boot attacks by wiping the contents of a computer's random access memory (RAM) when the computer is shut down or restarted. This software prevents attackers from accessing sensitive information that may have been stored in the RAM by erasing it entirely, attempting to make it impossible for anyone to retrieve it. ram-wipe is particularly useful for organizations that handle sensitive information and require an additional layer of protection against security breaches. By ensuring that the RAM is wiped clean after shutdown or restart, ram-wipe helps safeguard against the risks posed by cold boot attacks, thereby providing an enhanced level of security.
Introduction[edit]
Cold boot attacks are a known attack vector since at least 2008. [1] Finally in 2023, 15 years later, a mitigation for cold boot attacks, the ram-wipe package has been made available, which is easily usable on Debian, Kicksecure, perhaps other Linux distributions as well as ram-wipe could relatively easily ported to other Linux distributions and/or hardware architectures.
At least since 2011, the Linux live operating system Tails implemented wiping the ram at shutdown [2] but its memory erasure design documentation
mentions several limitations. While Tails' implementation could in theory be ported to other Linux distributions such as Debian, Fedora and others, this at time of writing has never been done.
With ram-wipe there is now a standalone wipe RAM at shutdown software solution, with very few dependencies. In principle, it can run on Debian and derivatives of Debian such as Ubuntu. It might be relatively easy for other Linux distributions to package ram-wipe because it is implemented as a dracut module and dracut is already available (or even the default) for many Linux distributions. What's missing is probably only distribution maintainer doing the usual packaging work for their distribution.
As for initramfs-tools by ram-wipe, see Status of initramfs-tools Support.
See also Differences of security-misc Wipe RAM versus Tails Memory Erasure.
Installation of ram-wipe[edit]
1. Platform specific notice.
Newer builds of Kicksecure come with dracut
by default.
2. Migrate to dracut
. [3]
It's required to migrate to dracut
if not already done.
It's also required to install systemd-cryptsetup
.
Install package(s) dracut systemd-cryptsetup
following these instructions
1 Platform specific notice.
- Kicksecure: No special notice.
- Kicksecure-Qubes: In Template.
2 Update the package lists and upgrade the system.
Click = Copy Copied to clipboard!
3 Install the dracut systemd-cryptsetup
package(s).
Using apt
command line --no-install-recommends
option is in most cases optional.
Click = Copy Copied to clipboard!
4 Platform specific notice.
- Kicksecure: No special notice.
- Kicksecure-Qubes: Shut down Template and restart App Qubes based on it as per Qubes Template Modification
.
5 Done.
The procedure of installing package(s) dracut systemd-cryptsetup
is complete.
3. Reboot.
This is to test if dracut
is functional. If the system boots normally, then everything is okay.
4. Add Kicksecure APT repository.
NOTE: Users of Kicksecure can skip this step.
1. Download the Signing Key.
Click = Copy Copied to clipboard!
2. Optional: Check the Signing Key for better security.
3. Add Kicksecure signing key.
Click = Copy Copied to clipboard!
4. Kicksecure APT repository choices.
Optional: See Kicksecure Packages for Debian Hosts and Kicksecure Host Enhancements instead of the next step for more secure and complex options.
5. Add Kicksecure APT repository.
Click = Copy Copied to clipboard!
5. Install ram-wipe
.
Install package(s) ram-wipe
following these instructions
1 Platform specific notice.
- Kicksecure: No special notice.
- Kicksecure-Qubes: In Template.
2 Update the package lists and upgrade the system.
Click = Copy Copied to clipboard!
3 Install the ram-wipe
package(s).
Using apt
command line --no-install-recommends
option is in most cases optional.
Click = Copy Copied to clipboard!
4 Platform specific notice.
- Kicksecure: No special notice.
- Kicksecure-Qubes: Shut down Template and restart App Qubes based on it as per Qubes Template Modification
.
5 Done.
The procedure of installing package(s) ram-wipe
is complete.
6. Done.
The process of installing ram-wipe has been completed.
Host vs VMs[edit]
ram-wipe is useful on the host operating system but not so much inside a VM. See also Dev/RAM_Wipe#ram-wipe_Testing_inside_a_VM.
Sample Printout[edit]
Boot Printout[edit]
Loading Linux 5.10.0-21-amd64 ... Loading initial ramdisk ... [ 1.901368] dracut-pre-udev[164]: INFO: wipe-ram-exit.sh: Skip, because wiperamexit kernel parameter is unset, OK. [ 1.937683] dracut-pre-trigger[186]: INFO: wipe-ram-exit-needshutdown.sh: normal boot... [ 3.899932] dracut-pre-pivot[355]: INFO: wipe-ram-needshutdown.sh: wiperam=force kernel parameter detected, OK. [ 3.901024] dracut-pre-pivot[355]: INFO: wipe-ram-needshutdown.sh: Calling dracut function need_shutdown to drop back into initramfs at shutdown, OK. [ 5.633977] cold-boot-attack-defense-status[600]: /usr/libexec/ram-wipe/cold-boot-attack-defense-status: INFO: Will run at shutdown, ok.
Shutdown Printout[edit]
ram-wipe Known Issues[edit]
Wipe mode is insecure (one pass with 0x00)
: This might be a textual output bug insdmem
. It might be inspired by the Gutmann method, which is an algorithm for securely erasing the contents of computer hard disk drives. Gutmann, the inventor, said quote wikipedia:
He said "In the time since this paper was published, some people have treated the 35-pass overwrite technique described in it more as a kind of voodoo incantation to banish evil spirits than the result of a technical analysis of drive encoding techniques"
- No research papers that found that RAM has to be overwritten with more than one pass exist to the knowledge of the author.
- Several passes of RAM wipe would increase the reboot/shutdown time, have no documented benefit, increase the reboot time even more and therefore make this solution unusable.
- sdmem is unmaintained upstream?
Hi, this isn't a project that I'm actually maintaining, I put it up here for archiving purposes. Its old code and likely needs a lot of work. When I get around to doing some stuff on it, I'll work support for that in, but I can't say when that will be, sorry. Will keep the issue open though since its a good suggestion.
- If
memtest86+
feature request kexec into memtest86+ for RAM Wipe and reboot/poweroff - Cold Boot Attack Defense
would get implemented, this would provide a much better tool for wiping the RAM than
sdmem
.
[FAILED] Failed to start dracut pre-udev hook.
: This is happening becausesdmem
during the dracut pre-udev hook gets killed by Linux's out of memory (OOM) killer because it is using the maximum of available RAM.sdmem invoked oom-killer
: similar to above.- The output by
sdmem
, its progress meter and the OOM killing looks unnecessarily scary and is user unfriendly. - In VirtualBox, newly kexec'd kernel that runs a second RAM wipe pass (2/2) does not show any output. This is non-ideal but only a small issue since ram-wipe does not need to be used inside VMs anyhow except for testing. The RAM wipe functionality during shutdown and after kexec can be confirmed using a serial console. On real hardware, this issue did not occur yet.
- Wiping the video RAM (the RAM of the graphics card) has not been implemented anywhere to the knowledge of the author. [5]
- ram-wipe security testing has yet to be done, see ram-wipe development TODO. Check back later.
- While dracut bug dracut should unmount the root encrypted disk
cryptsetup luksClose
during shutdownis independent from ram wipe, might affect negatively the RAM wiping process.
- Unmounting the root encrypted disk is important for RAM wipe at shutdown to make sure (or at least increase chances) of Linux releasing the LUKS disk encryption key from RAM.
- ram-wipe comes with code
to notify the user of this situation should it apply to the user's system.
- The user would be able to read
wipe-ram.sh: There are still mounted encrypted disks! RAM wipe incomplete!
. - In result this means that the first RAM wipe pass (1/2) during poweroff/reboot might not wipe the root disk's full disk encryption key from RAM. Hopefully it would be wiped from RAM after kexec into a new kernel and the second RAM wipe pass (2/2).
- Obviously it would be much better if dracut would cleanly unmount the root encrypted disk.
- This will likely be fixed in Debian
trixie
thanks todracut-ng
.
Development[edit]
- Cold Boot Attack Defense - RAM Wipe Design Documentation
- Is RAM Wipe possible? Cold Boot Attack Defense
Footnotes[edit]
- ↑
https://en.wikipedia.org/w/index.php?title=Cold_boot_attack&oldid=249088610
- ↑
https://web.archive.org/web/20110423165633/https://tails.boum.org/contribute/design/memory_erasure/
- ↑
Since ram-wipe is unavailable for
initramfs-tools
the user needs to migrate todracut
, the only supported initrd creator by ram-wipe. - ↑
- Cause of issue: Package
systemd-cryptsetup
not being installed. - Workaround: In case of broken boot: Setting kernel parameter
rd.auto
might help. - Bug reports and pull requests:
- dracut: generic initrd does not work with encrypted root FS without further configuration
- unbootable system after installing dracut on a standard Debian installation - #2
- Generic initrd does not work with encrypted root FS without further configuration
- fix(crypt): Encrypted root FS handling with generic initrd #2520
(abandoned pull request for dracut)
- fix(systemd-crypt): add potentially needed modules to generic initrd #319
- fix(crypt): unlock encrypted devices by default during boot #320
- revert(crypt): do not unlock encrypted devices by default during boot #529
- fix(crypt): Encrypted root FS handling with generic initrd #2520
- https://forums.whonix.org/t/replacing-initramfs-tools-with-dracut/4487/23
- dracut: generic initrd does not work with encrypted root FS without further configuration
- Cause of issue: Package
- ↑
Erase video memory on shutdown

We believe security software like Kicksecure needs to remain Open Source and independent. Would you help sustain and grow the project? Learn more about our 12 year success story and maybe DONATE!