A vulnerability (CVE-2021-4122) has been identified in the Cryptsetup package used for encrypting disk partitions in Linux, which allows disabling encryption in LUKS2 (Linux Unified Key Setup) partitions through metadata modification. To exploit this vulnerability, an attacker must have physical access to the encrypted device, making this method primarily applicable to attacks on encrypted external drives, such as Flash drives, to which the attacker has access but does not know the decryption password.
The attack is applicable only to the LUKS2 format and is related to manipulating metadata responsible for activating the 'online reencryption' extension, which enables on-the-fly data re-encryption without halting operations on the partition when a key change is necessary. Since the decryption and re-encryption process with a new key takes a considerable amount of time, 'online reencryption' allows users to continue working with the partition while gradually re-encrypting data from one key to another. There is also the option to choose an empty target key, which allows the partition to be converted to an unencrypted state.
An attacker can alter the LUKS2 metadata to simulate an accidental interruption of the decryption operation due to a failure, thereby achieving the decryption of part of the partition after the modified device is activated and used by the owner. At this time, the user who connects the modified device and unlocks it with the correct password does not receive any warning about the recovery process of the interrupted re-encryption operation and may only learn about the progress of this operation using the 'luks Dump' command. The amount of data the attacker can decrypt depends on the size of the LUKS2 header, but with the default size (16 MiB), it can exceed 3 GB.
A probléma abból adódik, hogy bár a visszaszerkesztéshez új és régi kulcsok hash-kódjának kiszámítása és ellenőrzése szükséges, a visszafejtés megkezdéséhez nem szükséges hash, ha az új állapot az adat titkosításának hiányát jelenti (plaintext). Továbbá a LUKS2 metaadatok, amelyek meghatározzák a titkosítási algoritmust, sérülékenyek a módosítással szemben, ha illetéktelen kezekbe kerülnek. Az sérülékenység blokkolása érdekében a fejlesztők további védelmet adtak a LUKS2 metaadatokhoz, amelyek mostantól további hash-ellenőrzést igényelnek, amelyet ismert kulcsok és a metaadatok tartalma alapján számítanak ki, így a támadó mostantól nem tudja észrevétlenül módosítani a metaadatokat anélkül, hogy tudná a visszafejtéshez szükséges jelszót.
A tipikus támadási forgatókönyv megköveteli, hogy a támadónak lehetősége legyen többször is a tárolóra kézbe venni. Először a támadó, aki nem ismeri a belépési jelszót, módosításokat hajt végre a metaadatok területén, amelyek részleges adatok visszafejtését indítják el a tároló következő aktiválásakor. Ezután a tároló visszakerül a helyére, és a támadó vár arra, hogy a felhasználó csatlakoztassa, és megadja a jelszót. A felhasználó által az eszköz aktiválásakor egy háttérfolyamat indul el, amelynek során a titkosított adatok egy része visszafejtett adatokra cserélődik. Ha a támadó ezután újra a kezébe tudja venni az eszközt, az adatainak egy része visszafejtett formában lesz elérhető a tárolón.
A problémát a cryptsetup projekt karbantartója fedezte fel, és a problémát a cryptsetup 2.4.3 és 2.3.7 frissítések javították. A frissítések állapotát a következő oldalakon nyomon lehet követni: Debian, RHEL, SUSE, Fedora, Ubuntu, Arch. A sérülékenység csak a cryptsetup 2.2.0 verziótól kezdve jelentkezik, amely támogatja az 'online reencryption' műveletet. Védekezési megoldásként használható a '--disable-luks2-reencryption' opcióval való indítás.
Forrás: opennet.ru
