7.2high
rust-openssl: Deriver::derive and PkeyCtxRef::derive can overflow short buffers on OpenSSL 1.1.1
- Severity
- 7.2high CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.48% (higher than 33% of CVEs)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-pqf5-4pqq-29f5RUSTSEC-2026-0473
Description
rust-openssl provides OpenSSL bindings for the Rust programming language. From 0.9.27 to before 0.10.78, Deriver::derive (and PkeyCtxRef::derive) sets len = buf.len() and passes it as the in/out length to EVP_PKEY_derive, relying on OpenSSL to honor it. On OpenSSL 1.1.x, X25519, X448, DH and HKDF-extract ignore the incoming *keylen, unconditionally writing the full shared secret (32/56/prime-size bytes). A caller passing a short slice gets a heap/stack overflow from safe code. OpenSSL 3.x providers do check, so this only impacts older OpenSSL. This vulnerability is fixed in 0.10.78.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| rust-openssl rust-openssl | >= 0.9.27, < 0.10.78 | CVE List |
| openssl (crates.io) | from 0.9.27 before 0.10.78 | GitHub Advisory Database, RustSec Advisory Database |
| rust-openssl_project rust-openssl | from 0.9.27 before 0.10.78 | NVD |
All scores
| GitHub_M | 7.2high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:U |
| GitHub | high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:U |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
Classification
What each source says
CVE List
rust-openssl provides OpenSSL bindings for the Rust programming language. From 0.9.27 to before 0.10.78, Deriver::derive (and PkeyCtxRef::derive) sets len = buf.len() and passes it as the in/out length to EVP_PKEY_derive, relying on OpenSSL to honor it. On OpenSSL 1.1.x, X25519, X448, DH and HKDF-extract ignore the incoming *keylen, unconditionally writing the full shared secret (32/56/prime-size bytes). A caller passing a short slice gets a heap/stack overflow from safe code. OpenSSL 3.x providers do check, so this only impacts older OpenSSL. This vulnerability is fixed in 0.10.78.
GitHub Advisory Database
Deriver::derive (and PkeyCtxRef::derive) sets len = buf.len() and passes it as the in/out length to EVP_PKEY_derive, relying on OpenSSL to honor it. On OpenSSL 1.1.x, X25519, X448, DH and HKDF-extract ignore the incoming *keylen, unconditionally writing the full shared secret (32/56/prime-size bytes). A caller passing a short slice gets a heap/stack overflow from safe code. OpenSSL 3.x providers do check, so this only impacts older OpenSSL.
RustSec Advisory Database
Deriver::derive and PkeyCtxRef::derive pass the length of the caller's buffer to EVP_PKEY_derive and rely on OpenSSL to write no more than that. With OpenSSL 1.1.x, the X25519, X448 and HKDF-extract implementations ignore the length they are given and always write the whole result, so a buffer shorter than the shared secret or derived key is overrun. The overflow is reachable from safe code.
OpenSSL 3.x checks the length itself and is not affected. From 0.10.78, when built against OpenSSL 1.1.x or LibreSSL, both functions derive into a temporary buffer of the required size whenever the caller's buffer is too short, and copy only what fits.
NVD (es)
rust-openssl proporciona enlaces de OpenSSL para el lenguaje de programación Rust. Desde 0.9.27 hasta antes de 0.10.78, Deriver::derive (y PkeyCtxRef::derive) establece len = buf.len() y lo pasa como la longitud de entrada/salida a EVP_PKEY_derive, confiando en que OpenSSL lo respete. En OpenSSL 1.1.x, X25519, X448, DH y HKDF-extract ignoran el keylen entrante, escribiendo incondicionalmente el secreto compartido completo (32/56/tamaño-primo bytes). Un llamador que pasa un segmento corto obtiene un desbordamiento de montón/pila desde código seguro. Los proveedores de OpenSSL 3.x sí verifican, por lo que esto solo afecta a versiones anteriores de OpenSSL. Esta vulnerabilidad está corregida en 0.10.78.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-41676 changed 2026-04-24 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-pqf5-4pqq-29f5 changed 2026-11-10 | CC-BY-4.0 |
| RustSec Advisory Database | RUSTSEC-2026-0473 changed 2026-11-10 | CC0-1.0 |
| NVD | CVE-2026-41676 changed 2026-11-11 | Public domain |