Difference between revisions of "Meltdown, Spectre, Foreshadow, ZombieLoad and related exploits"

From Embedded Lab Vienna for IoT & Security
Jump to navigation Jump to search
Line 21: Line 21:
=== Historical background ===
=== 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.
The exploits for Meltdown and Spectre were first disclosed in January 2018 by researchers from Google Project Zero, Cyberus Technology, and the Technical University of Graz. Developers of the major CPU brands and operating systems had been notified about the vulnerabilities in mid-2017, and the first patches were released simultaneously with the disclosure of the vulnerabilities. However, some developers of smaller Linux distributions complained about receiving second-class security information. The initial patches for these vulnerabilities were criticized for causing significant performance issues, particularly for Intel systems. Some operating systems and hardware devices, particularly older versions, never received patches to fix the vulnerabilities.


Netspectre was first documented in the late summer of 2018.
Netspectre, a variant of Spectre that does not require the execution of malicious code locally, was first documented in the late summer of 2018. It is not known how many other similar vulnerabilities exist or how many of them are being actively exploited in the wild. The most recent known exploit at the time of writing (early 2021) is Platypus.


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 continued to search for other vulnerabilities that could be exploited through speculative execution. The first discovery, known as Foreshadow or L1 Terminal Fault, is particularly dangerous because it allows attackers to steal information from multi-tenant cloud environments. In the case of Foreshadow, only Intel servers are affected. Software patches have been developed to mitigate the threat, but enterprises may need to take additional action depending on their specific situation.


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.
A few months after the discovery of Meltdown, Spectre, and Foreshadow, another vulnerability was found called Microarchitectural Data Sampling (MDS) or ZombieLoad. This vulnerability affects Intel processors and allows attackers to read or "sample" data used by other programs, containers, and virtual machines in order to potentially steal sensitive information, particularly on shared machines such as public clouds. Patches have been released to fix this vulnerability as well.
 
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 ===
=== Description of how Spectre works ===

Revision as of 10:24, 6 January 2023

Summary

Meltdown and Spectre are two hardware-level vulnerabilities that were first disclosed in 2018. Both vulnerabilities exploit a technique called speculative execution, which is used to speed up processing tasks, to gather access to protected data. Meltdown, which mainly affected Intel hardware, allows attackers to gain access to kernel-level information from a user-level point of entry. Spectre, on the other hand, allows attackers to access data from other programs or users running on the same hardware, which is virtually every modern computer system. While these exploits are slower to execute when it comes to reading data, they can be particularly dangerous in a cloud environment, where an attacker can gather sensitive information by observing data and programs running on the same physical device but on different virtual machines. Developers of the most popular hardware and operating systems were informed about these vulnerabilities before they were publicly disclosed, and patches were released to fix them. However, the initial patches were not without their problems, and were criticized for causing performance issues and spontaneous reboots. Despite the fixes, new exploits that use similar techniques to Meltdown and Spectre continue to emerge. One notable example is Netspectre, which doesn't even require the execution of malicious code locally to be effective. While private end users are not the primary target for these kinds of exploits, their theoretical destructive potential should not be underestimated. Foreshadow and ZombieLoad are two additional vulnerabilities that were discovered after Meltdown and Spectre. Foreshadow, also known as L1 Terminal Fault (L1TF), is a vulnerability that affects Intel processors and allows attackers to access sensitive data stored in the processor's Level 1 cache, which is usually protected. Foreshadow can be used to steal sensitive information such as passwords, encryption keys, and personal data from the operating system, virtual machines, and trusted execution environments. ZombieLoad, also known as Microarchitectural Data Sampling (MDS), is a set of vulnerabilities that affect Intel processors and allow attackers to access sensitive data stored in the processor's microarchitecture, such as the data being processed by the CPU. ZombieLoad can be used to steal sensitive information such as passwords, encryption keys, and personal data from the operating system, virtual machines, and trusted execution environments. Both Foreshadow and ZombieLoad can be exploited through side-channel attacks, similar to Meltdown and Spectre.


Requirements and notes

  • The vulnerabilities exploited by Meltdown and Spectre were present in virtually all Intel CPUs manufactured between 1995 and 2018, as well as in modern operating systems before early 2018, when patches were released to fix the vulnerabilities.
  • AMD CPUs are not vulnerable to Meltdown, but they are susceptible to Spectre. Patches have also been released for AMD CPUs to address the Spectre vulnerability.
  • In order to fix these vulnerabilities, patches have been released by both operating system developers and CPU manufacturers in the form of BIOS updates.
  • As mentioned before, the biggest threat posed by Meltdown and Spectre was in a cloud environment, where the vulnerabilities could be exploited to access sensitive data from multiple users or programs running on the same physical hardware. This posed a double threat for cloud computing companies, as the patches required to fix the vulnerabilities often resulted in a reduction in performance, which could be costly for a business model that relies on selling performance.
  • It is important to note that in order for these vulnerabilities to be exploited, the affected systems must be connected to the internet in some way. While it is theoretically possible to spread malicious code through other means, such as 3.5" floppy disks, the data gathered through these exploits would not be able to leave the system in that scenario.

Historical background

The exploits for Meltdown and Spectre were first disclosed in January 2018 by researchers from Google Project Zero, Cyberus Technology, and the Technical University of Graz. Developers of the major CPU brands and operating systems had been notified about the vulnerabilities in mid-2017, and the first patches were released simultaneously with the disclosure of the vulnerabilities. However, some developers of smaller Linux distributions complained about receiving second-class security information. The initial patches for these vulnerabilities were criticized for causing significant performance issues, particularly for Intel systems. Some operating systems and hardware devices, particularly older versions, never received patches to fix the vulnerabilities.

Netspectre, a variant of Spectre that does not require the execution of malicious code locally, was first documented in the late summer of 2018. It is not known how many other similar vulnerabilities exist or how many of them are being actively exploited in the wild. The most recent known exploit at the time of writing (early 2021) is Platypus.

After the discovery of Spectre and Meltdown, researchers continued to search for other vulnerabilities that could be exploited through speculative execution. The first discovery, known as Foreshadow or L1 Terminal Fault, is particularly dangerous because it allows attackers to steal information from multi-tenant cloud environments. In the case of Foreshadow, only Intel servers are affected. Software patches have been developed to mitigate the threat, but enterprises may need to take additional action depending on their specific situation.

A few months after the discovery of Meltdown, Spectre, and Foreshadow, another vulnerability was found called Microarchitectural Data Sampling (MDS) or ZombieLoad. This vulnerability affects Intel processors and allows attackers to read or "sample" data used by other programs, containers, and virtual machines in order to potentially steal sensitive information, particularly on shared machines such as public clouds. Patches have been released to fix this vulnerability as well.

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

Meltdown (variant #3) Spectre (variants #1 & #2) Foreshadow ZombieLoad (MDS)
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)

References