A group of researchers from the VU University Amsterdam has presented a new attack technique called SLAM (Spectre Linear Address Masking), which offers a novel way to exploit Spectre-class microarchitectural vulnerabilities. In this method, data leakage occurs during the translation of non-canonical addresses, and it bypasses canonical checks by leveraging new processor extensions for masking linear addresses. The researchers have released a toolkit implementing the method and proposed a demonstration showing how to extract data from kernel memory that matches a specific mask (demonstrated how to retrieve a string containing the root user's password hash from kernel memory in Ubuntu in just a few seconds).

The attack can be executed on systems with Intel processors supporting the LAM (Linear Address Masking) extension, AMD processors with the UAI (Upper Address Ignore) extension, and ARM processors with the TBI (Top Byte Ignore) extension. These extensions allow the use of part of the bits in 64-bit pointers to store metadata unrelated to addressing (ordinary programs do not require so much memory to utilize 64-bit pointers, so the upper bits can be used for security-related checks, for example). Interestingly, Intel, AMD, and ARM processors with LAM, UAI, and TBI support have only been announced but are not yet mass-produced, making SLAM the first speculative attack targeting future CPUs. The attack can also be executed on older AMD Zen+ and Zen 2 CPUs vulnerable to CVE-2020-12965.
Similarly to the exploitation of Spectre vulnerabilities, the SLAM attack requires specific instruction sequences (gadgets) in the kernel that lead to speculative execution of instructions. Such instructions enable speculative reading of data from memory based on external conditions that can be influenced by the attacker. After the mispredicted outcome is determined, the result of the speculative execution is discarded, but the processed data remains in the cache and can then be retrieved through side-channel analysis. To extract the data left in the cache, researchers employed the Evict+Reload method, which is based on creating conditions that force data eviction from the cache (e.g., by generating activity that uniformly fills the cache with typical content) and performing operations where the execution time allows for inferring the presence of data in the processor's cache.
The SLAM attack uses gadgets based on code where the data controlled by the attacker (below referred to as the variable "secret") is used as a pointer. For instance: void unmasked_gadget(long **secret) { **secret; }
It is noted that such code patterns are often found in programs; for example, tens of thousands of these gadgets have been identified in the Linux kernel, out of which at least a few hundred are suitable for use in exploits. Leakage can be mitigated by adding additional instructions to such gadgets that block speculative execution. Intel plans to provide a software method to prevent leakage before the release of processors with LAM support. AMD has recommended using existing methods to block Spectre v2-class attacks. The Linux kernel developers have opted to disable LAM support by default until Intel publishes recommendations on mitigating the vulnerability.
Source: opennet.ru
