CVE-2024-45157
Medium · 5.1CVSS
5.1
EPSS
0.2%
Published
Sep 5, 2024
CISA due date
—
Cloudanix analysis
A configuration setting meant to choose a specific random-number method in Mbed TLS is ignored, so the library may quietly use a different method that could make secret values easier for an attacker to guess.
- Exploitation
- Local Privilege
- Attacker needs
- Local User
- Complexity
- High
- Impact
- Data Exposure
- Component
- Library
- Class
- Cryptographic Weakness
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Mbed TLS PSA subsystem ignores the user-selected HMAC_DRBG algorithm configured via MBEDTLS_PSA_HMAC_DRBG_MD_TYPE and instead falls back to CTR_DRBG unless both MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG and MBEDTLS_CTR_DRBG_C are disabled, causing the documented random-number generator to be bypassed.
Why it matters to the business
Cryptographic operations that rely on the configured DRBG may silently use a different generator, raising the risk of reduced entropy or predictability in keys and nonces on affected embedded devices and increasing exposure of sensitive data.
How an attack unfolds
An attacker with local access crafts inputs or observes outputs that depend on random values generated under the misconfigured PSA subsystem; when the fallback CTR_DRBG is used instead of the intended HMAC_DRBG the resulting values may exhibit statistical bias or lower entropy that the attacker can leverage to recover keys or forge tokens.
How to fix it
Upgrade Mbed TLS to version 2.28.9 or 3.6.1 (commit 71c569d44bf3a8bd53d874c81ee8ac644dd6e9e3). After upgrading, rebuild with the intended DRBG configuration and re-verify that MBEDTLS_PSA_HMAC_DRBG_MD_TYPE now correctly selects HMAC_DRBG under the documented conditions.
How to confirm the fix worked
Inspect the compiled library version string or build configuration; confirm that MBEDTLS_PSA_HMAC_DRBG_MD_TYPE is set and that the PSA random generator selection logic matches the updated documentation. Run regression tests that exercise PSA random APIs and assert the expected DRBG type is active.
Typical attack path
- Identify target systems running Mbed TLS versions before 2.28.9 or 3.6.1 with MBEDTLS_PSA_HMAC_DRBG_MD_TYPE enabled.
- Confirm that MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG and MBEDTLS_CTR_DRBG_C are not both disabled so the fallback occurs.
- Trigger cryptographic operations that consume randomness from the PSA subsystem.
- Collect or influence outputs that depend on the generated values and attempt to recover secrets or bypass protections.
How to detect it
Search build logs, configuration headers, and binary strings for MBEDTLS_PSA_HMAC_DRBG_MD_TYPE combined with the absence of both MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG and MBEDTLS_CTR_DRBG_C; review application logs for cryptographic operations that rely on PSA random generation to identify potential misuse of the fallback generator.
What your security team should do
- Prioritize upgrade of all Mbed TLS instances to the fixed releases within the next maintenance window.
- Audit build configurations to ensure the documented DRBG selection behavior is achieved after the update.
- Add version checks for Mbed TLS to continuous integration and dependency scanners.
- Review any downstream products that embed Mbed TLS for the same configuration exposure.
The record
An issue was discovered in Mbed TLS before 2.28.9 and 3.x before 3.6.1, in which the user-selected algorithm is not used. Unlike previously documented, enabling MBEDTLS_PSA_HMAC_DRBG_MD_TYPE does not cause the PSA subsystem to use HMAC_DRBG: it uses HMAC_DRBG only when MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG and MBEDTLS_CTR_DRBG_C are disabled.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Alpine:v3.17 | mbedtls | 0 | 2.28.9-r0 |
| Alpine:v3.18 | mbedtls | 0 | 2.28.9-r0 |
| Alpine:v3.19 | mbedtls | 0 | 2.28.9-r0 |
| Alpine:v3.20 | mbedtls | 0 | 3.6.1-r0 |
| Alpine:v3.21 | mbedtls | 0 | 3.6.1-r0 |
| Alpine:v3.22 | mbedtls | 0 | 3.6.1-r0 |
| Debian:11 | mbedtls | 0 | No fix |
| Debian:12 | mbedtls | 0 | No fix |
| Debian:13 | mbedtls | 0 | No fix |
| Debian:14 | mbedtls | 0 | No fix |
| Ubuntu:20.04:LTS | mbedtls | 0 | No fix |
| Ubuntu:22.04:LTS | mbedtls | 0 | No fix |
| Ubuntu:24.04:LTS | mbedtls | 0 | No fix |
| Ubuntu:24.10 | mbedtls | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | mbedtls | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | mbedtls | 0 | No fix |
| openSUSE:Leap 16.0 | mbedtls-2 | 0 | 2.28.10-bp160.1.1 |
| openSUSE:Tumbleweed | mbedtls-2 | 0 | 2.28.9-1.1 |
Related vulnerabilities
- CVE-2024-28960 An issue was discovered in Mbed TLS 2.18.0 through 2.28.x before 2.28.8 and 3.x before… Also affects mbedtls
- CVE-2024-23775 Integer Overflow vulnerability in Mbed TLS 2.x before 2.28.7 and 3.x before 3.5.2, allows… Also affects mbedtls
- CVE-2024-23170 An issue was discovered in Mbed TLS 2.x before 2.28.7 and 3.x before 3.5.2. Also affects mbedtls
- CVE-2023-43615 Mbed TLS 2.x before 2.28.5 and 3.x before 3.5.0 has a Buffer Overflow. Also affects mbedtls
- CVE-2022-35409 An issue was discovered in Mbed TLS before 2.28.1 and 3.x before 3.2.0. Also affects mbedtls
- CVE-2021-44732 Mbed TLS before 3.0.1 has a double free in certain out-of-memory conditions, as… Also affects mbedtls
- JLSEC-2025-187 Mbed TLS before 2.28.10 and 3.x before 3.6.3, in some cases of failed memory allocation… Also affects mbedtls
- CVE-2024-49195 Mbed TLS 3.5.x through 3.6.x before 3.6.2 has a buffer underrun in pkwrite when writing… Also affects mbedtls