I'm trying to understand how secure Intel SGX actually is.
According to Intel:
Note that developers cannot rely on a measurement supplied by system software; as noted earlier, software can always be virtualized or otherwise spoofed by suitably privileged rogue software. This implies that hardware must be responsible for supplying this measurement – the same hardware that establishes the trusted environment, loads/initializes the trusted application, and (ultimately) performs computations on the sensitive data.
However, what is stopping rogue software from virtualizing the Intel SGX extension itself, so that the enclaves and basically the whole thing becomes fake? One might claim that the hardware uses a built-in secret key for signing, but if rogue software sits in between the hardware and the software, it can wrap SGX completely and have it "measure" the right code to produce the desired signatures, to then get the trusted party to send protected data, to then execute it as-if it is running in an enclave. What am I missing?