Executive brief
Mirage-Crypto-EC is a cryptographic library for OCaml that handles elliptic curve operations, including digital signature verification and key exchange. A missing length check in the library allows an attacker to trigger an out-of-bounds memory read by providing a malformed compressed EC public key, potentially causing the application to crash or leak sensitive data from memory.
Technical details
The vulnerability is an out-of-bounds read (CWE-125) in the internal Point.of_octets function that fails to validate the length of input buffers for compressed elliptic curve points. The affected functions include Dsa.pub_of_octets and Dh.key_exchange across all NIST curves (P-256, P-384, P-521). An attacker can supply a short buffer as a compressed point, triggering an exception and memory access violation. The fix requires adding proper buffer length validation before processing compressed points. Version 2.3.0 and later include the corrective patch.
Affected products
- OCaml Mirage-Crypto-EC before 2.3.0
Timeline
- 2026-07-28: disclosed: Vulnerability reported to security@ocaml.org
- 2026-08-07: patched: mirage-crypto-ec 2.3.0 released with fix
- 2026-08-07: advisory: Security advisory published