Spectre is a class of speculative execution CPU vulnerabilities that involve side-channel attacks, first discovered in 2017. There are multiple variants that affect modern microprocessors capable of performing branch prediction and other forms of speculative execution. On most processors, the speculative execution resulting from a branch misprediction may leave observable side effects that may reveal private data to attackers. For example, if the pattern of memory accesses performed by such speculative execution depends on private data, the resulting state of the data cache constitutes a side-channel through which an attacker may be able to extract information about the private data using a timing attack.

In addition to vulnerabilities associated with installed applications, JIT engines used for JavaScript were found to be vulnerable. A website can read data stored in the browser for another website, or the browser's memory itself.

Two Common Vulnerabilities and Exposures records related to Spectre, (bounds check bypass, Spectre-V1, Spectre 1.0) and (branch target injection, Spectre-V2), have been issued.

In early 2018, Intel reported that it would redesign its CPUs to help protect against the Spectre and related Meltdown vulnerabilities (specifically, Spectre variant 2 and Meltdown, but not Spectre variant 1). On 8 October 2018, Intel was reported to have added hardware and firmware mitigations regarding Spectre and Meltdown vulnerabilities to its latest processors. For devices that were already vulnerable, software patches were released that addressed the issue at the cost of performance. Mitigations were applied to the Linux kernel, the Windows operating system, and some vulnerable user-mode applications.

History Yukiyasu Tsunoo and colleagues from NEC showed how to attack MISTY and DES symmetric key ciphers in 2002 and 2003, respectively. In 2005, Daniel Bernstein from the University of Illinois, Chicago, reported an extraction of an OpenSSL AES key via a cache timing attack, and Colin Percival had a working attack on the OpenSSL RSA key using the Intel processor's cache. In 2013, Yuval Yarom and Katrina Falkner from the University of Adelaide showed how measuring the access time to data lets a nefarious application determine if the information was read from the cache or not. If it were read from the cache, the access time would be very short, meaning the data read could contain the private key of encryption algorithms. This technique was used to successfully attack GnuPG, AES, and other cryptographic implementations. Superseded by: (Yuval Yarom referring to the history.) In January 2017, Anders Fogh gave a presentation at the Ruhr University Bochum about automatically finding covert channels, especially on processors with a pipeline used by more than one processor core. (Fogh describing a side channel using fashioned listening to a safe while turning its wheel.)

Spectre proper was discovered independently by Jann Horn from Google's Project Zero and Paul Kocher in collaboration with Daniel Genkin, Mike Hamburg, Moritz Lipp, and Yuval Yarom. It was made public in conjunction with another vulnerability, Meltdown, on 3 January 2018, after the affected hardware vendors had already been made aware of the issue on 1 June 2017. The vulnerability was called Spectre because it was "based on the root cause, speculative execution. As it is not easy to fix, it will haunt us for quite some time."

On 28 January 2018, it was reported that Intel shared news of the Meltdown and Spectre security vulnerabilities with Chinese technology companies before notifying the U.S. government of the flaws.

On 29 January 2018, Microsoft was reported to have released a Windows update that disabled the problematic Intel Microcode fix—which had, in some cases, caused reboots, system instability, and data loss or corruption—issued earlier by Intel for the Spectre Variant 2 attack. Woody Leonhard of ComputerWorld expressed a concern about installing the new Microsoft patch.

Since the disclosure of Spectre and Meltdown in January 2018, much research has been done on vulnerabilities related to speculative execution. On 3 May 2018, eight additional Spectre-class flaws provisionally named Spectre-NG by c't (a German computer magazine) were reported affecting Intel and possibly AMD and ARM processors. Intel reported that they were preparing new patches to mitigate these flaws. Affected are all Core i Series processors and Xeon derivatives since Nehalem (2010) and Atom-based processors since 2013. Intel postponed their release of microcode updates to 10 July 2018.

On 21 May 2018, Intel published information on the first two Spectre-NG class side-channel vulnerabilities: (Rogue System Register Read, Variant 3a) and (Speculative Store Bypass, Variant 4), also referred to as Intel SA-00115 and HP PSR-2018-0074, respectively.

According to Amazon Germany, Cyberus Technology, SYSGO, and Colin Percival (FreeBSD), Intel revealed details on the third Spectre-NG variant (Lazy FP State Restore, Intel SA-00145) on 13 June 2018. It is also known as Lazy FPU state leak (abbreviated "LazyFP") and "Spectre-NG 3".

On 10 July 2018, Intel revealed details on another Spectre-NG class vulnerability called "Bounds Check Bypass Store" (BCBS), or "Spectre 1.1" (), which was able to write as well as read out of bounds. Another variant named "Spectre 1.2" was mentioned as well.

In late July 2018, researchers at the universities of Saarland and California revealed ret spec (aka "Spectre v5") and SpectreRSB, new types of code execution vulnerabilities using the return stack buffer (RSB).

At the end of July 2018, researchers at the Graz University of Technology revealed "NetSpectre", a new type of remote attack similar to Spectre v1, but which does not need attacker-controlled code to be run on the target device.

On 8 October 2018, Intel was reported to have added hardware and firmware mitigations regarding Spectre and Meltdown vulnerabilities to its latest processors.

In November 2018, five new variants of the attacks were revealed. Researchers attempted to compromise CPU protection mechanisms using code to exploit the CPU pattern history table, branch target buffer, return stack buffer, and branch history table.

In August 2019, a related speculative execution CPU vulnerability, Spectre SWAPGS (), was reported.

In July 2020 a team of researchers from TU Kaiserslautern in Germany published a new Spectre variant called "Spectre-STC" (single-threaded contention). This variant makes use of port contention in shared resources and can be applied even in single-threaded cores.

In late April 2021, a related vulnerability was discovered that breaks through the security systems designed to mitigate Spectre through use of the micro-op cache. The vulnerability is known to affect Skylake and later processors from Intel and Zen-based processors from AMD.

In February 2023, a team of researchers at North Carolina State University uncovered a new code execution vulnerability called "Spectre-HD", also known as "Spectre SRV" or "Spectre v6". This vulnerability leverages speculative vectorization with the selective replay (SRV) technique showing "Leakage from Higher Dimensional Speculation".

Mechanism Instead of a single easy-to-fix vulnerability, the Spectre white paper describes a whole class of potential vulnerabilities. They are all based on exploiting side effects of speculative execution, a common means of hiding memory latency and so speeding up execution in modern microprocessors. In particular, Spectre centers on branch prediction, which is a special case of speculative execution. Unlike the related Meltdown vulnerability disclosed at the same time, Spectre does not rely on a specific feature of a single processor's memory management and protection system, but is instead a more generalized idea.

The starting point of the white paper is that of a side-channel timing attack applied to the branch prediction machinery of modern microprocessors with speculative execution. At the architectural level documented in processor data books, any results of misprediction are specified to be discarded. However, the speculative execution may still leave side effects, such as loaded cache lines. These can then affect the so-called non-functional aspects of the computing environment later on. If such side effects, including but not limited to memory access timing, are visible to a malicious program and can be engineered to depend on sensitive data held by the victim process, then these side effects can result in such data becoming discernible. This can happen despite the formal architecture-level security arrangements working as designed; in this case, lower, microarchitecture-level optimizations to code execution can leak information not essential to the correctness of normal program execution.

The Spectre paper explains the attack in four essential steps:

First, it shows that branch prediction logic in modern processors can be trained to reliably hit or miss based on the internal workings of a malicious program. It then goes on to show that the subsequent differences between cache hits and misses can be reliably timed, such that what should have been a simple non-functional timing difference can in fact be subverted into a covert channel that extracts information from an unrelated process's inner workings. Thirdly, the paper synthesizes the results with return-oriented programming exploits and other principles with a simple example program and a JavaScript snippet run under a sandboxing browser; in both cases, the entire address space of the victim process (i.e. the contents of a running program) is shown to be readable by simply exploiting speculative execution of conditional branches in code generated by a stock compiler or the JavaScript machinery present in an existing browser. The basic idea is to search existing code for places where speculation touches upon otherwise inaccessible data, manipulate the processor into a state where speculative execution has to contact that data, and then time the side effect of the processor being faster, if its by-now-prepared prefetch machinery indeed did load a cache line. Finally, the paper concludes by generalizing the attack to any non-functional state of the victim process. It briefly discusses highly non-obvious, non-functional effects such as bus arbitration latency.

Variants Spectre Variant 1 Spectre Variant 1, also called Bounds Check Bypass, is an exploit of CPU speculative execution in conditional branches related to memory access bounds. This occurs because the CPU speculatively accesses memory with specific bounds, such as arrays, leading to a bounds bypass (out-of-bounds index access). This speculative execution happens before the CPU validates the bounds check or reverts after a misprediction occurs, resulting in a side-channel leakage.

This attack is the result of conditional branch misprediction, which causes a vulnerable processor to speculatively access out-of-bounds data before the access is validated and before any exception arises.

Spectre Variant 2

Spectre Variant 2, also called Branch Target Injection (BTI), is an exploitation of the CPU's speculative execution of indirect branches, unlike Spectre Variant 1, which is related to conditional branches. This vulnerability arises due to misprediction by the indirect branch predictor.

This vulnerability differs from Variant 1 because indirect branches are branches whose targets are unknown at compile time and need to be resolved dynamically. An attacker can poison the branch target buffer, causing the indirect branch predictor to mispredict and redirect execution to locations that the program's control flow would never legitimately reach.

Spectre Return Stack Buffer Branch History Injection Spectre based on Linear Address Masking Retbleed

Remote exploitation