ARM Mbedtls x509 ECDSA invalid public key Remote Code Execution Vulnerability
A specially crafted x509 certificate with an ECDSA public key using the secp224k1 curve causes mbedTLS to free a stack pointer during public key validation. An attacker acting as a client or server could deliver such a certificate to trigger a crash and potentially achieve remote code execution.
Originally disclosed on Cisco Talos
An exploitable free of a stack pointer vulnerability exists in the x509 certificate parsing code of ARM mbedTLS 2.4.0. A specially crafted x509 certificate, when parsed by mbedTLS library, can cause an invalid free of a stack pointer leading to a potential remote code execution.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a stack-allocated array is assigned to a bignum structure's pointer field, and later a reallocation routine attempts to free that stack pointer.
Impact
The vulnerability could lead to remote code execution in certain environments, though the zeroing of the freed memory complicates exploitation.
What the attacker needed
Attacker can act as client or server; victim parses attacker-supplied certificate
How it was found
- Craft an x509 certificate with an ECDSA public key using the secp224k1 curve.
- Supply the certificate to a vulnerable application that parses it with mbedTLS.
- The library validates the public key and invokes elliptic curve arithmetic.
- An invalid free of a stack pointer occurs, causing a crash.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a program reads a certificate, it checks the public key inside it. In this case, a malformed key made the program try to free memory that was on the stack (a special area for temporary data) instead of the heap (where dynamic memory lives). That kind of mistake can crash the program and, in some environments, let an attacker run their own code.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.