A computer chip with fiber optic cables

Security Highlight: SmashEx Threatens SGX Applications on Intel Chips

Researchers from universities in Singapore, China, and Switzerland have discovered a novel way to compromise the security of Secure Guard Extension (SGX), the trusted execution environment (TEE) provided by Intel. The attack, known as SmashEx, allows a privileged attacker to retrieve secrets processed in a secure enclave, by which the benefit of the enclave is lost. While the attack is based on a weakness in the SGX hardware design, it became exploitable by operating system components that did not mitigate the weakness. Various vendors have released advisories and patches after being informed in May 2021.

SGX was developed to offer security to applications, even when the operating system is compromised. This feature would, for instance, allow operating secure internet connections while the system is not immune against malware. While normal applications rely heavily on the operating system, an application running in an SGX enclave would be minimally dependent on the operating system and able to protect its assets. However, enclaves still need an operating system to manage the enclaves, e.g., to create them and to start sessions.

The new vulnerability affects the management of enclaves, specifically the processing of exceptions. Modern systems support asynchronous exception handling, which is very convenient in complex devices, which run many parallel tasks and have many potential conflict situations. Exceptions allow for smooth handling of special situations, resulting in a good user experience. The operating system’s task is to pass exceptions to the enclave and support stopping and restarting its applications. This is where the vulnerability applies. With the interruption of an enclave application process, the operating system gets temporary access to some registers, as they are copied in order to support re-entrancy.

The researchers show that a compromised operating system can actually modify the enclave register backup during exception handling, allowing a hijack of the application and an extraction of its assets. Though the attack is complex in the sense that it requires a compromised operating system, it defeats the purpose of the enclave, to protect an application against an untrusted platform. Although the attack could be prevented with a hardware modification, it can also (more easily) be mitigated by the operating system component that services SGX (the SGX runtime), applying more cautious exception handling.

There are multiple software libraries that offer SGX support, including the Intel SGX Software Development Kit (SDK), and many of them appeared vulnerable to this attack. All library vendors have been informed and are working on, or provide, solutions. Intel has given this problem an 8.2 score, which is a high risk in the Common Vulnerability Scoring System (CVSS) rating. End users are especially at risk when malware compromises their systems and should be cautious when insufficient malware protection is in place.

Application providers relying on SGX should recompile and distribute their applications to work with the patched SGX library. End users can protect themselves by updating their systems with the newest patch.

TEEs are an important security enabler in multi-purpose devices and instrumental in the defense against malware. We must understand that the technology is still young, and therefore anticipate growing pains. While this issue is only one example out of many incidents, it is still good to embrace the concept and keep pushing for more security. Application providers should inform themselves on the state of the art, and demand tested products.

limit
3