OP-TEE is a Trusted Execution Environment (TEE) designed as companion to a non-secure Linux kernel running on Arm; Cortex-A cores using the TrustZone technology. Starting in version 3.20 and prior to version 3.22, shdrverifysignature can make a double free. shdrverifysignature used to verify a TA binary before it is loaded. To verify a signature of it, allocate a memory for RSA key. RSA key allocate function (swcryptoacipherallocrsapublickey) will try to allocate a memory (which is optee’s heap memory). RSA key is consist of exponent and modulus (represent as variable e, n) and it allocation is not atomic way, so it may succeed in e but fail in n. In this case swcryptoacipherallocrsapublickey will free on e and return as it is failed but variable ‘e’ is remained as already freed memory address . shdrverifysignature will free again that memory (which is e) even it is freed when it failed allocate RSA key. A patch is available in version 3.22. No known workarounds are available.
OP-TEE is a Trusted Execution Environment (TEE) designed as companion to a non-secure Linux kernel running on Arm; Cortex-A cores using the TrustZone technology. Starting in version 3.20.0 and prior to version 4.11.0, a vulnerability in OP-TEE’s subkey rollback protection allows the use of revoked or older subkey versions because the system fails to propagate versioning data during the Trusted Application (TA) loading process. In core/crypto/signedhdr.c, the function shdrloadpubkey() parses subkey headers but does not assign the subkeyversion to the runtime shdrpubkey structure. As a result, the key->version field remains at zero regardless of the version specified in the header. When reefstaopen() in core/kernel/reefsta.c calls checkupdateversion(), it passes this zeroed version to the rollback database. Because the database never receives a non-zero version to record, it never advances, effectively bypassing the rollback check and allowing TAs signed with downgraded subkey chains to load successfully. This impacts OP-TEE mainline configurations that utilize subkey-based signing chains for Trusted Application (TA) authentication. Version 4.11.0 contains a patch. No known workarounds are available.