Vulnerabilities

SWAPGS Attack — New Speculative Execution Flaw Affects All Modern Intel CPUs

speculative execution vulnerability
speculative execution vulnerability

A new variant of the which leverage speculative-execution, and some AMD processors as well, Microsoft and Red Hat warn.

Identified as CVE-2019-1125, the vulnerability could allow unprivileged local attackers to access sensitive information stored in the operating system privileged kernel memory, including passwords, tokens, and encryption keys, that would otherwise be inaccessible.

Speculative execution is a core component of modern microprocessor design that speculatively executes instructions based on assumptions that are considered likely to be true. If the assumptions come out to be valid, the execution continues, otherwise discarded.

Such speculative executions also have side effects that are not restored when the CPU state is unwound, leading to information disclosure, which can then be accessed using .

According to a security advisory released today by Red Hat, the attack relies on speculatively executing unexpected SWAPGS instructions after a branch gets mispredicted.

SWAPGS instruction is a privileged system instruction that swaps the values in the GS register with the MSR values and is only available on devices with x86-64 architecture.

“Since SWAPGS can be executed speculatively inside user-mode, an attacker can leak the address of the per-CPU data, normally available to only the kernel,” researchers say.

The SWAPGS attack breaks the Kernel Page-Table Isolation (KPTI) provided by modern CPUs and can be used to leak sensitive kernel memory from unprivileged user mode.

“It is possible that these conditional branches in the Linux kernel entry code may mis-speculate into code that will not perform the SWAPGS, resulting in a window of speculative execution during which the wrong GS is used for dependent memory operations,” RedHat says in its advisory.

According to Bitdefender researchers, the new attack bypasses all known mitigations implemented after the discovery of vulnerabilities in early 2018 that put practically every computer in the world at risk.

Though the Linux kernel also contains a gadget which may be exploited to target Linux systems in an attack, researchers believe exploiting Linux operating systems could slightly be tougher than Windows computers.

Since the attack can not be launched remotely, it is unlikely to cause mass malware infections, like EternalBlue was used for WannaCry; instead, it can be exploited as part of an extremely targeted attack.

Affected users can address this issue through a software update for their operating systems that would mitigate how the CPU speculatively accesses memory.

Meanwhile, Google has also prepared a patch to fix this vulnerability in its ChromeOS 4.19 with a soon-to-be-released update, describing the flaw as:

“An attacker can train the branch predictor to speculatively skip the swapgs path for an interrupt or exception. If they initialize the GS register to a user-space value, if the swapgs is speculatively skipped, subsequent GS-related percpu accesses in the speculation window will be done with the attacker-controlled GS value. This could cause privileged memory to be accessed and leaked.”

You Might Also Like

Pin It on Pinterest

Share This