CVE-2026-137510 in Scriban
Summary
by MITRE • 11/26/2026
Scriban and Scriban.Signed before 7.6.0 allow template authors to bypass the LimitToString string length limit because the string.literal, string.base64_encode, html.escape, html.newline_to_br, html.url_encode, and html.url_escape builtins lack allocation guards. An attacker who can supply a small template can repeatedly call these builtins under the default TemplateContext to force multi-gigabyte allocations and exhaust host 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 vulnerability identified in Scriban versions prior to 7.6.0 represents a critical resource exhaustion flaw stemming from insufficient input validation within core string manipulation functions. This issue specifically affects template authors who can inject or supply malicious templates that exploit the lack of allocation guards in several built-in methods, including string.literal, string.base64_encode, html.escape, html.newline_to_br, html.url_encode, and html.url_escape. These functions are designed to process text data for rendering purposes but fail to enforce limits on memory consumption during execution. Consequently, an attacker capable of controlling the input template can trigger these builtins repeatedly under the default TemplateContext settings. The absence of safeguards allows the application to allocate multi-gigabyte blocks of memory in response to seemingly small or innocuous-looking inputs, leading directly to a denial of service condition as host resources are rapidly depleted.
From a technical perspective, this flaw is classified as an Improper Restriction of Excessive Allocation Vulnerability, aligning with CWE-400 in the Common Weakness Enumeration taxonomy. The root cause lies in the implementation details of the Scriban templating engine where string operations do not check for potential size overflows or enforce maximum byte limits before performing memory allocation. When an attacker provides a template that repeatedly invokes these specific functions, each call results in significant memory consumption without any internal mechanism to cap the total allocated bytes. This behavior is particularly dangerous because it can be triggered by relatively small input strings if they are processed iteratively or through complex nested structures within the template logic. The vulnerability exploits the trust placed in the templating engine's default configuration, assuming that standard usage patterns will not result in pathological memory growth.
The operational impact of this vulnerability is severe for any application relying on Scriban to render user-supplied content. By forcing multi-gigabyte allocations, an attacker can cause the host system or container running the service to run out of available memory. This leads to process crashes, unresponsiveness, and potential cascading failures in microservices architectures where resource limits are not strictly enforced at the infrastructure level. In cloud-native environments, this could trigger automatic restarts due to Out Of Memory errors, resulting in intermittent availability issues for end-users. Furthermore, if the application does not have robust monitoring or auto-scaling policies configured appropriately, sustained attacks could lead to complete service outage until manual intervention occurs. The ease of exploitation means that even low-skilled attackers can disrupt services by simply crafting a specific template payload and submitting it through any interface that accepts Scriban templates for rendering.
Mitigation strategies must focus on both immediate patching and long-term architectural hardening. The primary remediation is to upgrade the Scriban library to version 7.6.0 or later, where these allocation guards have been implemented to prevent excessive memory consumption during string operations. For environments unable to immediately update dependencies, implementing strict resource limits at the container or process level using tools like cgroups in Linux can help contain the blast radius of such attacks by preventing any single process from consuming all available host memory. Additionally, input validation should be applied to restrict the complexity and length of templates accepted for rendering, ensuring that only trusted sources can submit complex template structures. Monitoring solutions should also be configured to detect abnormal spikes in memory usage associated with templating engines, allowing for rapid detection and response to potential exploitation attempts.
This vulnerability maps directly to several tactics within the MITRE ATT&CK framework, particularly those related to Resource Hijacking and Denial of Service. Attackers may leverage this flaw as part of a broader campaign aimed at disrupting service availability rather than stealing data or gaining unauthorized access. Understanding these mappings helps security teams prioritize detection rules and incident response procedures specifically tailored to resource exhaustion attacks targeting templating engines. By recognizing the pattern of excessive allocation through specific function calls, defenders can better identify malicious template submissions in logs and network traffic. Ultimately, addressing this issue requires a combination of timely software updates, rigorous input sanitization policies, and robust infrastructure-level controls to ensure resilience against such exploitation attempts.