SLAP & FLOP: Apple Silicon’s Data Speculation Vulnerabilities

Modern CPUs implement speculative execution and prediction mechanisms to enhance performance. However, these optimizations introduce new security vulnerabilities. Two such attacks exploit Apple Silicon’s predictive behaviors to leak sensitive data through speculative execution. They are called:
This article explores these attacks, their implications, and potential mitigations. Enjoy!
SLAP: Speculative Load Address Prediction
SLAP exploits Apple CPUs’ Load Address Predictor (LAP), a mechanism that predicts memory addresses for load instructions based on past access patterns. If a predicted address is cached, the CPU speculatively loads data from it before resolving the actual memory address.
Discovery of the Load Address Predictor
The Georgia Institute of Technology and Ruhr University Bochum researchers identified the LAP’s existence on Apple M2, M3, and A-series CPUs (A15 and later) through experiments showing significant execution speedups when loading data in a striding pattern (i.e., sequentially increasing addresses). This speedup indicates that the LAP speculatively loads predicted addresses before verifying them.
Exploiting LAP
- Out-of-Bounds Reads: By manipulating the LAP, an attacker can trick the CPU into speculatively loading sensitive data beyond allocated memory.
- Breaking ASLR: LAP’s speculative execution provides information about memory layout, bypassing Address Space Layout Randomization (ASLR) defenses.
- Browser Attacks: A JavaScript-based SLAP attack extracts sensitive data from web pages, exploiting Safari’s handling of JavaScript objects.
Real-World Impact
SLAP can be used to extract confidential data from a user’s browser session, such as emails from Gmail or credentials from login pages. The attack is stealthy and works within browser sandboxes.
FLOP: False Load Output Predictions
FLOP targets Apple’s Load Value Predictor (LVP), which predicts the values of memory loads to accelerate execution. When the LVP mispredicts, it causes the CPU to operate on incorrect values, potentially leaking sensitive data speculatively.
Discovery of the Load Value Predictor
Researchers observed that Apple’s CPUs optimize Read-After-Write (RAW) dependencies using the LVP. The LVP activates when the same value is repeatedly loaded from memory, allowing subsequent loads to execute speculatively with a predicted value.
Exploiting LVP
- Type Confusion in Safari: By manipulating the LVP, attackers trick Safari’s JavaScript engine into using a predicted value as a pointer, leading to arbitrary memory access.
- Hijacking WebAssembly Execution in Chrome: In Chrome, FLOP can mispredict WebAssembly function calls, leading to the speculative execution of rogue functions.
- Kernel-Level Exploitation: If attackers find kernel-side gadgets, FLOP can be leveraged to bypass kernel security boundaries, further expanding its impact.
Real-World Impact
FLOP enables attackers to extract private data from browser sessions, such as browsing history, authentication tokens, and even credit card details stored in web applications – similar to SLAP. The ability to execute arbitrary functions under speculation makes it a serious attack vector.
Differences Between SLAP and FLOP
Feature | SLAP (Load Address Prediction) | FLOP (Load Value Prediction) |
---|---|---|
Mechanism | Predicts memory addresses for loads | Predicts values of memory loads |
Attack Scope | Speculative address resolution | Speculative execution on stale values |
Affected CPUs | Apple M2, M3, A15, A16, A17 | Apple M3, M4, A17 Pro |
Key Exploit | Out-of-bounds memory reads | Type confusion, function hijacking |
Browser Attacks Examples | Safari JavaScript engine exploitation | Chrome WebAssembly function redirection |
Mitigation Strategies
Software-Based Mitigations
- Disabling JavaScript-Based Speculation: Browser vendors can implement strict type checking to prevent speculative type confusion.
- Enforcing Memory Isolation: Web browsers should isolate memory regions to prevent speculative cross-origin data leaks.
- Using Data-Independent Timing (DIT): Researchers noted that setting the DIT bit in the ARM ISA disables the LVP, preventing mispredictions.
Hardware-Based Mitigations
- Speculation Barriers: Apple could introduce microarchitectural fences that limit speculative memory accesses.
- LVP and LAP Limitations: Reducing the prediction window or introducing integrity checks for predicted addresses and values could mitigate these vulnerabilities.
- Microcode Patches: Apple may release firmware updates to modify speculative execution behavior, reducing exposure to these attacks.
Final Words
The FLOP and SLAP attacks pose a serious threat due to their ability to exploit widely used Apple hardware remotely without requiring physical access. Simply visiting a malicious website is enough to trigger data leaks, bypassing browser sandboxing, ASLR, and conventional memory protections.
The attack relies on executing carefully crafted memory load sequences within a web browser, leveraging Apple’s speculative execution vulnerabilities without the need for malware installation.
Until Apple releases security patches, a temporary mitigation is to disable JavaScript in Safari and Chrome, though this will likely disrupt the functionality of many websites.
To learn more about the technical details of both attack vectors, I encourage you to read full research papers from Jason Kim, Daniel Genkin, and Yuval Yarom that can be found here:
Additionally, demos and FAQs about these issues can be found at https://predictors.fail/.
If this blog post interests you and you are interested in Cybersecurity in general, I encourage you to visit our AFINE blog regularly for new knowledge. If you are interested in macOS and want to learn more, bookmark the Snake_Apple repository, as any article I wrote will be listed there.