Skip to content

RSA key leakage in modular exponentiation

High
jbech-linaro published GHSA-vh9c-pp22-ffg3 Jun 28, 2021

Package

OP-TEE

Affected versions

< 2.5.0

Patched versions

>= 2.5.0 to 3.8.0. For >= 3.9 N/A

Description

Applus+ Laboratories found out that OP-TEE is vulnerable to a timing attack when doing the Montgomery operations.

One way to optimize modular exponentiation is to make use of something called Montgomery multiplication and Montgomery reduction. OP-TEE implements the Montgomery operations in the big number library, libmpa. The current implementation uses a binary Left to Right (LtoR) implementation. The LtoR implementation is vulnerable to timing attacks since it leaks information about the exponent in use, because it uses different amount of time in each loop when doing the exponentiation. The leaked information can be used to completely recover the private key. One mitigation to this attack is to change the implementation to a constant time exponentiation algorithm instead of LtoR. One such algorithm is the so called Montgomery powering ladder, which does the same amount of operations in every loop. I.e., it will always do square and multiply in every loop. The fix (Montgomery ladder) for the timing attack has been implemented in:

Patches

optee_os.git

  • libmpa: Implement Montgomery ladder (40b1b28)

Workarounds

N/A

References

OP-TEE ID

OP-TEE-2016-0003

Reported by

Applus+ Laboratories

For more information

For more information regarding the security incident process in OP-TEE, please read the information that can be found when going to the "Security" page at https://www.trustedfirmware.org.

Severity

High

CVE ID

CVE-2017-1000413

Weaknesses

No CWEs