CVE-2025-52497
NoneCVSS
—
EPSS
0.3%
Published
Jul 4, 2025
CISA due date
—
Cloudanix analysis
A bug in a widely used encryption library can let attackers crash programs or potentially take them over by sending bad security certificate data.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Moderate
- Impact
- Other
- Component
- Library
- Class
- Buffer Overflow
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
One-byte heap-based buffer underflow in mbedtls_pem_read_buffer and two mbedtls_pk_parse functions during PEM parsing of untrusted input, enabling memory corruption.
Why it matters to the business
Applications using Mbed TLS for TLS or cryptographic operations risk denial of service or remote code execution, potentially disrupting secure communications across dependent systems and increasing patch urgency due to library prevalence.
How an attack unfolds
An attacker supplies a specially crafted malicious PEM input to trigger the one-byte underflow in parsing routines, allowing control over adjacent heap memory to achieve code execution or crashes.
How to fix it
Upgrade armmbed/mbedtls to the version containing commit c765c831e5c2a0971410692f92f7a81d6ec65ec2 or Mbed TLS 3.6.4 or newer; rebuild and redeploy all dependent applications.
How to confirm the fix worked
Confirm Mbed TLS version is 3.6.4 or later via build configuration or library metadata; fuzz PEM parsing functions with boundary and malformed inputs to verify absence of underflow.
Typical attack path
- Identify target application accepting untrusted PEM data such as certificates or keys
- Craft malicious PEM payload to induce buffer underflow in mbedtls_pem_read_buffer or mbedtls_pk_parse
- Deliver payload via network, file, or API to trigger parsing
- Exploit resulting heap state for arbitrary code execution or denial of service
How to detect it
Review application and library logs for segmentation faults or errors originating from mbedtls_pem_read_buffer and mbedtls_pk_parse during PEM processing; correlate with untrusted certificate ingestion events.
- mbedtls_pem_read_buffer
- mbedtls_pk_parse
What your security team should do
- Immediately update Mbed TLS to fixed version across all products and rebuild dependents
- Scan codebases and dependency graphs for Mbed TLS usage to prioritize high-exposure instances
- Add runtime input sanitization for PEM data where feasible until patching completes
- Monitor EPSS trend and re-evaluate exploit maturity as new information emerges
The record
Mbed TLS before 3.6.4 has a PEM parsing one-byte heap-based buffer underflow, in mbedtls_pem_read_buffer and two mbedtls_pk_parse functions, via untrusted PEM input.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Alpine:v3.20 | mbedtls | 0 | 3.6.4-r0 |
| Alpine:v3.21 | mbedtls | 0 | 3.6.4-r0 |
| Alpine:v3.22 | mbedtls | 0 | 3.6.4-r0 |
| Debian:11 | mbedtls | 0 | No fix |
| Debian:12 | mbedtls | 0 | No fix |
| Debian:13 | mbedtls | 0 | No fix |
| Debian:14 | mbedtls | 0 | 3.6.4-1 |
| openSUSE:Leap 16.0 | mbedtls | 0 | 3.6.6-bp160.1.1 |
Related vulnerabilities
- CVE-2025-47917 Mbed TLS before 3.6.4 allows a use-after-free in certain situations of applications that… Also affects mbedtls
- CVE-2025-48965 Mbed TLS before 3.6.4 has a NULL pointer dereference because… Also affects mbedtls
- CVE-2025-52496 Mbed TLS before 3.6.4 has a race condition in AESNI detection if certain compiler… Also affects mbedtls
- CVE-2025-27810 Mbed TLS before 2.28.10 and 3.x before 3.6.3, in some cases of failed memory allocation… Also affects mbedtls
- CVE-2025-27809 Mbed TLS before 2.28.10 and 3.x before 3.6.3, on the client side, accepts servers that… 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-45158 An issue was discovered in Mbed TLS 3.6 before 3.6.1. Also affects mbedtls
- CVE-2024-45159 An issue was discovered in Mbed TLS 3.x before 3.6.1. Also affects mbedtls