Researchers at the Helmholtz Center for Information Security (CISPA) have published a new attack method called CacheWarp, which compromises the AMD SEV (Secure Encrypted Virtualization) protection mechanism used in virtualization systems to safeguard virtual machines from interference by the hypervisor or host system administrators. This method allows an attacker with access to the hypervisor to execute arbitrary code and escalate privileges within a virtual machine protected by AMD SEV.
The attack exploits a vulnerability (CVE-2023-20592) arising from improper cache handling during the execution of the INVD processor instruction, which can lead to data inconsistencies in memory and cache, bypassing the mechanisms that maintain the integrity of virtual machine memory built on SEV-ES and SEV-SNP extensions. This vulnerability affects AMD EPYC processors from the first to the third generation.
For third-generation AMD EPYC processors (Zen 3), the issue was resolved in a microcode update released yesterday by AMD (the fix does not impact performance). For the first and second generations of AMD EPYC (Zen 1 and Zen 2), no protection is provided because these CPUs do not support the SEV-SNP extension that ensures integrity control. of virtual machinesThe fourth generation of AMD EPYC processors, "Genoa," based on the "Zen 4" microarchitecture, is not affected by this vulnerability.
AMD SEV technology is used to isolate virtual machines by cloud providers such as Amazon Web Services (AWS), Google Cloud, Microsoft Azure, and Oracle Compute Infrastructure (OCI). AMD SEV protection is implemented through hardware-level encryption of virtual machine memory. Additionally, the SEV-ES (Encrypted State) extension protects CPU registers. Only the current guest system has access to the decrypted data, while others virtual machines and the hypervisor attempting to access this memory receive an encrypted data set.
The third generation of AMD EPYC processors introduced an additional extension, SEV-SNP (Secure Nested Paging), which ensures secure operation with nested memory page tables. In addition to overall memory encryption and register isolation, SEV-SNP includes additional means to protect memory integrity, preventing the hypervisor from modifying the VM. Encryption key management is handled by an integrated processor component known as the PSP (Platform Security Processor), based on ARM architecture.
The essence of the proposed attack method lies in using the INVD instruction to invalidate blocks (lines) in the cache of dirty pages without writing back accumulated data in the cache to memory. This method allows the eviction of modified data from the cache without altering the memory state. To execute the attack, it is suggested to use software exceptions (fault injection) to interrupt the operation of the virtual machine at two points: in the first instance, the attacker invokes the ‘wbnoinvd’ instruction to flush all cached write operations to memory, and in the second instance, invokes the ‘invd’ instruction to revert unreleased write operations to their previous state.
To test their systems for vulnerabilities, a prototype exploit has been published that allows for exception injection into a VM protected by AMD SEV, and to roll back unsaved changes in the VM to a previous state. This rollback can be used to alter the program's execution flow by reverting to an old return address on the stack, or to utilize parameters from a previous session for which authentication had already been performed, by returning the authentication flag value.
For example, researchers demonstrated the possibility of using the CacheWarp method to conduct a Bellcore attack on the RSA-CRT algorithm implementation in the ipp-crypto library, allowing the recovery of the private key through error substitution during digital signature computation. It was also shown how to replace session verification parameters with OpenSSH when remotely connecting to a guest system, and then modify the verification state while running the sudo utility to gain root privileges in Ubuntu 20.04. The exploit was tested on systems with AMD EPYC 7252, 7313P, and 7443 processors.
Source: opennet.ru
