<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>OpenSSL — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/vendors/openssl/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata — refreshed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Mon, 29 Jan 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/vendors/openssl/feed.xml" rel="self" type="application/rss+xml"/><item><title>rust-openssl AES Key Wrap Out-of-Bounds Write Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2024-01-openssl-oob-write/</link><pubDate>Mon, 29 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-openssl-oob-write/</guid><description>The rust-openssl package is vulnerable to an out-of-bounds write due to an incorrect bounds assertion in the `aes::unwrap_key()` function, potentially leading to arbitrary code execution if attacker-controlled buffer sizes are permitted.</description><content:encoded><![CDATA[<p>The rust-openssl crate, specifically versions 0.10.24 through 0.10.77, contains a critical vulnerability in the <code>aes::unwrap_key()</code> function. This function is intended to perform AES key wrapping, a process used to securely encrypt cryptographic keys. The vulnerability arises from an inverted bounds check on the output buffer size, where the function incorrectly validates the size of the output buffer against the input buffer size. This flaw allows an attacker to potentially write beyond the allocated memory region, leading to a crash or, in more sophisticated scenarios, arbitrary code execution. Exploitation requires that the vulnerable application utilizes AES keywrap and allows the attacker to control the buffer sizes passed to <code>aes::unwrap_key()</code>.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker identifies an application using the vulnerable rust-openssl crate (versions 0.10.24 - 0.10.77) and the <code>aes::unwrap_key()</code> function.</li>
<li>The attacker crafts a malicious input with specific sizes for the input and output buffers to trigger the vulnerability.</li>
<li>The attacker provides a crafted input buffer (<code>in_</code>) and a smaller-than-required output buffer (<code>out</code>) to the vulnerable <code>aes::unwrap_key()</code> function.</li>
<li>The incorrect bounds assertion <code>out.len() + 8 &lt;= in_.len()</code> passes, as the <code>out</code> buffer is intentionally smaller than <code>in_.len() - 8</code>.</li>
<li>The <code>aes::unwrap_key()</code> function proceeds with the AES key wrapping process.</li>
<li>During the key unwrapping process, the function attempts to write <code>in_.len() - 8 - out.len()</code> bytes beyond the allocated boundary of the <code>out</code> buffer.</li>
<li>This out-of-bounds write corrupts adjacent memory regions within the application&rsquo;s address space.</li>
<li>Depending on the overwritten memory, the attacker can potentially achieve arbitrary code execution or cause a denial-of-service condition.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability can lead to various adverse consequences, including denial of service, information disclosure, or arbitrary code execution. Applications utilizing AES keywrap and accepting attacker-controlled buffer sizes are at the highest risk. The specific impact depends on the application&rsquo;s memory layout and the attacker&rsquo;s ability to control the overwritten memory. Given the widespread use of OpenSSL for cryptographic operations, this vulnerability poses a significant threat to vulnerable applications.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade the <code>rust-openssl</code> crate to version 0.10.78 or later to patch the vulnerability as indicated in <a href="https://github.com/advisories/GHSA-8c75-8mhr-p7r9">GHSA-8c75-8mhr-p7r9</a>.</li>
<li>Audit code using <code>aes::unwrap_key()</code> to ensure input and output buffer sizes are validated correctly to prevent out-of-bounds writes.</li>
<li>Implement runtime memory protection mechanisms to detect and prevent out-of-bounds writes, mitigating the impact of this and similar vulnerabilities.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>openssl</category><category>aes</category><category>keywrap</category><category>oob-write</category><category>memory-corruption</category></item><item><title>rust-openssl Stack Buffer Overflow Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2024-01-03-rust-openssl-buffer-overflow/</link><pubDate>Wed, 03 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-03-rust-openssl-buffer-overflow/</guid><description>The rust-openssl crate is vulnerable to a stack-based buffer overflow (CVE-2026-41681) where the `EVP_DigestFinal()` function writes beyond the allocated buffer, potentially corrupting the stack, affecting versions &gt;= 0.10.39 and &lt; 0.10.78.</description><content:encoded><![CDATA[<p>The <code>rust-openssl</code> crate, a Rust wrapper for the OpenSSL library, is susceptible to a critical vulnerability (CVE-2026-41681) stemming from a buffer overflow within the <code>MdCtxRef::digest_final()</code> function. This flaw arises because <code>EVP_DigestFinal()</code> unconditionally writes <code>EVP_MD_CTX_size(ctx)</code> bytes to the provided output buffer (<code>out</code>), without verifying if the buffer&rsquo;s allocated size is sufficient. Consequently, if <code>out</code> is smaller than the size dictated by <code>EVP_MD_CTX_size(ctx)</code>, a write-out-of-bounds condition occurs, potentially leading to stack corruption. The vulnerability is reachable from safe Rust code, making it a significant concern for applications utilizing the affected versions of the <code>rust-openssl</code> crate. Specifically, versions 0.10.39 up to (but not including) 0.10.78 are affected.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker crafts a Rust application that utilizes the <code>rust-openssl</code> crate.</li>
<li>The application initiates a digest operation using <code>EVP_DigestInit()</code> to set up the message digest context.</li>
<li>The application feeds data into the digest context using <code>EVP_DigestUpdate()</code>.</li>
<li>The application calls <code>MdCtxRef::digest_final()</code> via safe Rust.</li>
<li>Internally, <code>EVP_DigestFinal()</code> is called without proper bounds checking.</li>
<li><code>EVP_DigestFinal()</code> attempts to write <code>EVP_MD_CTX_size(ctx)</code> bytes to the <code>out</code> buffer.</li>
<li>If <code>out</code> is smaller than the expected size, a stack-based buffer overflow occurs as data is written beyond the allocated memory region.</li>
<li>This overflow overwrites adjacent memory on the stack, potentially corrupting critical program data or control flow structures, leading to crashes or arbitrary code execution.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability allows an attacker to potentially achieve arbitrary code execution within the context of the affected application. This could lead to complete system compromise, data breaches, or denial-of-service conditions. Given that the vulnerability is reachable from safe Rust, applications relying on vulnerable versions of the <code>rust-openssl</code> crate are at risk. The vulnerability can cause stack corruption, leading to unpredictable behavior and potential application crashes.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade the <code>rust-openssl</code> crate to version 0.10.78 or later to remediate CVE-2026-41681.</li>
<li>Implement robust input validation and size checks when using the <code>rust-openssl</code> crate, specifically when handling digest operations, to prevent buffer overflows.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>buffer overflow</category><category>rust</category><category>openssl</category><category>vulnerability</category></item><item><title>Heap/Stack Overflow in rust-openssl with OpenSSL 1.1.x</title><link>https://feed.craftedsignal.io/briefs/2024-01-03-openssl-overflow/</link><pubDate>Wed, 03 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-03-openssl-overflow/</guid><description>The rust-openssl crate's `Deriver::derive` and `PkeyCtxRef::derive` functions can cause heap/stack overflows when used with OpenSSL 1.1.x due to insufficient buffer length validation in X25519, X448, DH, and HKDF-extract, affecting rust-openssl versions &gt;= 0.9.27 and &lt; 0.10.78.</description><content:encoded><![CDATA[<p>The <code>rust-openssl</code> crate, specifically the <code>Deriver::derive</code> and <code>PkeyCtxRef::derive</code> functions, is vulnerable to a heap/stack overflow when used in conjunction with OpenSSL version 1.1.x. This occurs because the <code>EVP_PKEY_derive</code> function in OpenSSL 1.1.x fails to properly validate the input buffer length when used with X25519, X448, DH, and HKDF-extract. These key derivation functions unconditionally write the full shared secret (32/56/prime-size bytes) regardless of the buffer size provided by the caller, leading to a buffer overflow if the provided slice is too small. This vulnerability affects rust-openssl versions &gt;= 0.9.27 and &lt; 0.10.78. This vulnerability is mitigated in OpenSSL 3.x because the providers check buffer length.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker crafts a malicious application using the <code>rust-openssl</code> crate.</li>
<li>The application uses <code>Deriver::derive</code> or <code>PkeyCtxRef::derive</code> with an X25519, X448, DH, or HKDF-extract key agreement algorithm.</li>
<li>The application provides a buffer smaller than the expected output size of the key derivation function (32 bytes for X25519, 56 bytes for X448, prime-size bytes for DH).</li>
<li>The <code>EVP_PKEY_derive</code> function in OpenSSL 1.1.x is called without proper buffer length validation.</li>
<li>The key derivation function writes the full shared secret to the undersized buffer.</li>
<li>A heap or stack buffer overflow occurs, overwriting adjacent memory.</li>
<li>The attacker gains control of the application&rsquo;s execution flow.</li>
<li>The attacker executes arbitrary code on the target system.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability can lead to arbitrary code execution within the context of the vulnerable application. This could allow an attacker to gain complete control of the affected system. The number of victims depends on the prevalence of vulnerable <code>rust-openssl</code> versions being used with OpenSSL 1.1.x. Sectors that rely on <code>rust-openssl</code> for cryptographic operations are at higher risk.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade the <code>rust-openssl</code> crate to version &gt;= 0.10.78 to patch the vulnerability (see Overview).</li>
<li>If upgrading <code>rust-openssl</code> is not immediately feasible, ensure that OpenSSL is upgraded to version 3.x, where the buffer length is checked (see Overview).</li>
<li>Implement runtime checks to validate buffer lengths before calling <code>Deriver::derive</code> and <code>PkeyCtxRef::derive</code> when using X25519, X448, DH, or HKDF-extract (see Attack Chain).</li>
<li>Deploy the Sigma rule provided below to detect potential exploitation attempts (see Rules).</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>openssl</category><category>buffer-overflow</category><category>rust</category><category>cryptography</category></item></channel></rss>