Mbed TLS's modular inversion routine and GCD routine are vulnerable to local timing attacks in a number of settings discussed below.
These functions are used in RSA, making the following operations vulnerable in all configurations:
mbedtls_rsa_gen_key() and all
psa_generate_key*() functions).mbedtls_rsa_complete() to import RSA private keys that are incomplete
or not in the standard format. (The only exception is when
MBEDTLS_RSA_NO_CRT is enabled and all of N, E, D, P and Q have
been set before calling mbedtls_rsa_complete().) (Note: internal uses of
mbedtls_rsa_complete() in the library are always safe.)Additionally, if MBEDTLS_RSA_NO_CRT is enabled, the following operations are
also vulnerable:
psa_import_key().Additionally, if MBEDTLS_RSA_NO_CRT and MBEDTLS_USE_PSA_CRYPTO are both
enabled, the following operations are also vulnerable:
mbedtls_pk_sign(), mbedtls_pk_sign_ext()).mbedtls_pk_decrypt()).Elliptic curve cryptography (ECDSA, ECDH, EC-JPAKE) is not affected as the vulnerable functions are used in a safe way (with blinding).
Finite-field Diffie-Hellman (FFDH) is not affected as it does not use the vulnerable functions.
Direct use of mbedtls_mpi_inv_mod() by applications on secret data is most
likely vulnerable unless you use proper blinding.
Direct use of mbedtls_mpi_gcd() by applications on secret data is most likely
vulnerable, unless the compiler used has __builtin_ctz (GCC 10 and above has
it, earlier versions don't), and it is not implemented using a loop (most
architectures have instructions that are more efficient than using a loop).
When one of the vulnerable RSA functions mentioned above is used, the vulnerability allows the attacker to fully recover the RSA private key.
When mbedtls_mpi_mod_inv() is directly called by an application (or
mbedtls_mpi_gcd() in a build where it is affected, see above), the
vulnerability allows the attacker to recover both inputs.
The side channels in GCD and modular inversion can be exploited by a local
attacker in a number of circumstances. Two teams independently developed tools
allowing to trace a victim process, recover the inputs to
mbedtls_mpi_mod_inv() and break RSA key generation:
mbedtls_rsa_gen_key() and the same
principle applies to other unblinded uses of mbedtls_mpi_inv_mod().mbedtls_rsa_gen_key() and mbedtls_rsa_complete(). Several other
exploitation paths in RSA are identified. In particular, mbedtls_mpi_gcd()
is found to be vulnerable when Mbed TLS is compiled with a compiler that does
not have __builtin_ctz.The same functions are most probably also vulnerable in other circumstances using similar attack techniques: SGX-Step, SEV-Step, microarchitectural attacks similar to SSBleed...
SSBleed: Chang Liu from Tsinghua University and Trevor E. Carlson from National University of Singapore
M-Step: Cristiano Rodrigues (University of Minho), Marton Bognar (DistriNet, KU Leuven), Sandro Pinto (University of Minho), Jo Van Bulck (DistriNet, KU Leuven)
All versions of Mbed TLS up to 3.6.4 are affected.
Applications that do not generate RSA keys and do not import private RSA keys
with mbedtls_rsa_import()+mbedtls_rsa_complete(), but use other RSA
functions that are only vulnerable with MBEDTLS_RSA_NO_CRT, can recompile
without MBEDTLS_RSA_NO_CRT.
Applications that do not use RSA private keys and do not directly call
mbedtls_mpi_inv_mod() or mbedtls_mpi_gcd() are not affected.
Affected users should upgrade to Mbed TLS 3.6.5 or TF-PSA-Crypto 1.0.
{
"license": "CC-BY-4.0",
"sources": [
{
"published": "2025-10-20T22:15:37.060Z",
"url": "https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2025-54764",
"modified": "2025-10-31T15:09:59.620Z",
"html_url": "https://nvd.nist.gov/vuln/detail/CVE-2025-54764",
"id": "CVE-2025-54764",
"imported": "2025-11-20T23:04:03.392Z"
}
]
}