Critical severity9.8NVD Advisory· Published Apr 24, 2026· Updated Apr 28, 2026
CVE-2026-41681
CVE-2026-41681
Description
rust-openssl provides OpenSSL bindings for the Rust programming language. From 0.10.39 to before 0.10.78, EVP_DigestFinal() always writes EVP_MD_CTX_size(ctx) to the out buffer. If out is smaller than that, MdCtxRef::digest_final() writes past its end, usually corrupting the stack. This is reachable from safe Rust. This vulnerability is fixed in 0.10.78.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
opensslcrates.io | >= 0.10.39, < 0.10.78 | 0.10.78 |
Affected products
1- cpe:2.3:a:rust-openssl_project:rust-openssl:*:*:*:*:*:rust:*:*Range: >=0.10.39,<0.10.78
Patches
1826c3888b77aError for short out in MdCtxRef::digest_final() (#2608)
1 file changed · +13 −0
openssl/src/md_ctx.rs+13 −0 modified@@ -242,6 +242,10 @@ impl MdCtxRef { pub fn digest_final(&mut self, out: &mut [u8]) -> Result<usize, ErrorStack> { let mut len = u32::try_from(out.len()).unwrap_or(u32::MAX); + if self.size() > len as usize { + return Err(ErrorStack::get()); + } + unsafe { cvt(ffi::EVP_DigestFinal( self.as_ptr(), @@ -549,4 +553,13 @@ mod test { // Validate result of digest of "World" assert_eq!(reset_result, world_expected); } + + #[test] + fn digest_final_checks_length() { + let mut ctx = MdCtx::new().unwrap(); + ctx.digest_init(Md::sha256()).unwrap(); + ctx.digest_update(b"Some Crypto Text").unwrap(); + let mut digest = [0; 16]; + assert!(ctx.digest_final(&mut digest).is_err()); + } }
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
6- github.com/rust-openssl/rust-openssl/commit/826c3888b77add418b394770e2b2e3a72d9f92fenvdPatchWEB
- github.com/advisories/GHSA-ghm9-cr32-g9qjghsaADVISORY
- github.com/rust-openssl/rust-openssl/security/advisories/GHSA-ghm9-cr32-g9qjnvdVendor AdvisoryWEB
- nvd.nist.gov/vuln/detail/CVE-2026-41681ghsaADVISORY
- github.com/rust-openssl/rust-openssl/pull/2608nvdIssue TrackingWEB
- github.com/rust-openssl/rust-openssl/releases/tag/openssl-v0.10.78nvdRelease NotesWEB
News mentions
0No linked articles in our index yet.