/

CVE-2026-33285

Severity:

HIGH RISK

(7.5)

Uncontrolled Resource Consumption in LiquidJS Template

CVE-2026-33285

Analyzed

Vulnerability type

Category:

Uncontrolled Resource Consumption

CWE:

CWE-20, CWE-400

Impact:

Denial of Service via process crash and uncontrolled memory allocation

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

LiquidJS's template sandbox can be tricked into bypassing its memoryLimit mechanism using reverse range expressions, allowing templates to allocate unbounded memory.

When combined with string-flattening operations such as the replace filter, a single crafted template rendered from one HTTP request can trigger a V8 fatal error and crash the Node.js process, resulting in a complete denial of service.

Affected context

This vulnerability affects applications that:

  • Use LiquidJS as a server-side template engine (for example, in Node.js web services).
  • Allow users, tenants, or other external parties to influence or supply template content or template fragments.
  • Rely on LiquidJS's memoryLimit as a safety mechanism to constrain resource usage.

The issue is triggered when the template syntax permits reverse range expressions (like (100000000..1)) that are not correctly accounted for by the engine's memory-limiting logic, especially when combined with expensive string operations such as replace.

Exploit preconditions

  • Attack surface: HTTP endpoints or APIs that cause LiquidJS to render templates.
  • Required access: Ability to inject or control template content, template variables, or filters to introduce reverse ranges and heavy string operations.
  • Trigger point: Rendering of a LiquidJS template containing a reverse range expression combined with a string-flattening operation (for example, replace).
  • Why exploitation is possible: The memoryLimit control does not correctly account for reverse ranges, allowing the engine to allocate memory without effective bounds. When merged with costly string operations, this leads to excessive memory use, causing V8 to hit a fatal error and terminate the Node.js process.

Why this happens

The root cause is an incomplete resource-limiting mechanism in the LiquidJS engine that fails to cover all syntactic constructs, particularly reverse range expressions.

Instead of treating all forms of ranges consistently with respect to memory accounting, the implementation allows expressions like (100000000..1) to escape the intended memoryLimit.

This behavior corresponds to CWE-400: Uncontrolled Resource Consumption, where an attacker can drive the system to consume excessive memory, and CWE-20: Improper Input Validation, because the engine does not robustly validate or constrain user-controlled template constructs that can lead to unbounded resource use.

Conceptually, the bug class is: "relying on partial input validation and incomplete resource accounting for sandboxed, user-controllable template expressions."

Potential impact

  • The Node.js process can crash due to a V8 fatal error triggered by excessive memory allocation.
  • The application or service can become completely unavailable (denial of service) from a single crafted HTTP request.
  • Automated restart mechanisms may enter crash loops, amplifying downtime or resource waste.
  • Multi-tenant environments may experience cross-tenant impact if one tenant can submit malicious templates that affect shared application processes.

General mitigation guidance

Effective mitigation focuses on strengthening resource controls and tightening trust boundaries around templates:

  • Treat all user-controlled template content as untrusted and restrict which Liquid constructs (e.g., ranges, loops, filters) are allowed in user-supplied templates.
  • Apply robust resource-limiting strategies that cover all expressions and operations, including reverse ranges and nested filters, rather than relying on a single memoryLimit knob.
  • Introduce execution guards such as maximum loop iterations, maximum collection sizes, and limits on filter chaining, especially for string-heavy operations.
  • Enforce strict validation or whitelisting of template syntax before rendering, rejecting patterns that can cause unbounded memory usage.
  • Run template rendering in isolated worker processes or sandboxes with strict memory and time quotas so that a crash or exhaustion does not take down the main service.
  • Apply least-privilege to the rendering environment and ensure that the service architecture can degrade gracefully if a single worker fails.

How teams detect issues like this

Detection can combine code-level review with runtime monitoring:

  • Static analysis & code review:
  • Flag server endpoints that pass user-controlled strings directly into LiquidJS without validation or templating policy enforcement.
  • Review uses of memoryLimit where it is treated as a complete safety boundary, and identify missing checks for ranges, loops, and filter chains.
  • Establish guidelines for permitted Liquid constructs and use automated checks or linters to enforce them in stored templates.
  • Runtime monitoring & observability:
  • Track memory usage and process crashes for services that render LiquidJS templates, alerting on spikes tied to specific requests or tenants.
  • Log rendered template content or templates IDs on errors so that suspicious patterns (e.g., huge ranges or deeply nested filters) can be identified.
  • Testing & policy enforcement:
  • Add regression tests that include large and reverse ranges combined with string operations to confirm that resource limits are honored.
  • Use automated security testing or fuzzing against template endpoints to surface unbounded resource consumption patterns early in development.

Sources

SourceLink
github.comgithub.com/harttle/liquidjs/commit/95ddefc056a11a44d9e753fd47a39db2c241e578
github.comgithub.com/harttle/liquidjs/security/advisories/GHSA-9r5m-9576-7f6x

Frequently asked

questions

Yes, if an attacker can supply or significantly influence the LiquidJS template content processed by the server. A single malicious template rendered via an HTTP request can be enough to cause a denial of service.

The attacker needs the ability to inject or control templates or template fragments, such as through user-editable pages, email templates, or configuration fields that are rendered using LiquidJS. Direct system or file-level access is not required if the application exposes such templating surfaces over the network.

The safest pattern is to combine a robust, comprehensive resource-limiting strategy with strict control over which Liquid constructs are allowed. This means ensuring that ranges (including reverse ranges), loops, and expensive filters are all covered by the same consistent limits, and that dangerous patterns are rejected before rendering.

Prevention typically involves defense in depth: treat template input as untrusted, define a clear allowed subset of template features, enforce strict validation on that subset, and isolate template execution in processes or sandboxes with strong memory and time limits. Complement this with automated tests and security review focused on resource exhaustion risks in templating and other sandboxed execution environments.

Find out what's already
exploitable in your codebase.