## Summary

First disclosed in 2018, Meltdown and Spectre are hardware leveled exploits. They both apply so-called side channel attack strategies and speculative execution to gather access to otherwise protected data. While Meltdown (which mostly affected Intel hardware) grants attackers access to Kernel-level information from a user-level point of entry, Spectre allows attackers to access data from different users or programmes running on the same hardware (and affected basically every modern computer system). While read access is slow, applying these exploits in a cloud environment poses a huge threat: A program observing information and data running on the same physical device (but on different virtual machines) can slowly but surely gather confident information. Developers of the most prominent hardware and operating systems had been informed before the disclosure of the exploits, and as such, both exploits have since been fixed. It should be noted, however, that first patches were, although almost immediate, far from final and were highly criticized - performance issues and spontaneous reboots were among the most overtly criticized issues. As speculative execution is both a way to speed up processing tasks as well as it by design poses a certain uncertainty, follow-up exploits applying similar strategies still appear from time to time. Especially noteworthy is Netspectre, which does not even require local execution of malicious code. Hence, while private end users not in the cloud are not the primary target group, the theoretical destructive potential of such exploits is still very present.

## Requirements and notes

• Basically all Intel CPUs manufactered between 1995 and 2018 are vulnerable to both Spectre and Meltdown, as well as regular modern operating systems BEFORE early 2018 (which is when patches have been released).
• AMD CPUs are not suspectible to Meltdown, but they are vulnerable to Spectre. They too have since been patched.
• Patching has been done both on the level of operating systems as well as with CPU developers themselves issuing BIOS update patches.
• As mentioned before, while all operating systems and CPU brands were affected, the biggest threat lured in a cloud environment - a double hit for cloud computing companies, as the patches usually cost some performance - a hefty price for a business model based on selling performance, but one they had to pay given the severity of danger in a clouded environment with these exploits unfixed.
• It almost goes without saying, but in order for these exploits to actually amount to anything, the systems to be compromised must be connected to the internet in some way - while you theoretically could spread the malicious code among retro-enthusiasts via 3,5" floppy disks, the secretive data gathered would never leave the system in that scenario.

### Historical background

The exploits were disclosed in January 2018, and the research as well as the publication was handled by Google Project Zero, Cyberus Technology and the Technical University Graz. As developers of the largest CPU brands and operating systems had been contacted as mid 2017, the fist sets of patches were issued simultaneously, although developers of smaller Linux branches complained about receiving second-class security information. First patches seemed to come with terrible performance implications, especially for Intel systems, and in general Intel's statements around that time caused some distrust from people such as Linus Torvald. Some operating systems (or its iterations) and some hardware devices, in both cases mostly old variations, never saw any patches being deployed.

Netspectre was first documented in the late summer of 2018.

All of these exploits were disclosed without a definite account on damages already caused - they were merely the result of researchers coming to the conclusion that the existing architecture could be abused in such ways. Companies are not exactly known to disclose all the issues of their own hardware they are aware of, and neither are people who make a living off compromising other people's security, so it is unknown how many more exploits exist and how many more are currently even being employed in the wild. The most recent similar exploit at the time of this writing (early 2021) is Platypus.

After the discovery of Spectre and Meltdown, researchers have been searching for more bugs that reveal speculative data. The first Foreshadow discovery - L1 Terminal Fault - is particularly dangerous because cybercriminals can use it to Steal information in multi-tenant cloud environments. In the case of the Foreshadow Vulnerability, Intel servers are affected. Software patches have been developed to minimize the threat, but enterprises will need to take action depending on their specific situation to take action.

After Meltdown, Spectre and Foreshadow (2018), security researchers focused on fixing vulnerabilities in other parts of processors. A few months later, a new vulnerability was found, known as Microarchitectural Data Sampling (MDS) or ZombieLoad. This is a vulnerability in Intel microprocessors that can allow attackers to read or "sample" data used by other programs, containers and virtual machines in order to potentially steal sensitive information. This is especially prevalent on shared shared machines, such as public clouds.

### Description of how Spectre works

Spectre gets its name from an abuse of the SPECulative execution present in basically any modern computer: Before it is even ensured that an operation is legitimate, the CPU will - based on "experience" - potentially "speculatively" execute it immediately. The legitimacy of a command may depend on what the follow up command is, and to potentially save time once the execution proves legit, "experience" is applied to guess if that is even likely. Such "experience", of course, can be misleading if the attacker decidedly trains the branch predictor to assume as it is desirable for them. Of course, if the operation eventuall proves illegitimate, the operation itself will not be executed. However, when trying to access a restricted set of data, the results of the SPECULATIVE execution alone are reflected in the cache. The content of said cache can then be gathered using a side channel attack - piece by piece accessing data outside of the legitimate range of an object, and checking if the data is present immediately (= it is cached) or if it takes time (= it will THEN be cached).

There are two versions of Spectre - one focuses on Branch Target Injection, which can be used to execute malicious code out of order, and one on the Bounds Check Bypass, which is the bypassing of security restrictions described above.

Spectre attacks are very slow in gathering data and require local execution of malicious code in the first place. They do, however, grant read-access to data out of the current user's range of permissions.

Sample code for Spectre variant 1: Bounds Check Bypass (CVE-2017-5753):

if (x < array1_size)
y = array2[array1[x] * 4096 ];


Here, the range of an array is breached, and as a consequence, data from an entirely different address space accessed.

Sample code for Spectre variant 2: Branch Target Execution (CVE-2017-5715):

\begin{lstlisting}
class Shape {
public:
virtual void Draw() = 0;
};
class Circle : public Shape {
public:
void Draw() override { … }
};

Shape* obj = new Circle;
obj->Draw();


This uses polymorphism to "mislead" the machine to resolve the relevant address space where to store data on the fly: As it is not sure which type of object will be created at the time of compilation (due to polymorphism), this requires - again - speculative execution and addressing.

### Description of how Meltdown works

Somewhat misleading, Meltdown ALSO applies speculative execution. It does, however, also apply Intel-only escalation of privilege to "melt down" security barriers. This distinction is impactful mostly on the "internal" side, the result is however still data that data which should be confidential can be accessed by attackers. The difference as far as this goes is that Meltdown allows access of Kernel level information from a user level.

Sample code for Meltdown (CVE-2017-5754):

char val = *(char *)0xAAAAA;


As can be seen, the actual principle of the attack does NOT differ fundamentally from the one of Spectre's Bound Check Bypass: A restricted address value is accessed, this request is speculatively executed, then denied, then nonetheless accessed indirectly. Meltdown attacks, too, are very slow in gathering data and require local execution of malicious code in the first place.

### Description of how Foreshadow works

The way it works is as follows: In the L1 data cache of Intel processors, each byte of the memory byte has both a physical and a virtual address. The operating system keeps track of these addresses using special tables called "page tables". The processors spend a lot of time searching the page tables. To speed this up, they speculatively search the L1 data cache for matches before confirming the validity of the page table entry. If this is the case, the processor reports a terminal error to the operating system and discards the speculative data.

But before the error occurs, there is a small window of opportunity for malicious users to figure out the value of the data. Then they can trick the operating system to cache and steal sensitive information. Worse, cyber criminals can use this vulnerability to exploit a multi-tenant cloud environment. Here, hypervisors use page tables to allocate physical server resources to virtual machines. They can also use extended page tables to share management with these virtual machines. The problem is that a cybercriminal running a virtual machine on that server could create a malicious extended page table and trick the hypervisor into revealing secrets of other virtual machines.

### Description of how ZombieLoad works

In a real server, MDS allows an attacker to extract data from previous operations. In the same way, or through other sophisticated techniques, further partial information is merged and valuable information is stolen. MDS is possible because Intel processors are optimized to use buffers in speculative operations. There are several ways attackers can use MDS, each targeting different processor structures.

The memory buffer variant exploits how Intel processors speculatively forward data from a memory buffer entry. Intel splits data storage into two separate operations: "Store this address" and "Store this value". To improve performance, the data in the memory buffer entry is not removed. During a load operation, the memory buffer is scanned to determine if a recent save operation needs to be forwarded to the same location. If the load operation requires special support, the processor may use stale data speculatively without checking whether it is valid. This makes it possible to query the data.

### Description of how Netspectre works

Netspectre has the big distinction of NOT requiring local execution of malicious code, and instead may even target servers, which then in turn become "complicit" in gathering data for the attacker. It, again, exploits speculative execution and a "mistraining" of branch prediction. Cache accessing is performed via paket flushing the machine.

## Overview in one condensed table

Affected companies Intel, ARM, IBM, VIA AMD, Intel, ARM, IBM, VIA Intel Intel
Made public January 2018 January 2018 August 2018 May 2019
How it works Hardware based exploit;
requires local execution
of malicious code
Hardware based exploit;
requires local execution
of malicious code.
Netspectre is an offshot
which does NOT.
Hardware based exploit;
requires local execution
of malicious code
Hardware based exploit;
requires local execution
of malicious code
Applied techniques Intel privilege escalation,
speculative execution
Branch prediction / branch
target injection (variant 2),
speculative execution
(both variants)
Lazy FP state restore:
*speculative execution side channel
L1 Terminal Fault - SGX:
*side-channel analysis
L1 Terminal Fault - OS Kernel, SMM:
*terminal page fault
*side-channel analysis
L1 Terminal Fault - Virtual Machines
*terminal page fault
*side-channel analysis
MSBDS, MLPDS, MFBDS and MDSUM:
*side channel with local access
Consequences Kernel memory accesible
from user space
Memory and content of other
users and programmes becomes
accessible
Lazy FP state restore:
*Allow a local process to infer data from
another process
L1 Terminal Fault - SGX:
*May allow unauthorized disclosure of
information residing in the L1 data cache from
an enclave to an attacker with local
user access
L1 Terminal Fault - OS Kernel, SMM:
*May allow unauthorized disclosure of
information residing in the L1 data cache
to an attacker with local
user access
L1 Terminal Fault - Virtual Machines
*May allow unauthorized disclosure of
information residing in the L1 data cache
to an attacker with local
user access with guest OS privilege
MSBDS, MLPDS, MFBDS and MDSUM:
*May allow an authenticated user to
potentially enable information disclosure
Number of affected systems 1868 2816 none known so far (2018) none known so far (2019)