<?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>Nerdbank.MessagePack (&lt; 1.1.62) — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/nerdbank.messagepack--1.1.62/</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, 26 Jan 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/nerdbank.messagepack--1.1.62/feed.xml" rel="self" type="application/rss+xml"/><item><title>Nerdbank.MessagePack DateTime Decoding Stack Overflow Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2024-01-nerdbank-stack-overflow/</link><pubDate>Fri, 26 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-nerdbank-stack-overflow/</guid><description>A malicious MessagePack payload can trigger a StackOverflowException in Nerdbank.MessagePack due to an uncontrolled stack allocation when decoding DateTime values with oversized timestamp extension lengths, leading to process termination.</description><content:encoded><![CDATA[<p>Nerdbank.MessagePack versions prior to 1.1.62 are vulnerable to an uncontrolled stack allocation vulnerability. This flaw allows an attacker to craft a malicious MessagePack payload that declares an oversized timestamp extension length. When the application attempts to deserialize this payload and encounters a <code>DateTime</code> value, the reader allocates an attacker-controlled number of bytes on the stack. This excessive allocation results in a <code>StackOverflowException</code>, causing the application to terminate. This vulnerability impacts applications that deserialize MessagePack data from untrusted sources and can lead to denial-of-service conditions. Defenders should prioritize patching or implementing workarounds to mitigate this risk.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker crafts a malicious MessagePack payload with an invalid timestamp extension length (not 4, 8, or 12 bytes).</li>
<li>The target application receives the malicious MessagePack payload from an untrusted source.</li>
<li>The application attempts to deserialize the MessagePack data using Nerdbank.MessagePack.</li>
<li>During deserialization, the <code>DateTime</code> decoder encounters the malicious timestamp extension.</li>
<li>The decoder derives <code>tokenSize</code> from the attacker-controlled extension length <em>before</em> validating its size.</li>
<li>The unvalidated size is used in a <code>stackalloc</code> on the streaming reader&rsquo;s slow path, allocating an excessive amount of stack memory.</li>
<li>The excessive stack allocation triggers a <code>StackOverflowException</code>.</li>
<li>The <code>StackOverflowException</code> terminates the application process, resulting in a denial of service.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability leads to a denial-of-service condition due to process termination. The vulnerability affects applications deserializing MessagePack data from untrusted sources, particularly those handling long-running processes such as services, APIs, workers, or message consumers. Even small malicious payloads can trigger the vulnerability due to the attacker-controlled extension length. This could potentially disrupt critical business functions relying on affected applications.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade to Nerdbank.MessagePack version 1.1.62 or later to remediate the vulnerability.</li>
<li>Implement pre-validation of MessagePack extension headers, rejecting timestamp extensions with lengths other than 4, 8, or 12 bytes, as suggested in the advisory [GHSA-2cwq-pwfr-wcw3].</li>
<li>Deploy the Sigma rule &ldquo;Nerdbank MessagePack Suspicious Stack Allocation&rdquo; to detect potential exploitation attempts in your environment.</li>
<li>If immediate patching is not feasible, consider running deserialization of untrusted payloads in isolated processes that can be safely restarted, as described in [GHSA-2cwq-pwfr-wcw3].</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>denial-of-service</category><category>stack-overflow</category><category>messagepack</category></item></channel></rss>