Intel SGX provides applications with a secure container called enclave, where the integrity and confidentiality of code and data are protected. While SGX guarantees this security property against the compromises outside of the enclave, it has not been well researched as to what would happen if a vulnerability inside the enclave exists. We explore how to exploit a single memory vulnerability in the enclave and its possible effect. In contrast to non-SGX environment, it is considerably difficult for attackers to find ROP gadgets for turing completeness, since the size of code in enclave should be small to reduce the size of TCB. However, our attack, SROP, shows that some SGX instructions can always be found inside enclave and be leveraged to facilitate the exploitation, due to the fact that a single instruction presents several leaf functions by sharing the same opcode in the SGX design. To show the effectiveness of our attack, we demonstrate that attackers can construct an ROP payload with limited number of gadgets that can be found only in Intel-provided trusted libraries (e.g., SGX SDK), and that we successfully modify the enclave memory (e.g., code injection into the enclave) by neutralizing the hardware-based memory-protection mechanism provided by SGX. Also, as attack case studies, we show that once the enclave is compromised, security facilities such as data sealing and remote attestation can no longer be trusted and a benign enclave identity can be associated for malicious activities.
인텔 SGX는 어플리케이션에서 보호받아야할 코드와 데이터에 대한 무결성과 기밀성을 보장해주는 안전한 컨테이너인 인클레이브를 제공한다. SGX는 인클레이브 밖의 시스템이 변조되었을 경우에 대해서는 보안 속성을 보장하지만, 취약점 자체가 인클레이브 내에 존재할 경우에 문제가 발생할 수 있다. 본 연구에서는 인클레이브 내에 존재하는 단 하나의 메모리 취약점을 이용하여 공격하는 방법과 이 공격으로 인해 일어날 수 있는 결과에 대해 설명한다. 이 공격의 유효성을 보여주기 위하여 공격자가 인텔에서 제공하는 신뢰 라이브러리로부터 제한된 개수의 ROP 페이로드를 추출하여 공격을 수행하였으며, 결과적으로, SGX가 제공하는 하드웨어 기반의 메모리 보호 기법을 무력화 시키고 인클레이브 내의 메모리를 변조시킬 수 있음을 확인하였다. 또한 공격 사례 연구를 통해, 인클레이브내의 코드나 데이터가 변조될 경우, 정상적인 인클레이브를 통한 원격 검증과 같은 보안 특성도 더 이상 신뢰할 수 없음을 나타내었다.