How enclaves communicate with each other securely during Local Attestation
Can a man-in-the-middle (MITM) attack, where a third enclave intercepts messages and impersonates one of the enclaves, be implemented during Local Attestation between two enclaves?
A man-in-the-middle attack is not possible because a third enclave cannot intercept the messages between the source enclave and the destination enclave.
In Local Attestation, the two enclaves do not communicate directly with each other. Instead, the enclaves communicate using encrypted channels via the untrusted application as an intermediary.
Read the Local Attestation section in the Intel® Software Guard Extensions (Intel® SGX) SDK Developer Reference Guide for Windows* for full details. The Protected Channel Establishment subsection states:
The application initiates a session between the source enclave and the destination enclave by doing an ECALL into the source enclave, passing in the enclave id of the destination enclave. Upon receiving the enclave id of the destination enclave, the source enclave does an OCALL into the core untrusted code which then does an ECALL into the destination enclave to exchange the messages required to establish a session using ECDH Key Exchange* protocol.
The Intel SGX Developer Reference for Linux is in the Documentation folder of the latest release of the Intel® Software Guard Extensions SDK for Linux*.