The Spectre vulnerability makes itself felt even years later.
Yesterday, Eduardo Vela Nava of the Google Product Security Response Team reported a new vulnerability in the Linux 6.2 kernel related to how the Spectre vulnerability works. On December 31, 2022, the medium security flaw was reported primarily to cloud service providers. On February 27, 2023, the vulnerability was already fixed.
"The kernel could not protect applications from Spectre v2, leaving them open to attacks from other processes running on a different hyperthread of the same physical core," the experts explain. Exploitation of the vulnerability results in the potential disclosure of sensitive information.
The name "Spectre" itself describes a whole set of vulnerabilities that abuse "speculative execution" or processor performance optimizations in which potential instructions are executed ahead of time to save time.
Later, a new version of the vulnerability appeared, Spectre v2. This variant relies on temporal side channels to measure the error rate in indirect branch prediction and compute the contents of the protected memory. This approach is far from optimal for a cloud environment with shared hardware.
Shortly after the initial attempts to fix the Meltdown and Spectre bugs, Intel published details on Indirect Branch Restricted Speculation (IBRS), a mechanism to restrict indirect branch speculation that tells processors to start executing instructions in a new location.
IBRS offers protection against Spectre v2, which Intel calls Branch Target Injection (BTI). Target branch injection is a method of teaching branch predictors to speculatively execute certain instructions to output data in the processor's cache using a timing side channel.
IBRS comes in two flavors: basic (legacy) and advanced. And it was the basic version that turned out to be vulnerable in terms of security. The bughunters who identified the issue found that Spectre v2 anti-Linux userspace processes were not running on virtual machines of "at least one major cloud provider," which was not named.
As reported in the vulnerability description, under base IBRS, the 6.2 kernel had logic that forfeited STIBP (Single Thread Indirect Branch Predictors), a protection against branch prediction sharing between logical processors on the kernel.
“The IBRS bit implicitly protects against injection of target branches between threads. However, in legacy IBRS, the bit was cleared on return to user space due to performance reasons, which disabled implicit STIBP and left user space threads vulnerable to cross-thread target injection, against which STIBP would normally provide such protection,” the vulnerability report explains.
The fix removed the underlying IBRs from the spectre_v2_in_ibrs_mode() check to keep STIBP enabled by default.