<?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>Liquidjs — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/tags/liquidjs/</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>Wed, 25 Mar 2026 17:44:23 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/tags/liquidjs/feed.xml" rel="self" type="application/rss+xml"/><item><title>LiquidJS replace_first Filter Exponential Memory Amplification DoS</title><link>https://feed.craftedsignal.io/briefs/2024-02-liquidjs-dos/</link><pubDate>Wed, 25 Mar 2026 17:44:23 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-02-liquidjs-dos/</guid><description>The `replace_first` filter in LiquidJS is vulnerable to exponential memory amplification due to its use of JavaScript's `String.prototype.replace()` and mishandling of the `$&amp;` backreference pattern, allowing attackers to bypass the `memoryLimit` and cause denial of service.</description><content:encoded><![CDATA[<p>LiquidJS version 10.24.0 and earlier contains a vulnerability in its <code>replace_first</code> filter that allows for exponential memory amplification. The <code>replace_first</code> filter delegates to JavaScript&rsquo;s native <code>String.prototype.replace()</code>, which interprets <code>$&amp;</code> as a backreference to the matched substring. The filter only charges the input string length against the configured <code>memoryLimit</code>, not the amplified output. An attacker can exploit this by crafting a Liquid template with a replacement string containing multiple repetitions of <code>$&amp;</code>, causing the output string to grow exponentially with each replacement. By chaining this technique across multiple variable assignments, an attacker can easily exhaust available memory, leading to a denial-of-service condition. This vulnerability affects applications that render user-provided Liquid templates, such as CMS platforms, newsletter editors, and SaaS platforms.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>The attacker crafts a malicious Liquid template.</li>
<li>The template uses the <code>replace_first</code> filter with a pattern containing multiple <code>$&amp;</code> backreferences. For example: <code>{% assign s = &quot;A&quot; %}{% assign s = s | replace_first: s, &quot;$&amp;$&amp;$&amp;...(50 times)...$&amp;&quot; %}</code>.</li>
<li>The LiquidJS engine parses the template.</li>
<li>The <code>replace_first</code> filter is called.</li>
<li>The filter utilizes the native <code>String.prototype.replace()</code> method to perform the replacement.</li>
<li>Each instance of <code>$&amp;</code> in the replacement string is expanded to the matched substring, causing the output string to grow exponentially.</li>
<li>The expanded string consumes excessive memory, potentially exceeding available resources.</li>
<li>The application crashes or becomes unresponsive, resulting in a denial-of-service condition.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability can lead to a denial-of-service condition. A single request can allocate hundreds of megabytes of memory, and concurrent requests can cause complete service unavailability. The Node.js event loop is blocked, and legitimate user requests are stalled. Empirical results have demonstrated that with 20 concurrent requests, legitimate users experience up to 13-second delays. Each attack request costs only a few hundred bytes, making it easy to launch a large-scale attack.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Apply a patch to LiquidJS that properly accounts for memory usage when using the <code>replace_first</code> filter with backreferences.</li>
<li>Alternatively, disable or remove the <code>replace_first</code> filter entirely and use the <code>replace</code> filter instead, which treats <code>$&amp;</code> as a literal string.</li>
<li>Implement input validation and sanitization to prevent the use of <code>$&amp;</code> backreferences in user-provided Liquid templates.</li>
<li>Monitor web server logs for suspicious requests containing Liquid templates with excessive use of the <code>replace_first</code> filter and <code>$&amp;</code> patterns using the Sigma rule below.</li>
<li>Implement rate limiting to mitigate the impact of denial-of-service attacks.</li>
<li>Increase the <code>memoryLimit</code> configuration value to provide a temporary buffer against memory exhaustion, but this will not fully prevent the attack.</li>
</ul>
]]></content:encoded><category domain="severity">critical</category><category domain="type">advisory</category><category>liquidjs</category><category>denial-of-service</category><category>memory-amplification</category></item><item><title>liquidjs Denial of Service via Circular Block Reference</title><link>https://feed.craftedsignal.io/briefs/2024-01-03-liquidjs-dos/</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-liquidjs-dos/</guid><description>A vulnerability in liquidjs versions prior to 10.25.7 allows for denial of service due to a circular block reference in the layout, causing an infinite recursive loop that exhausts memory and crashes the Node.js process.</description><content:encoded><![CDATA[<p>The liquidjs template engine, in versions prior to 10.25.7, is vulnerable to a denial-of-service (DoS) attack. This vulnerability stems from the improper handling of circular block references within the <code>{% layout %}</code> and <code>{% block %}</code> tags. When a template contains a nested block with the same name as an outer block, the rendering process enters an infinite recursive loop. This loop rapidly consumes available memory, leading to a &ldquo;JavaScript heap out of memory&rdquo; error and the subsequent crashing of the Node.js process. The vulnerability allows any user capable of submitting a Liquid template to trigger the DoS. This is especially concerning for CMS platforms, email template builders, and multi-tenant SaaS products.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker crafts a malicious Liquid template containing circular block references, specifically nesting a block with the same name inside another block. For example, <code>{% block a %}outer-a {% block a %}inner-a{% endblock %}{% endblock %}</code>.</li>
<li>The attacker submits this crafted template to an application that uses liquidjs for template rendering. This could be a CMS, email template builder, or any platform allowing user-provided Liquid templates.</li>
<li>The application&rsquo;s liquidjs engine begins rendering the template.</li>
<li>During the rendering process, the engine encounters the nested block structure.</li>
<li>The engine attempts to resolve the block references, resulting in a recursive call to the same block&rsquo;s render function.</li>
<li>This recursive call creates an infinite loop, as the inner block continuously calls the outer block&rsquo;s render function, and vice versa.</li>
<li>The infinite loop causes uncontrolled memory allocation, rapidly consuming all available system memory (up to ~4GB).</li>
<li>The Node.js process running the liquidjs engine crashes with a &ldquo;FATAL ERROR: JavaScript heap out of memory&rdquo; error, leading to a denial of service.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability leads to a denial of service (DoS). Any application that accepts user-provided or user-influenced Liquid templates can be crashed by a single malicious template. The Node.js process is terminated by the operating system due to memory exhaustion, resulting in complete service disruption. The number of potential victims is large, including CMS platforms, email template builders, multi-tenant SaaS products, and static site generators with untrusted input.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade to liquidjs version 10.25.7 or later to patch CVE-2026-41311.</li>
<li>Implement input validation and sanitization for Liquid templates to prevent the submission of malicious code.</li>
<li>Monitor Node.js processes for excessive memory consumption, which could indicate a DoS attack.</li>
<li>Deploy the Sigma rule <code>Detect LiquidJS Template DoS</code> to identify potentially malicious templates based on nested block structures.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>liquidjs</category><category>denial-of-service</category><category>template-injection</category></item></channel></rss>