<?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>Micronaut — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/vendors/micronaut/</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>Sat, 02 Nov 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/vendors/micronaut/feed.xml" rel="self" type="application/rss+xml"/><item><title>Micronaut TimeConverterRegistrar Memory Exhaustion via Accept-Language Header</title><link>https://feed.craftedsignal.io/briefs/2024-11-micronaut-dos/</link><pubDate>Sat, 02 Nov 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-11-micronaut-dos/</guid><description>Micronaut's `TimeConverterRegistrar` has an unbounded `formattersCache` that allows memory exhaustion via a crafted `Accept-Language` header, where an unauthenticated attacker can crash the JVM by sending requests with novel locale tags to `@Format`-annotated endpoints, growing the cache until heap memory is exhausted, affecting Micronaut applications with `micronaut-context` versions 4.3.0 and above, up to but not including 4.10.22.</description><content:encoded><![CDATA[<p>Micronaut&rsquo;s <code>TimeConverterRegistrar</code> component contains a vulnerability that can lead to denial-of-service (DoS). The <code>formattersCache</code> within <code>TimeConverterRegistrar</code> is an unbounded <code>ConcurrentHashMap</code> that caches <code>DateTimeFormatter</code> instances. The cache key is derived from the <code>@Format</code> annotation pattern concatenated with the locale obtained from the HTTP <code>Accept-Language</code> header. By sending HTTP requests with arbitrary BCP 47 private-use extensions in the <code>Accept-Language</code> header (e.g., <code>en-x-a001</code>, <code>en-x-a002</code>), an unauthenticated attacker can generate a large number of unique cache keys. This leads to uncontrolled memory consumption, eventually exhausting the available heap memory and causing the JVM to crash with an <code>OutOfMemoryError</code>. The vulnerability affects Micronaut applications that expose endpoints with <code>@Format</code>-annotated temporal parameters and exists in <code>micronaut-context</code> versions 4.3.0 and above, up to but not including 4.10.22. This is similar to GHSA-2hcp-gjrf-7fhc but affects a different cache.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker sends an HTTP request to a Micronaut server.</li>
<li>The request includes a crafted <code>Accept-Language</code> header with a novel BCP 47 private-use extension (e.g., <code>en-x-attacker</code>).</li>
<li>Micronaut&rsquo;s <code>HttpHeaders.findAcceptLanguage()</code> parses the <code>Accept-Language</code> header and extracts the locale using <code>Locale.forLanguageTag()</code>.</li>
<li>The extracted locale is passed to <code>AbstractRouteMatch.newContext()</code> and stored in the <code>ConversionContext</code>.</li>
<li>The request is routed to an endpoint with a <code>@Format</code>-annotated temporal parameter.</li>
<li><code>TimeConverterRegistrar.getFormatter(pattern, context)</code> is called to retrieve a <code>DateTimeFormatter</code> for the given pattern and locale.</li>
<li>Since the locale is novel, a new <code>DateTimeFormatter</code> is created and added to the unbounded <code>formattersCache</code> with the concatenated <code>pattern + locale</code> as the key.</li>
<li>The attacker repeats this process with many unique <code>Accept-Language</code> values, causing the <code>formattersCache</code> to grow without bounds, leading to an <code>OutOfMemoryError</code> and crashing the JVM, resulting in denial of service.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability allows an unauthenticated attacker to crash any Micronaut server that exposes an endpoint with a <code>@Format</code>-annotated temporal type parameter. The memory consumption grows linearly with the number of unique <code>Accept-Language</code> values sent by the attacker. Due to the large number of possible BCP 47 private-use extensions, attackers can easily exhaust server memory. This can lead to denial of service, disrupting legitimate users. The <code>TimeConverterRegistrar</code> is active in all Micronaut HTTP server applications by default.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Apply the fix pattern used for GHSA-2hcp-gjrf-7fhc by replacing the unbounded <code>ConcurrentHashMap</code> with a bounded <code>ConcurrentLinkedHashMap</code>.</li>
<li>Upgrade to <code>micronaut-context</code> version 4.10.22 or later to receive the patched version.</li>
<li>Monitor web server logs for a high volume of requests with unique <code>Accept-Language</code> headers using the provided Sigma rule.</li>
<li>Consider implementing rate limiting on requests with unique <code>Accept-Language</code> headers to mitigate the risk of exploitation.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>dos</category><category>memory-exhaustion</category><category>micronaut</category></item></channel></rss>