Executive brief
rust-openssl is a library that allows Rust applications to use OpenSSL for secure communications and cryptography. A flaw in how the library handles message digests could allow an attacker to trigger a memory corruption, potentially leading to a complete system compromise or service crash. This issue is particularly significant because it can be triggered even when using the library's 'safe' programming interfaces.
Technical details
A stack-based buffer overflow exists in the rust-openssl library within the MdCtxRef::digest_final() function. The underlying OpenSSL EVP_DigestFinal() call writes a fixed number of bytes based on the context size without verifying that the provided Rust output buffer is large enough. Because this function is exposed to 'safe' Rust code, it bypasses typical memory safety guarantees, leading to stack corruption. An attacker who can influence the data being hashed or the expected digest size could potentially achieve remote code execution. The vulnerability is addressed in version 0.10.78 by adding a bounds check that returns an error if the output buffer is too small.
Affected products
- rust-openssl project rust-openssl >= 0.10.39, < 0.10.78
Timeline
- 2026-04-19: patched: Fix merged into master and version 0.10.78 released
- 2026-04-19: advisory: GitHub Security Advisory GHSA-ghm9-cr32-g9qj published
- 2026-04-24: disclosed: CVE-2026-41681 published to NVD
References
- https://github.com/rust-openssl/rust-openssl/commit/826c3888b77add418b394770e2b2e3a72d9f92fe
- https://github.com/rust-openssl/rust-openssl/pull/2608
- https://github.com/rust-openssl/rust-openssl/releases/tag/openssl-v0.10.78
- https://github.com/rust-openssl/rust-openssl/security/advisories/GHSA-ghm9-cr32-g9qj