Abstract
In this paper, we provide a systematic analysis of the root cause of the prefetching effect observed in previous works and show that its attribution to a prefetching mechanism is incorrect in all previous works, leading to incorrect conclusions and incomplete defenses. We show that the root cause is speculative dereferencing of user-space registers in the kernel. This new insight enables the first end-to-end Foreshadow (L1TF) exploit targeting non-L1 data, despite Foreshadow mitigations enabled, a novel technique to directly leak register values, and several side-channel attacks. While the L1TF effect is mitigated on the most recent Intel CPUs, all other attacks we present still work on all Intel CPUs and on CPUs by other vendors previously believed to be unaffected.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
Demonstration video can be found here: https://streamable.com/8ke5ub.
- 2.
“Our attacks are based on weaknesses in the hardware design of prefetch instructions” [17].
- 3.
“2. Prefetch (inaccessible) address \(\bar{p}\). 3. Reload p. [...] the prefetch of \(\bar{p}\) in step 2 leads to a cache hit in step 3 with a high probability.” [17] with emphasis added.
- 4.
- 5.
“Prefetch can fetch inaccessible privileged memory into various caches on Intel x86.” [17] and corresponding NaCl results.
- 6.
“[...] we were not able to build an address-translation oracle on [ARM] Android. As the prefetch instructions do not prefetch kernel addresses [...]” [17] describing why it does not work on ARM-based Android devices.
References
Amazon AWS: AWS Lambda@Edge (2019). https://aws.amazon.com/lambda/edge/
ARM: ARM: Whitepaper Cache Speculation Side-channels (2018). https://developer.arm.com/support/arm-security-updates/speculative-processor-vulnerability/download-the-whitepaper
Bhattacharya, S., Maurice, C., Bhasin, S., Mukhopadhyay, D.: Template Attack on Blinded Scalar Multiplication with Asynchronous perf-ioctl Calls. Cryptology ePrint Archive, Report 2017/968 (2017)
Branco, R., Hu, K., Sun, K., Kawakami, H.: Efficient mitigation of side-channel based attacks against speculative execution processing architectures (2019). US Patent App. 16/023,564
Brasser, F., Müller, U., Dmitrienko, A., Kostiainen, K., Capkun, S., Sadeghi, A.R.: Software grand exposure: SGX cache attacks are practical. In: WOOT (2017)
Canella, C., et al.: A Systematic evaluation of transient execution attacks and defenses. In: USENIX Security Symposium (2019). Extended classification tree and PoCs at https://transient.fail/
Chen, G., Chen, S., Xiao, Y., Zhang, Y., Lin, Z., Lai, T.H.: SgxPectre attacks: stealing Intel secrets from SGX enclaves via speculative execution. In: EuroS&P (2019)
Chromium: Mojo in Chromium (2020). https://chromium.googlesource.com/chromium/src.git/+/master/mojo/README.md
Cloudflare: Cloudflare Workers (2019). https://www.cloudflare.com/products/cloudflare-workers/
KVM Contributors: Kernel-based Virtual Machine (2019). https://www.linux-kvm.org
Elixir bootlin (2018). https://elixir.bootlin.com/linux/latest/source/arch/x86/kvm/svm.c#L5700
Evtyushkin, D., Ponomarev, D., Abu-Ghazaleh, N.: Jump over ASLR: attacking branch predictors to bypass ASLR. In: MICRO (2016)
Fog, A.: The microarchitecture of Intel. An optimization guide for assembly programmers and compiler makers, AMD and VIA CPUs (2016)
Gens, D., Arias, O., Sullivan, D., Liebchen, C., Jin, Y., Sadeghi, A.R.: LAZARUS: practical side-channel resilient kernel-space randomization. In: RAID (2017)
Gras, B., Razavi, K., Bosman, E., Bos, H., Giuffrida, C.: ASLR on the line: practical cache attacks on the MMU. In: NDSS (2017)
Gruss, D., Lipp, M., Schwarz, M., Fellner, R., Maurice, C., Mangard, S.: KASLR is dead: long live KASLR. In: ESSoS (2017)
Gruss, D., Maurice, C., Fogh, A., Lipp, M., Mangard, S.: Prefetch side-channel attacks: bypassing SMAP and Kernel ASLR. In: CCS (2016)
Gruss, D., Maurice, C., Mangard, S.: Rowhammer.js: a remote software-induced fault attack in JavaScript. In: DIMVA (2016)
Horn, J.: Speculative execution, variant 4: speculative store bypass (2018)
IAIK: Prefetch Side-Channel Attacks V2P (2016). https://github.com/IAIK/prefetch/blob/master/v2p/v2p.c
IBM (2019). https://cloud.ibm.com/functions/
Intel: Intel Analysis of Speculative Execution Side Channels (2018). Revision 4.0
Intel: Retpoline: A Branch Target Injection Mitigation (2018). Revision 003
Intel: Speculative Execution Side Channel Mitigations (2018). Revision 3.0
Intel: Intel 64 and IA-32 Architectures Optimization Reference Manual (2019)
Intel: Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 3 (3A, 3B & 3C): System Programming Guide (2019)
Intel Corporation: Software Guard Extensions Programming Reference, Rev. 2 (2014)
Intel Corporation: Refined Speculative Execution Terminology (2020). https://software.intel.com/security-software-guidance/insights/refined-speculative-execution-terminology
Jangda, A., Powers, B., Berger, E.D., Guha, A.: Not so fast: analyzing the performance of webassembly vs. native code. In: USENIX ATC (2019)
kernel.org: Virtual memory map with 4 level page tables (x86_64) (2009). https://www.kernel.org/doc/Documentation/x86/x86_64/mm.txt
Kim, T., Shin, Y.: Reinforcing meltdown attack by using a return stack buffer. IEEE Access 7, 186065–186077 (2019)
Kim, Y., et al.: Flipping bits in memory without accessing them: an experimental study of DRAM disturbance errors. In: ISCA (2014)
Kiriansky, V., Waldspurger, C.: Speculative buffer overflows: attacks and defenses. arXiv:1807.03757 (2018)
Shutemov, K.A.: Pagemap: Do Not Leak Physical Addresses to Non-Privileged Userspace (2015). https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=ab676b7d6fbf4b294bf198fb27ade5b0e865c7ce
Kocher, P., et al.: Spectre attacks: exploiting speculative execution. In: S&P (2019)
Koruyeh, E.M., Khasawneh, K., Song, C., Abu-Ghazaleh, N.: Spectre returns! speculation attacks using the return stack buffer. In: WOOT (2018)
Lee, J., et al.: Hacking in Darkness: Return-oriented Programming against Secure Enclaves. In: USENIX Security Symposium (2017)
Lee, S., Shih, M., Gera, P., Kim, T., Kim, H., Peinado, M.: Inferring fine-grained control flow inside SGX enclaves with branch shadowing. In: USENIX Security Symposium (2017)
Levin, J.: Mac OS X and IOS Internals: To the Apple’s Core. Wiley, Hoboken (2012)
Lipp, M., Gruss, D., Schwarz, M., Bidner, D., Maurice, C., Mangard, S.: Practical keystroke timing attacks in sandboxed JavaScript. In: ESORICS (2017)
Lipp, M., et al.: Meltdown: reading kernel memory from user space. In: USENIX Security Symposium (2018)
Maisuradze, G., Rossow, C.: ret2spec: speculative execution using return stack buffers. In: CCS (2018)
Maurice, C., et al.: Hello from the other side: SSH over robust cache covert channels in the Cloud. In: NDSS (2017)
Microsoft: Azure serverless computing (2019). https://azure.microsoft.com/en-us/overview/serverless-computing/
Microsoft Techcommunity: Hyper-V HyperClear Mitigation for L1 Terminal Fault (2018). https://techcommunity.microsoft.com/t5/Virtualization/Hyper-V-HyperClear-Mitigation-for-L1-Terminal-Fault/ba-p/382429
Mozilla: Javascript data structures (2019). https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures
Nilsson, A., Nikbakht Bideh, P., Brorsson, J.: A Survey of Published Attacks on Intel SGX (2020)
OpenSSL: OpenSSL: The Open Source toolkit for SSL/TLS (2019). http://www.openssl.org
Oren, Y., Kemerlis, V.P., Sethumadhavan, S., Keromytis, A.D.: The Spy in the sandbox: practical cache attacks in JavaScript and their implications. In: CCS (2015)
Pessl, P., Gruss, D., Maurice, C., Schwarz, M., Mangard, S.: DRAMA: exploiting DRAM addressing for cross-CPU attacks. In: USENIX Security Symposium (2016)
Rebeiro, C., Mukhopadhyay, D., Takahashi, J., Fukunaga, T.: Cache timing attacks on Clefia. In: International Conference on Cryptology in India. Springer, Heidelberg (2009)
van Schaik, S.: RIDL: rogue in-flight data load. In: S&P (2019)
Schwarz, M., Canella, C., Giner, L., Gruss, D.: Store-to-leak forwarding: leaking data on meltdown-resistant CPUs. arXiv:1905.05725 (2019)
Schwarz, M., et al.: Automated detection, exploitation, and elimination of double-fetch bugs using modern CPU features. In: AsiaCCS (2018)
Schwarz, M., Gruss, D., Weiser, S., Maurice, C., Mangard, S.: Malware guard extension: using SGX to conceal cache attacks. In: DIMVA (2017)
Schwarz, M., et al.: ZombieLoad: cross-privilege-boundary data sampling. In: CCS (2019)
Schwarz, M., Maurice, C., Gruss, D., Mangard, S.: Fantastic timers and where to find them: high-resolution microarchitectural attacks in JavaScript. In: FC (2017)
Schwarz, M., Schwarzl, M., Lipp, M., Gruss, D.: NetSpectre: read arbitrary memory over network. In: ESORICS (2019)
Schwarz, M., Weiser, S., Gruss, D.: Practical enclave malware with Intel SGX. In: DIMVA (2019)
Schwarzl, M., Schuster, T., Schwarz, M., Gruss, D.: Speculative dereferencing of registers: reviving foreshadow (2021). https://martinschwarzl.at/media/files/spec_deref_extended.pdf
Seaborn, M., Dullien, T.: Exploiting the DRAM rowhammer bug to gain kernel privileges. In: Black Hat Briefings (2015)
Slashdot EditorDavid: Two Linux Kernels Revert Performance-Killing Spectre Patches (2019). https://linux.slashdot.org/story/18/11/24/2320228/two-linux-kernels-revert-performance-killing-spectre-patches
Stecklina, J.: An demonstrator for the L1TF/Foreshadow vulnerability (2019). https://github.com/blitz/l1tf-demo
Turner, P.: Retpoline: a software construct for preventing branch-target-injection (2018). https://support.google.com/faqs/answer/7625886
Ubuntu Security Team: L1 Terminal Fault (L1TF) (2019). https://wiki.ubuntu.com/SecurityTeam/KnowledgeBase/L1TF
V8 team: v8 - Adding BigInts to V8 (2018). https://v8.dev/blog/bigint
Van Bulck, J., et al.: Foreshadow: extracting the keys to the intel SGX kingdom with transient out-of-order execution. In: USENIX Security Symposium (2018)
Van Bulck, J., et al.: LVI: hijacking transient execution through microarchitectural load value injection. In: S&P (2020)
Viswanathan, V.: Disclosure of hardware prefetcher control on some intel processors. https://software.intel.com/en-us/articles/disclosure-of-hw-prefetcher-control-on-some-intel-processors
Weisse, O., et al.: Foreshadow-NG: Breaking the Virtual Memory Abstraction with Transient Out-of-Order Execution (2018). https://foreshadowattack.eu/foreshadow-NG.pdf
Wu, Z., Xu, Z., Wang, H.: Whispers in the hyper-space: high-bandwidth and reliable covert channel attacks inside the cloud. ACM Trans. Netw. 23, 603–614 (2014)
xenbits: Cache-load gadgets exploitable with L1TF (2019). https://xenbits.xen.org/xsa/advisory-289.html
Xiao, Y., Zhang, Y., Teodorescu, R.: SPEECHMINER: a framework for investigating and measuring speculative execution vulnerabilities. In: NDSS (2020)
Yarom, Y., Falkner, K.: Flush+Reload: a high resolution, low noise, L3 cache side-channel attack. In: USENIX Security Symposium (2014)
Acknowledgments
We want to thank Moritz Lipp, Clémentine Maurice, Anders Fogh, Xiao Yuan, Jo Van Bulck, and Frank Piessens of the original papers for reviewing and providing feedback to drafts of this work and for discussing the technical root cause with us. Furthermore, we want to thank Intel and ARM for valuable feedback on an early draft. This project has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation program (grant agreement No. 681402). Additional funding was provided by generous gifts from Cloudflare, Intel and Red Hat. Any opinions, findings, and conclusions or recommendations expressed in this paper are those of the authors and do not necessarily reflect the views of the funding parties.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Appendices
A Extracting Hypotheses from Previous Works
The hypotheses are extracted from previous works as detailed in this section. The footnotes for each hypothesis provide the exact part of the previous work that we reference.
-
H1 the prefetch instruction (to instruct the prefetcher to prefetch);Footnote 2
-
H2 the value stored in the register used by the prefetch instruction (to indicate which address the prefetcher should prefetch);Footnote 3
-
H3 the sched_yield syscall (to give time to the prefetcher);Footnote 4
-
H4 the use of the userspace_accessible bit (as kernel addresses could otherwise not be translated in a user context);Footnote 5
-
H5 an Intel CPU – the “prefetching” effect only occurs on Intel CPUs, and other CPU vendors are not affected.Footnote 6
The original paper also describes that “delays were introduced to lower the pressure on the prefetcher” [17]. In fact, this was done via recompilation. Note that recompilation with additional code inserted may have side effects such as a different register allocation, which we find to be an important influence factor to the attack.
B Actual Spectre V2 gadget in Linux kernel
We analyzed the Linux kernel 4.16.18 and used the GNU debugger (GDB) to debug our kernel. As our target syscall we analyzed the path of the sched_yield syscall. We used the same experiment, which fills all general-purpose registers with the corresponding DPM address, perform sched_yield and verify the speculative dereference with Flush+Reload. We repeat this experiment 10 000 000 times. We analyzed each indirect branch in this code path and replaced the indirect call/jump with a retpolined version. Furthermore, we analyzed all general-purpose registers and traced their content if the DPM-address is still valid in some registers. By systematically retpolining the indirect branches, we observed that the indirect call current->sched_class->yield_task(rq); in the function sys_sched_yield causes the main leakage. We set a breakpoint to this function and observed that four general-purpose registers (%rcx,%rsi,%r8,%r9) still contain the kernel address we set in our experiment.
In the function put_prev_task_fair, the %rsi register is dereferenced. To check whether this dereference cause the leakage, we add an lfence instruction at the beginning of the function. We run the same experiment again and observe almost no cache fetches on our address. The %rsi register is dereferenced in line 48.
Rights and permissions
Copyright information
© 2021 International Financial Cryptography Association
About this paper
Cite this paper
Schwarzl, M., Schuster, T., Schwarz, M., Gruss, D. (2021). Speculative Dereferencing: Reviving Foreshadow. In: Borisov, N., Diaz, C. (eds) Financial Cryptography and Data Security. FC 2021. Lecture Notes in Computer Science(), vol 12674. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-64322-8_15
Download citation
DOI: https://doi.org/10.1007/978-3-662-64322-8_15
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-662-64321-1
Online ISBN: 978-3-662-64322-8
eBook Packages: Computer ScienceComputer Science (R0)