<?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>Keywrap — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/tags/keywrap/</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/tags/keywrap/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></channel></rss>