Meltdown & Spectre Attacks on CPU Flaws

Summary

On January 3rd 2018, several hardware flaws affecting modern processors were publicly disclosed by security researchers. These flaws are exploitable by attacks nicknamed “Meltdown” and “Spectre”. Meltdown and Spectre have different potential implications and impact different CPU vendors. The “Meltdown” vulnerability allows user-space programs (such as browsers) to access memory normally restricted to the operating system’s most trusted code (the kernel). The “Spectre” vulnerability enables the bypass of application isolation by forcing an application to improperly disclose sensitive data.

These hardware bugs allow malicious applications to read virtually any in-memory data, including sensitive or secret information such as credentials, cryptographic keys, data being processed by any running program, or opened files. The vulnerabilities exploit the hardware operations of CPUs and thus are independent of the operating system. The vulnerabilities can be exploited on any modern operating system including Windows, Linux, macOS, containerization solutions (Docker, LXC, OpenVZ), and some paravirtualization hypervisors (such as Xen PV).

Meltdown and Spectre work on personal computers, mobile devices, servers, and in cloud environments. Due to the criticality of the vulnerabilities, most cloud providers received advanced notice and have already patched their host operating systems to prevent exploitation of Meltdown.

Microsoft Windows, Apple macOS, VMware, and the Linux kernel have all been updated with software mitigations that prevent the Meltdown attack. Unfortunately, it’s not possible to patch the “Spectre” attack directly via an operating system update. Some applications, such as web browsers, have been updated to mitigate the potential for malicious web pages to use the Spectre attack.

Additionally, Intel has begun to provide firmware updates for some of its processors to mitigate these attacks and expects to roll out updates for more Intel CPUs by the end of next week. All other modern processors remain vulnerable to the exploitation techniques abused by the “Spectre attack”. Kudelski Security expects other CPU vendors to issue similar firmware updates to protect against these attacks in the near future.

The US Computer Emergency Response Team (U.S CERT) had previously stated the following it’s in advisory about these issues:

“Fully removing the vulnerability requires replacing vulnerable CPU hardware.”

While the above content has since been removed from its post, it was widely reported. While the advice is generally accurate, Kudelski Security does not believe this to be a practical solution for most organizations and recommends that enterprises apply CPU firmware updates, as well as operating system and browser updates.

Description

Both attacks can effectively overcome the memory isolation barriers of modern processor architecture by abusing processor features. Modern processors attempt to reduce the amount of time they sit “idle” by using a feature called “speculative execution”. Speculative execution works by trying to guess which instructions will be run during a program’s execution ahead of time. If the guess is correct, there is a significant performance gain as useful work was done during what would have been idle time. If the guess was wrong, results of the “speculative” calculations are discarded and the right instructions are run.

Meltdown Attack (CVE-2017-5754)

The “Meltdown” exploit (CVE-2017-5754) leverages the fact that the results of “incorrect guesses” are only partially discarded and leave the results of those calculations in the processor’s cache. Meltdown works by forcing processors to perform speculative execution of malicious code before any security checks are performed. After the calculations were already performed by the “speculative execution” feature, the computer’s processor will notice the memory access violation, raise an exception, and clear the results of the calculation from the processor’s registers. However, since processors do not clear the cache when incorrect guesses are identified, Meltdown leverages “side-channel” attacks to determine what data was returned by these calculations by inferring (and brute forcing) what was put into the processor’s cache.

Exploitation of these features via the Meltdown attacks allows a user-land process (such as JavaScript in a Browser) to read the operating system’s protected kernel memory. The kernel, by necessity, has access to all physical memory on the machine, including sensitive or secret information such as credentials, cryptographic keys, and data being processed by any running program. In order to mitigate the Meltdown Attack, operating system vendors have rushed to add additional security features which force software segregation of user space and kernel space memory. These mitigations, while successfully stopping the Meltdown attack, do have a negative impact on system performance.

Spectre Attack (CVE-2017-5753 and CVE-2017-5715)

The “Spectre” attack is much harder to perform than Meltdown in practice and also more difficult to mitigate in software. Spectre allows an attacker to use malicious code against legitimate applications actively running on a target system. The malicious code is designed to improperly disclose sensitive data legitimately loaded by the victim application into memory. The Spectre attack requires that the processor’s “speculative execution” engine be “tricked” into incorrectly executing code within victim application. Attackers must also leverage return oriented programming (ROP) to abuse the victim program’s legitimate code in order to “prime” the processor with the correct data. Finally, attackers must leverage side-channel attacks to determine what data was returned by the incorrectly executed code by inferring (and brute forcing) what was put into the processor’s cache. As such, leveraging the “Spectre” attack to exploit these CPU flaws is much more difficult and time consuming.

One of the likely uses of the “Spectre” attack is to steal sensitive information from browsers by exploiting these flaws using malicious JavaScript. Researchers have demonstrated the ability to use Spectre to bypass modern browser’s sandboxing features to read data from other “tabs” or active web applications. It’s important to understand that these are not vulnerabilities within the browsers or operating systems themselves but rather hardware flaws that allow attackers to force processors to execute unintended code. In practice, it’s possible for attackers to leverage Spectre to bypass modern browser sandboxes and steal sensitive information (including passwords, cookies, financial data, etc) from other websites.

Potential Impact

The potential impact of both of these attacks is relatively high as it allows attackers leverage processor hardware flaws to bypass operating system and software security protections to read sensitive data stored in the computer’s memory.

These flaws may allow malicious applications to read virtually any in-memory data, including sensitive or secret information such as credentials, cryptographic keys, data being processed by any running program, or opened files. The vulnerabilities exploit the hardware operations of CPUs and thus are operating systems independent.

Meltdown

The Meltdown attack allows attackers to exploit processor hardware flaws in modern CPUs to bypass traditional protections and read a machine’s kernel memory space, including the system’s entire physical memory.

Spectre

The Sprectre attack is much more complex and difficult to execute, however, it allows attackers to exploit hardware flaws in CPUs to bypass traditional protections and use malicious applications or code to “trick” other processes into divulging sensitive or secrete data only available to the victim application. Additionally, the researchers disclosing the vulnerability have proven that it’s possible for attackers to leverage Spectre to bypass modern browser sandboxes and steal sensitive information (including passwords, cookies, financial data, etc) from other websites.

Affected Processors and Systems

Meltdown

Desktop, Laptop, servers, appliances, and cloud computers may be affected by Meltdown. More technically, almost every Intel processor since 1995 (except Intel Itanium and Intel Atom before 2013) is affected by the Meltdown Attack. Cloud providers which use Intel CPUs and technologies like Xen PV, Docker, LXC, or OpenVZ without having applied recent operating system updates are affected. Luckily most cloud providers received advanced notice and have already patched their host operating systems to prevent exploitation of Meltdown (including AWS, Azure, and Google Cloud Platform).

Spectre

Almost every system is affected by Spectre: Desktops, Laptops, servers, appliances, cloud servers, as well as most mobile phones. More specifically, all modern processors capable of keeping many instructions in flight are potentially vulnerable. Specifically, Spectre has been verified to work on Intel, AMD, and ARM processors.

Mitigation and Response

Intel has begun to provide firmware updates for some of its processors to mitigate these attacks and expects to roll out additional firmware updates to the vast majority of Intel CPUs by the end of next week. All other modern processors remain vulnerable to the exploitation techniques abused by the “Spectre attack”. Kudelski Security expects other CPU vendors to issue similar firmware updates to protect against these attacks. The Cyber Fusion Center recommends that organizations contact server and end-user workstation hardware vendors to understand when Intel CPU firmware updates will be available for their systems.

Meltdown

Microsoft Windows, Apple macOS, VMware, and the Linux kernel have all been updated with software mitigations that prevent the Meltdown attack by isolating kernel and user-land memory at the software level (rather than relying on hardware protections).

Kudelski Security recommends that organizations apply the following patches from operating system vendors as soon as possible:

  • Microsoft released a Windows 10 out of band update. Other Windows versions will wait for the normal “Patch Tuesday” scheduled on January 9th.
    • The update may cause issues with some Anti-virus software running on the machine. Kudelski Security recommends consulting your AntiVirus software vendor and reading the Microsoft update documentation before applying.
  • Apple applied mitigations for Meltdown via macOS 10.13.2 and will improve it with the next update.
  • Linux kernel developers implemented kernel page-table isolation (KPTI), referred to as KAISER, which was merged into the Linux kernel in version 4.15 (released in early 2018) and was also back ported to Linux kernel 4.14.11. Updates should be available for major Linux distributions.
  • VMware released an update to mitigate Meltdown in its ESXi, Vmware Workstation, and VMware Fusion applications (VMSA-2018-0002).

The Kudelski Security Cyber Fusion Center is working closely with our vendor-partners to validate that their hardware and software appliances have been updated with the latest kernel versions to mitigate this attack.

Spectre

Unfortunately, there are no software patches or operating system mitigations that can fully mitigate the impacts of the Spectre attacks and the flaws being abused. However, there is work to harden individual software against future exploitation of Spectre. Additionally, Intel has begun to provide firmware updates for some of its processors to mitigate these attacks and expects to roll out additional firmware updates to the vast majority of Intel CPUs by the end of next week. Kudelski Security expects other CPU vendors to issue similar firmware updates to protect against these attacks in the near future.

Browser Vendors have begun updating their browsers to disable certain features which make the Spectre attack feasible via JavaScript.

Kudelski Security recommends that organizations update to the latest available versions of their web browsers including:

 

Sources

https://meltdownattack.com/meltdown.pdf

https://spectreattack.com/spectre.pdf

https://googleprojectzero.blogspot.com/2018/01/reading-privileged-memory-with-side.html

https://www.kb.cert.org/vuls/id/584653

http://blog.cyberus-technology.de/posts/2018-01-03-meltdown.html

https://blog.mozilla.org/security/2018/01/03/mitigations-landing-new-class-timing-attack/

https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/ADV180002

https://support.apple.com/en-us/HT208331

https://www.vmware.com/us/security/advisories/VMSA-2018-0002.html

https://blog.mozilla.org/security/2018/01/03/mitigations-landing-new-class-timing-attack/

https://blogs.windows.com/msedgedev/2018/01/03/speculative-execution-mitigations-microsoft-edge-internet-explorer/#tpOa1SwmRDKibAxg.97

https://www.chromium.org/Home/chromium-security/ssca

https://newsroom.intel.com/news-releases/intel-issues-updates-protect-systems-security-exploits/

Leave a Reply