By Omar Yang (Senior Threat Researcher, Automotive)
In a recent revelation by the Google security researcher Tavis Ormandy, a critical vulnerability has been exposed within AMD’s Zen 2 microarchitecture. Dubbed Zenbleed, this vulnerability poses a substantial threat, potentially leading to the leakage of sensitive data at the remarkably fast rate of 30 kbps per core. The rapid exfiltration rate of data, including keys and passwords, could occur without detection, making it an urgent security issue. Officially designated as CVE-2023-20593, this vulnerability can be triggered remotely, heightening the urgency for mitigation measures.
The vulnerability comprises two main components: a speculative execution that erroneously rolls back and a mishandled register-clearing process. To aid in the comprehension of the gravity of this vulnerability, we first tackle how modern CPUs operate, especially the sophisticated mechanisms that could inadvertently give rise to such a security flaw. Additionally, we explore the implications of this vulnerability for automotive systems, shedding light on potential security concerns faced by automotive OEMs and experts.
In modern CPUs, besides executing independent instructions in parallel, there are techniques for dependent instructions, such as branches. By predicting the most likely condition and executing instructions in advance, a CPU can avoid waiting for the conditional operation to be carried out, effectively reducing the time required to complete a task. This performance optimization mechanism is called “speculative execution” or “branch prediction.”
However, it’s important to acknowledge that branch prediction is merely a prediction and is not guaranteed to be infallible. Occasionally, the prediction might be incorrect, leading to the need for the CPU to backtrack and execute a different set of instructions. Here lies a potential security concern: What if reverting from a mispredicted branch inadvertently exposes the data of another register? In such cases, sensitive data from one register could be inadvertently exposed because of the CPU’s speculative execution and branch prediction mechanisms.
How Zenbleed works
The register affected by Zenbleed is known as YMM and it plays a critical role in various fundamental operations frequently performed by a CPU. These operations include calculating the length of a string or copying a block of memory to a different location. Unlike fixed memory locations, registers don’t have a permanent physical location. Instead, they’re managed through a register allocation table (RAT), which keeps track of the locations to which registers point.
Figure 1. A register allocation table (left) and a physical register file (right)
Image adapted from Zenbleed
When a CPU executes an instruction to “clear the register” speculatively, it doesn’t necessarily set all bits to zero; it merely flags the register as zero in the RAT. However, if this speculative execution is later mispredicted, the CPU will revert by simply unsetting the zero flag and pointing the register back to its original location. The issue arises because the original location might have been occupied by another register, as registers are not bound to fixed physical locations.
Figure 2. How a register might still be accessible even after “clearing it”
Image adapted from Zenbleed
As Ormandy has pointed out, precise scheduling can lead to some processors recovering from a mispredicted “vzeroupper” instruction, which works as a clearing operation for the upper part of a register, incorrectly. This incorrect recovery can cause sensitive data stored by other registers to “bleed” into the attacked YMM register.
How Zenbleed could impact the automotive industry
To understand the potential impact of the Zenbleed vulnerability on the automotive industry, it’s important to delve into the architecture of modern vehicles. With the increasing prevalence of advanced features such as advanced driver assistance systems (ADASs), there is a growing reliance on powerful CPUs and GPUs to handle the complex computations required for these functionalities. AMD, as an example, recently introduced its automotive digital cockpit solution, which is likely to be adopted by certain automotive manufacturers.
Consequently, vehicles equipped with affected AMD chipsets are also susceptible to the Zenbleed vulnerability. For instance, a news report from November 2021 revealed that Tesla made a switch from Intel to AMD chips for its Model Y vehicles in China. As a result, Tesla’s Model Y could also be exposed to the Zenbleed vulnerability.
Furthermore, what makes Zenbleed particularly concerning is its ability to bypass the isolation provided by virtualization technology in modern vehicles. Many modern vehicles use virtual machines or containers to isolate different operating systems and manage various tasks effectively. However, Zenbleed can transcend these isolation measures, rendering them ineffective in preventing data leakage. It’s worth noting that the type of operating system running in a vehicle, be it Windows or Linux, does not impact the vulnerability. Zenbleed could cause password leakage on any Zen 2 microarchitecture, regardless of the underlying operating system.
Zenbleed indeed poses significant security risks for vehicles employing the affected AMD Zen 2 CPUs as their core processors. As this vulnerability has the potential to facilitate data exfiltration of sensitive information, including passwords and tokens, it could compromise the security and privacy of both vehicles and their users.
Understanding the inner workings of the YMM register and the challenges related to speculative execution and misprediction is crucial for automotive OEMs and security experts. They must be vigilant about Zenbleed’s potential security risks arising from automotive systems that use affected AMD processors. Implementing appropriate measures to mitigate the vulnerability is essential to ensuring the security and integrity of automotive systems in the face of modern CPU vulnerabilities like Zenbleed.
Mitigation of the Zenbleed vulnerability is crucial to safeguarding the security of affected systems. Given that CPU hardware cannot be patched by altering the CPU circuitry, alternative solutions are needed. In its latest security bulletin, AMD recommends applying a microcode update to address the issue. AMD has also published release timelines for other affected chipsets, with the target availability starting from October this year.
Automotive OEMs whose vehicles are equipped with the affected AMD CPUs can apply the firmware patch through over-the-air (OTA) updates or recalls, depending on the vehicles’ specific software update mechanisms.
In cases where applying the microcode update is not feasible, Ormandy recommends a software workaround: setting the “chicken bit” DE_CFG. However, it’s important to consider that this workaround comes at a cost: Applying the software vulnerability fix might result in reduced performance due to the nature of the vulnerability’s origin in performance optimization techniques.
To read more research on other possible vulnerabilities in connected vehicles and learn best security practices, visit our resource center.