  Malware attacks are a significant part of the new software security threats
detected each year. Intel Software Guard Extensions (SGX) are a set of hardware
instructions introduced by Intel in their recent lines of processors that are
intended to provide a secure execution environment for user-developed
applications. To our knowledge, there was no serious attempt yet to overcome
the SGX protection by exploiting the weaknesses in the software supply chain
infrastructure, namely at the level of the development, build or signing
servers. While SGX protection does not specifically take into consideration
such threats, we show in the current paper that a simple malware attack
exploiting a separation between the build and signing processes can have a
serious damaging impact, practically nullifying SGX integrity protection
measures. We also explore two possible mitigations against the attack, one
centralized leveraging SGX itself, and one distributed that relies on a smart
contract deployed on a blockchain infrastructure. Our evaluation shows that
both methods are feasible in practice and their added costs are acceptable for
the offered protection.
