A new software-based fault injection attack, CacheWarp, can let threat actors hack into AMD SEV-protected virtual machines by targeting memory writes to escalate privileges and gain remote code execution.
This new attack exploits flaws in AMD’s Secure Encrypted Virtualization-Encrypted State (SEV-ES) and Secure Encrypted Virtualization-Secure Nested Paging (SEV-SNP) tech designed to protect against malicious hypervisors and reduce the attack surface of VMs by encrypting VM data and blocking attempts to alter it in any way.
The underlying vulnerability (CVE-2023-20592) was discovered by security researchers with CISPA Helmholtz Center for Information Security and Graz University of Technology and independent researcher Youheng Lue.
“CacheWarp, a new software-based fault attack on AMD SEV-ES and SEV-SNP, exploiting the possibility to architecturally revert modified cache lines of guest VMs to their previous (stale) state,” the researchers said.
“In 3 case studies, we demonstrate an attack on RSA in the Intel IPP crypto library, recovering the entire private key, logging into an OpenSSH server without authentication, and escalating privileges to root via the sudo binary.”
In successful attacks, malicious actors could, for instance, revert variables used for authentication to a previous version, enabling them to hijack a previously authenticated session. Moreover, exploiting CacheWarp enables attackers to manipulate return addresses on the stack, thereby altering the control flaw of a targeted program.
The security researchers have also published an academic paper and shared video demos on using CacheWarp to gain root privileges or bypass OpenSSH authentication.
AMD also issued a security advisory today, saying that the CacheWarp issue was found in the INVD instruction and may lead to a loss of SEV-ES and SEV-SNP guest virtual machine (VM) memory integrity.
“Improper or unexpected behavior of the INVD instruction in some AMD CPUs may allow an attacker with a malicious hypervisor to affect cache line write-back behavior of the CPU leading to a potential loss of guest virtual machine (VM) memory integrity,” AMD says.
CacheWarp affects only AMD systems with the following processors that come with SEV support:
- 1st Gen AMD EPYC Processors (SEV and SEV-ES)
- 2nd Gen AMD EPYC Processors (SEV and SEV-ES)
- 3rd Gen AMD EPYC Processors (SEV, SEV-ES, SEV-SNP)
According to AMD’s advisory, the issue does not impact AMD 4th generation ‘Genoa’ EPYC processors (Zen 4 microarchitecture).
The company says there is no mitigation for first or second generations of EPYC processors because the SEV and SEV-ES features lack protection functionality for guest VM memory, while the SEV-SNP feature is unavailable.
Nevertheless, for customers using AMD’s 3rd generation EPYC processors with the AMD Secure Encrypted Virtualization-Secure Nested Paging (SEV-SNP) feature enabled, AMD has released a hot-loadable microcode patch and updated firmware image (the patch should not result in any performance hit).