Software Guard Extensions

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Intel Software Guard Extensions (SGX) is a set of security-related instruction codes that are built into some modern Intel central processing units (CPUs). They allow user-level as well as operating system code to define private regions of memory, called enclaves, whose contents are protected and unable to be either read or saved by any process outside the enclave itself, including processes running at higher privilege levels.[1] SGX is disabled by default and must be opted in to by the user through their BIOS settings on a supported system.[2]

SGX involves encryption by the CPU of a portion of memory. The enclave is decrypted on the fly only within the CPU itself, and even then, only for code and data running from within the enclave itself.[3] The processor thus protects the code from being "spied on" or examined by other code.[3] The code and data in the enclave utilise a threat model in which the enclave is trusted but no process outside it can be trusted (including the operating system itself and any hypervisor), and all these are thus treated as potentially hostile. The enclave contents are unable to be read by any code outside the enclave, other than in its encrypted form.[3]

SGX is designed to be useful for implementing secure remote computation, secure web browsing, and digital rights management (DRM).[4] Other applications include concealment of proprietary algorithms and of encryption keys.[3]


Support for SGX in the CPU is indicated in CPUID "Structured Extended feature Leaf", EBX bit 02,[5] but its availability to applications requires BIOS support and opt-in enabling which is not reflected in CPUID bits. This complicates the feature detection logic for applications.[6]

Emulation of SGX was added to an experimental version of the QEMU system emulator in 2014.[7] In 2015, researchers at the Georgia Institute of Technology released an open-source simulator known as OpenSGX.[8]

It was introduced in 2015 with the sixth generation Intel Core microprocessors based on the Skylake microarchitecture.

One example of SGX used in security was a demo application from wolfSSL[9] using it for cryptography algorithms.

Intel Goldmont Plus (Gemini Lake) microarchitecture will also add support for Intel SGX.[citation needed]

Prime+Probe attack[edit]

On 27 March 2017 researchers at Austria's Graz University of Technology developed a proof-of-concept that can grab RSA keys from SGX enclaves running on the same system within five minutes by using certain CPU instructions in lieu of a fine-grained timer to exploit cache DRAM side-channels.[10][11] One countermeasure for this type of attack was presented and published by Daniel Gruss et al. at the USENIX Security Symposium in 2017.[12] Among other published countermeasures, one countermeasure to this type of attack was published on September 28, 2017, a compiler-based tool, DR.SGX,[13] that claims to have superior performance with the elimination of the implementation complexity of other proposed solutions.

Spectre-like attack[edit]

The LSDS group at Imperial College London showed a proof of concept that the Spectre speculative execution security vulnerability can be adapted to attack the secure enclave.[14] The Foreshadow attack, disclosed in August 2018, combines speculative execution and buffer overflow to bypass the SGX.[15]

Enclave attack[edit]

On 8 February 2019, researchers at Austria's Graz University of Technology published findings, which showed that in some cases it is possible to run malicious code from within the enclave itself.[16] The exploit involves scanning through process memory, in order to reconstruct a payload, which can then run code on the system. The paper claims that due to the confidential and protected nature of the enclave, it is impossible for Antivirus software to detect and remove malware residing within it. However, since modern anti-malware and antivirus solutions monitor system calls, and the interaction of the application with the operating system, it should be possible to identify malicious enclaves by their behavior, and this issue is unlikely to be a concern for state-of-the-art antiviruses. Intel issued a statement, stating that this attack was outside the threat model of SGX, that they cannot guarantee that code run by the user comes from trusted sources, and urged consumers to only run trusted code.[17]

See also[edit]


  1. ^ "Intel SGX for Dummies (Intel SGX Design Objectives)". 2013-09-26.
  2. ^ johnm (2017-08-08). "Properly Detecting Intel® Software Guard Extensions (Intel® SGX) in Your Applications". Retrieved 2019-02-15.
  3. ^ a b c d "Researchers Use Intel SGX To Put Malware Beyond the Reach of Antivirus Software - Slashdot".
  4. ^ "Intel SGX Details". 2017-07-05.
  5. ^ Intel Architecture Instruction Set Extensions Programming Reference, Intel, AUGUST 2015, page 36 "Structured Extended feature Leaf EAX=07h, EBX Bit 02: SGX"
  6. ^ "Properly Detecting Intel Software Guard Extensions in Your Applications". 2016-05-13.
  7. ^ "Intel SGX Emulation using QEMU" (PDF). Retrieved 2018-11-02.
  8. ^ "sslab-gatech/opensgx". GitHub. Retrieved 2016-08-15.
  9. ^ "wolfSSL At IDF". wolfssl. 2016-08-11.
  10. ^ Chirgwin, Richard (March 7, 2017). "Boffins show Intel's SGX can leak crypto keys". The Register. Retrieved 1 May 2017.
  11. ^ Schwarz, Michael; Weiser, Samuel; Gruss, Daniel; Maurice, Clémentine; Mangard, Stefan (2017). "Malware Guard Extension: Using SGX to Conceal Cache Attacks". arXiv:1702.08719 [cs.CR].
  12. ^ "Strong and Efficient Cache Side-Channel Protection using Hardware Transactional Memory" (PDF). USENIX. 2017-08-16.
  13. ^ Brasser, Ferdinand; Capkun, Srdjan; Dmitrienko, Alexandra; Frassetto, Tommaso; Kostiainen, Kari; Müller, Urs; Sadeghi, Ahmad-Reza (2017-09-28). "DR.SGX: Hardening SGX Enclaves against Cache Attacks with Data Location Randomization". arXiv:1709.09917 [cs.CR].
  14. ^ Sample code demonstrating a Spectre-like attack against an Intel SGX enclave.
  15. ^ Peter Bright - Jul 10, 2018 9:00 pm UTC (2018-07-10). "New Spectre-like attack uses speculative execution to overflow buffers". Ars Technica. Retrieved 2018-11-02.
  16. ^ Schwarz, Michael; Weiser, Samuel; Gruss, Daniel (2019-02-08). "Practical Enclave Malware with Intel SGX". arXiv:1902.03256 [cs.CR].
  17. ^ Bright, Peter (2019-02-12). "Researchers use Intel SGX to put malware beyond the reach of antivirus software". Ars Technica. Retrieved 2019-02-15.

External links[edit]