<?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>Swift-Crypto — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/tags/swift-crypto/</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>Fri, 03 Apr 2026 03:39:38 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/tags/swift-crypto/feed.xml" rel="self" type="application/rss+xml"/><item><title>Swift Crypto X-Wing HPKE Decapsulation Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2026-04-swift-crypto-xwing-hpke-decapsulation-vulnerability/</link><pubDate>Fri, 03 Apr 2026 03:39:38 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-04-swift-crypto-xwing-hpke-decapsulation-vulnerability/</guid><description>The X-Wing decapsulation path in swift-crypto accepts attacker-controlled encapsulated ciphertext bytes without enforcing the required fixed ciphertext length of 1120 bytes, leading to a potential out-of-bounds read.</description><content:encoded><![CDATA[<p>A vulnerability exists in the X-Wing decapsulation path within the swift-crypto library (versions 4.0.0 to 4.3.0). The vulnerability stems from the lack of proper validation of the encapsulated ciphertext length during the decapsulation process. Specifically, the <code>decapsulate</code> function of <code>OpenSSLXWingPrivateKeyImpl</code> does not perform a length check before passing the encapsulated data to the underlying C API, which expects a fixed-size buffer of 1120 bytes. This allows an attacker to supply a shorter ciphertext, leading to an out-of-bounds read when the C code attempts to access memory beyond the provided buffer. This issue can be triggered by initializing an <code>HPKE.Recipient</code> with a malformed <code>encapsulatedKey</code>. Exploitation of this vulnerability could potentially lead to a crash or memory disclosure.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker crafts a malformed HPKE encapsulated key with a length less than 1120 bytes.</li>
<li>The attacker initiates a connection to a service utilizing the swift-crypto library with X-Wing HPKE.</li>
<li>The service attempts to initialize an <code>HPKE.Recipient</code> with the attacker-controlled, malformed <code>encapsulatedKey</code>.</li>
<li>The <code>HPKE.Recipient</code> initialization calls the <code>decapsulate</code> function of <code>OpenSSLXWingPrivateKeyImpl</code>.</li>
<li>The <code>decapsulate</code> function passes the undersized <code>encapsulatedKey</code> to the <code>CCryptoBoringSSL_XWING_decap</code> C API without proper length validation.</li>
<li>The C API attempts to read 1120 bytes from the undersized buffer, resulting in an out-of-bounds read.</li>
<li>The out-of-bounds read can cause a crash or potentially leak sensitive memory contents.</li>
<li>The attacker may leverage the crash to cause a denial of service or use memory disclosure for further exploitation.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability allows a remote attacker to cause an out-of-bounds read in the swift-crypto library. This could lead to denial-of-service conditions due to application crashes, or potentially enable sensitive information disclosure, depending on the specific memory layout and runtime protections in place. The affected package is swift/swift-crypto (vulnerable versions: &gt;= 4.0.0, &lt;= 4.3.0).</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade the swift-crypto library to a patched version (greater than 4.3.0) to remediate the vulnerability and prevent out-of-bounds reads.</li>
<li>Implement input validation on the length of HPKE encapsulated keys before passing them to the <code>HPKE.Recipient</code> initializer to prevent the vulnerable code path from being reached.</li>
<li>Enable AddressSanitizer (ASan) during development and testing to detect memory safety issues like this one early.</li>
<li>Deploy the Sigma rule <code>Detect HPKE Recipient Init with Short Encapsulated Key</code> to identify attempts to exploit this vulnerability via short encapsulated key values.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>vulnerability</category><category>memory-safety</category><category>swift-crypto</category></item></channel></rss>