rust-openssl: Deriver::derive and PkeyCtxRef::derive can overflow short buffers on OpenSSL 1.1.1
High severity
GitHub Reviewed
Published
Apr 19, 2026
in
rust-openssl/rust-openssl
•
Updated Apr 27, 2026
Description
Published to the GitHub Advisory Database
Apr 22, 2026
Reviewed
Apr 22, 2026
Published by the National Vulnerability Database
Apr 24, 2026
Last updated
Apr 27, 2026
Deriver::derive(andPkeyCtxRef::derive) setslen = buf.len()and passes it as the in/out length toEVP_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.References