Secure Deletion of Data from Magnetic and Solid State Memory presented at the 6th Usenix Security Symposium by Peter Gutmann, one of the leading civilian cryptographers. The secure data deletion process of sdmem goes like this...
- 1 pass with 0x00
- 5 random passes. /dev/urandom is used for a secure RNG if available.
- 27 passes with special values defined by Peter Gutmann.
- 5 random passes. /dev/urandom is used for a secure RNG if available.
Bleachbit
While a tad out of fashion I still recommend using Bleachbit BleachBit deletes unnecessary files to free valuable disk space, maintain privacy, and remove junk. Rid your system of old clutter including cache, temporary files, cookies, and broken shortcuts. It wipes clean Bash, Beagle, Epiphany, Firefox, Flash, Java, KDE, OpenOffice.org, Opera, RealPlayer, rpmbuild, VIM, XChat, and more. I recommend using this in combination of sdmem by using them as a cronjob and / or systemd shutdown module.
crontab -e
@reboot env DISPLAY=:0 bleachbit --clean all
@reboot env DISPLAY=:0 sdmem
Now on reboot your systemd will run bleachbit to wipe all temp files and extra data not saved externally, then run sdmem to forcibly clear all memory
#!/usr/bin/env bash
# clean.sh
set -euo pipefail # exit on error, undefined var, or pipe failure
IFS=$'\n\t' # safe word splitting
echo "Running BleachBit"
sudo bleachbit --clean all # cleans everything BleachBit knows how to clean
echo ""
echo "Running SDMEM"
sudo sdmem
echo ""
echo "Cleanup finished."
Save the script. Make it executable (chmod +x ~/clean.sh). And make a exit script (make it executable chmod +x clean_service_stop.sh)
$ cat clean_service_stop.sh
#!/bin/bash
echo "Clean.sh exiting..."
Make a systemd module
[Unit]
Description=Clean Service
[Service]
ExecStart=/home/alice/work/clean.sh
ExecStop=/home/alice/work/clean_service_stop.sh
[Install]
WantedBy=multi-user.target
The ExecStart option in the Service section of the unit file specifies the path of the script that systemd runs as a service. The ExecStop option in the Service section, on the other hand, specifies the path of the script that systemd runs while stopping the service. You can start the service by following...
$ cd /etc/systemd/system
$ sudo ln -s /home/alice/work/clean_service.service
$ sudo systemctl enable clean_service
Created symlink /etc/systemd/system/multi-user.target.wants/simple_service.service → /home/alice/work/clean_service.service.
$ sudo systemctl start clean_service
Now on shutdown systemd will run the same format as the cronjob above. Using this in combonation with an encrypted USB to save all files, a removable disk to hold your operating system files, and now with a secure disk / memory wipe. You data is now secure from cold boot attacks.
Smartphones
The cold boot attack can be adapted and carried out in a similar manner on Android smartphones. A cold boot can be performed by disconnecting the phone's battery to force a hard reset or holding down the power button. The smartphone is then flashed with an operating system image that can perform a memory dump. Typically, the smartphone is connected to an attacker's machine using a USB port. Typically, Android smartphones securely erase encryption keys from random access memory when the phone is locked. This reduces the risk of an attacker being able to retrieve the keys from memory, even if they succeeded in executing a cold boot attack against the phone.
The Future
Intel TME / AMD SME, Full memory encryption is increasingly available in consumer laptops. Once enabled, DRAM contents are automatically encrypted, making cold boot extraction impossible. AMD SEV‑ES Extends Secure Encrypted Virtualization to protect guest VMs from a compromised hypervisor, useful for cloud providers. TPM 2.0 and FIPS 140‑2 HSMs Offer stronger key protection and auditability. Quantum Safe Algorithms While not directly mitigating cold boot attacks, they reduce the risk that stolen keys become immediately exploitable.
Conclusion
Cold boot attacks demonstrate that physical access can subvert even well configured software defenses. The attack hinges on the predictable physics of DRAM and a willingness to manipulate hardware conditions. While newer CPUs now encrypt memory or keep keys in secure enclaves, many legacy systems remain vulnerable. By combining physical hardening, hardware level encryption, and robust key management practices, organizations can effectively neutralize this threat vector. For the highest assurance, treat any device that may store sensitive data as a “high risk asset” and enforce a strict Zero Trust security model. Never trust the host OS or its memory contents without hardware verification.