CVE-2026-137511 in Scribaninfo

Summary

by MITRE • 11/26/2026

Scriban before 7.6.0 contains a state isolation vulnerability because TemplateContext.Reset() does not clear the Tags dictionary holding array.cycle and math.random state. Attackers supplying templates to a reused context can observe or influence cycle positions and random sequences across renders, and accumulate unbounded cycle entries to exhaust memory.

If you want to get the best quality for vulnerability data then you always have to consider VulDB.

Analysis

by VulDB Data Team • 11/26/2026

The Scriban templating engine prior to version 7.6.0 suffers from a critical state isolation vulnerability rooted in the improper management of internal template execution contexts. This flaw specifically affects the TemplateContext.Reset() method, which is designed to prepare an existing context instance for reuse with a new template or rendering operation. In secure software design, resetting a context should involve clearing all mutable state variables that could carry over information from previous executions. However, in this vulnerable implementation, the Tags dictionary within the TemplateContext remains populated after a reset operation. This dictionary holds critical internal states such as array.cycle and math.random, which are essential for generating sequential or pseudo-random outputs during template rendering but must remain isolated between distinct renderings to prevent cross-contamination of data.

The technical flaw allows an attacker who controls the input templates to observe or influence cycle positions and random sequences across multiple renders by reusing a single TemplateContext instance. When a context is reused without properly clearing these specific state variables, the internal counters for array cycles do not reset to their initial values, and the seed or state for math.random persists from previous operations. This lack of isolation means that data generated in one rendering session can leak into subsequent sessions if they share the same context object. For instance, an attacker could manipulate a template to output specific cycle indices or random numbers that are predictable based on prior executions, effectively breaking the assumption of independence between separate template evaluations.

Beyond the information leakage and state manipulation aspects, this vulnerability also presents a significant risk related to resource exhaustion. Because the Tags dictionary is not cleared during the reset process, it continues to accumulate entries with each new rendering operation performed on the same context instance. Over time, this unbounded growth in memory usage can lead to excessive consumption of system resources. In environments where template contexts are pooled or reused for performance optimization, such as web applications processing user-generated content at scale, an attacker could trigger a denial-of-service condition by forcing repeated renders that progressively fill available memory until the application crashes or becomes unresponsive.

This vulnerability aligns with CWE-200, which covers Exposure of Sensitive Information to an Unauthorized Actor, due to the potential leakage of internal state across rendering boundaries. It also relates to CWE-400, Uncontrolled Resource Consumption, given the risk of memory exhaustion through accumulated dictionary entries. From a threat modeling perspective using MITRE ATT&CK techniques, this flaw can be leveraged for Data Obfuscation or Defense Evasion if an attacker uses predictable random sequences to mask malicious activity, and it facilitates Denial of Service via resource exhaustion. The core issue is a failure in maintaining strict boundaries between logical execution contexts within the same physical memory space.

To mitigate this vulnerability, organizations using Scriban must upgrade immediately to version 7.6.0 or later, where the TemplateContext.Reset() method has been patched to properly clear the Tags dictionary and reset all associated state variables including array.cycle and math.random. For applications unable to update instantly, a temporary workaround involves ensuring that each template rendering operation utilizes a fresh, newly instantiated TemplateContext rather than reusing an existing one. This approach guarantees complete isolation between renders but may incur performance overhead due to object allocation costs. Additionally, implementing strict limits on the number of times a context can be reused or monitoring memory usage patterns associated with templating operations can help detect and mitigate potential abuse attempts until a permanent fix is deployed.

Responsible

VulnCheck

Reservation

11/26/2026

Disclosure

11/26/2026

Moderation

accepted

CPE

ready

EPSS

0.00532

KEV

no

Activities

very low

Sources

Do you want to use VulDB in your project?

Use the official API to access entries easily!