Problémák a lemezkulcsok memóriából való törlésével, amikor a Linux készenléti módba lép

A cryptsetup-suspend porting for NixOS revealed an error in the LUKS (Linux Unified Key Setup) disk encryption subsystem, which caused the encryption keys in RAM to not be cleared when the system enters sleep mode, starting from Linux kernel 6.9 (the problematic commit) released in May 2024.

The cryptsetup-suspend tool is used in Debian to automatically lock LUKS partitions before entering sleep mode. It is assumed that in the case of a stolen laptop that has entered sleep mode, the attacker will be deprived of access to the data, as a password will be required to wake it up and restore access to the encrypted data. Due to a bug in the Linux kernel, after locking a LUKS partition with the ‘cryptsetup luksSuspend’ command, the keys were not cleared from RAM and remained visible via /proc/keys, which allowed an attacker to extract them using a method like 'cold reboot' and use them to access the data.

The failure to clear the keys was discovered during debugging of a race condition that caused problems with entering sleep mode. The bug appeared after a refactoring in kernel 6.9, during which the keys were tied to the calling thread and were supposed to be removed upon its completion, but in fact remained in memory. A one-liner patch has been proposed to fix this error in the Linux kernel.

This patch has not been accepted into the kernel, as it has a shortcoming — the patch only works for physical disks and does not work for virtual loop devices. Instead of fixing the issue on the kernel side, the developers of the cryptsetup tool proposed a workaround for clearing the keys. This change has already been accepted and will be included in the upcoming release of cryptsetup 2.8.7.

In addition, a custom implementation of scripts for locking encrypted disks before entering sleep mode has been created for NixOS, which uses an old patch to the kernel that was not accepted in 2015 and forcefully clears the keys from memory before entering sleep mode.

Forrás: opennet.ru

Megbízható hosting vásárlása weboldalak számára, DDoS védelemmel, VPS VDS szerverek. 🔥 Megbízható webtárhely vásárlása DDoS védelemmel, VPS VDS szerverek | ProHoster