CVE-2024-45158
Critical · 9.8CVSS
9.8
EPSS
0.7%
Published
Sep 5, 2024
CISA due date
—
Cloudanix analysis
A cryptography library flaw could let attackers seize control of or shut down affected systems if certain functions receive unexpected data.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Remote Code Execution
- Component
- Library
- Class
- Buffer Overflow
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
A stack buffer overflow occurs in mbedtls_ecdsa_der_to_raw() and mbedtls_ecdsa_raw_to_der() when the bits parameter exceeds the largest supported curve size, leading to memory corruption in configurations with PSA disabled where applications invoke these functions directly.
Why it matters to the business
Successful exploitation can result in remote code execution or denial of service, enabling attackers to compromise systems, exfiltrate data, or disrupt operations in environments relying on the vulnerable cryptography library.
How an attack unfolds
An attacker identifies an application that directly calls the affected functions, supplies crafted ECDSA data with an oversized bits parameter to trigger the overflow, and leverages the corruption to execute arbitrary code or crash the process.
How to fix it
Upgrade Mbed TLS to 3.6.1 or later. For mysql-client (Bitnami) update to version 10.4.25.
How to confirm the fix worked
Confirm the installed Mbed TLS version is at least 3.6.1, review application code for direct calls to the functions, and test with oversized bits parameters to ensure no overflow occurs.
Typical attack path
- Scan for applications exposing or using direct calls to mbedtls_ecdsa_der_to_raw or mbedtls_ecdsa_raw_to_der
- Craft malicious input containing an ECDSA structure with bits larger than supported curves
- Deliver the input to the target application to trigger the stack overflow
- Exploit memory corruption for code execution or service disruption
How to detect it
Monitor application logs and crash reports for errors related to ECDSA conversion functions or unexpected terminations when processing certificate or signature data; review process dumps for signs of stack corruption.
What your security team should do
- Immediately update all affected packages to the fixed versions listed
- Audit source code for any direct invocations of the vulnerable functions
- Implement input validation around ECDSA parameter handling in custom applications
The record
An issue was discovered in Mbed TLS 3.6 before 3.6.1. A stack buffer overflow in mbedtls_ecdsa_der_to_raw() and mbedtls_ecdsa_raw_to_der() can occur when the bits parameter is larger than the largest supported curve. In some configurations with PSA disabled, all values of bits are affected. (This never happens in internal library calls, but can affect applications that call these functions directly.)
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| 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 |
| 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:25.04 | mbedtls | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | mbedtls | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | mbedtls | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | mbedtls | 0 | No fix |
Related vulnerabilities
- 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
- CVE-2024-45159 An issue was discovered in Mbed TLS 3.x before 3.6.1. Also affects mbedtls
- CVE-2024-45157 An issue was discovered in Mbed TLS before 2.28.9 and 3.x before 3.6.1, in which the… Also affects mbedtls
- 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