Skip to main content

rust-openssl CVE-2026-41681

HIGH
Stack-based Buffer Overflow (CWE-121)
2026-04-22 https://github.com/rust-openssl/rust-openssl GHSA-ghm9-cr32-g9qj
8.1
CVSS 4.0 · Vendor: https://github.com/rust-openssl/rust-openssl
Share

Severity by source

Vendor (https://github.com/rust-openssl/rust-openssl) PRIMARY
8.1 HIGH
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:U/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Primary rating from Vendor (https://github.com/rust-openssl/rust-openssl) · only source for this CVE.

CVSS VectorVendor: https://github.com/rust-openssl/rust-openssl

CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:U/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
X

Lifecycle Timeline

6
Re-analysis Queued
Apr 24, 2026 - 18:22 vuln.today
cvss_changed
CVSS changed
Apr 24, 2026 - 18:22 NVD
8.1 (HIGH)
Analysis Generated
Apr 23, 2026 - 06:53 vuln.today
Analysis Generated
Apr 22, 2026 - 21:16 vuln.today
Patch released
Apr 22, 2026 - 21:16 nvd
Patch available
CVE Published
Apr 22, 2026 - 21:05 nvd
HIGH 8.1

DescriptionCVE.org

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.

AnalysisAI

Stack-based buffer overflow in rust-openssl's MdCtxRef::digest_final() allows safe Rust code to corrupt memory when EVP_DigestFinal() writes beyond the provided output buffer boundary. The vulnerability occurs when the output buffer is smaller than EVP_MD_CTX_size(ctx), causing EVP_DigestFinal() to write past the buffer end and corrupt stack memory. Vendor-released patch available in version 0.10.78 via GitHub commit 826c3888. No public exploit identified at time of analysis, but exploitable from memory-safe Rust code paths, violating Rust's safety guarantees.

Technical ContextAI

This vulnerability affects the rust-openssl crate (pkg:rust/openssl), a Rust binding to the OpenSSL cryptographic library. The root cause is CWE-121 (Stack-based Buffer Overflow) in the MdCtxRef::digest_final() wrapper function. OpenSSL's EVP_DigestFinal() function unconditionally writes a fixed number of bytes determined by EVP_MD_CTX_size(ctx) to the output buffer, typically 16-64 bytes depending on the hash algorithm (MD5=16, SHA-256=32, SHA-512=64). The Rust binding failed to validate that the caller-provided output buffer was large enough before invoking the native OpenSSL function. This breaks Rust's memory safety model by allowing stack corruption from safe (non-unsafe) Rust code, which should be impossible in a correctly implemented safe API. The vulnerability exists in the binding layer between Rust's type system and OpenSSL's C API, where proper bounds checking was omitted.

RemediationAI

Upgrade rust-openssl to version 0.10.78 or later, which contains the fix implemented in commit 826c3888b77add418b394770e2b2e3a72d9f92fe (https://github.com/rust-openssl/rust-openssl/commit/826c3888b77add418b394770e2b2e3a72d9f92fe). Update the dependency in Cargo.toml to openssl = "0.10.78" and run cargo update. Review the patch at https://github.com/rust-openssl/rust-openssl/pull/2608 to understand the fix implementation. If immediate upgrade is not feasible, implement a temporary workaround by manually validating that output buffers passed to MdCtxRef::digest_final() are sized to at least EVP_MD_size() bytes for the hash algorithm in use (16 bytes for MD5, 32 for SHA-256, 64 for SHA-512). This requires calling unsafe OpenSSL FFI functions directly to check digest size before allocation, negating the safety benefits of the Rust wrapper. Alternatively, allocate conservatively large output buffers (64+ bytes) for all digest operations and accept the memory overhead, though this doesn't address the underlying API safety violation. Consult the full advisory at https://github.com/advisories/GHSA-ghm9-cr32-g9qj for additional context.

Share

CVE-2026-41681 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy