GHSA-grr9-747v-xvcp: Scriban has an Infinite Recursion during Object Rendering Leads to Stack Overflow and Process Crash (Denial of Service)
When Scriban renders an object that contains a circular reference, it traverses the object's members infinitely. Because the ObjectRecursionLimit property defaults to unlimited, this behavior exhausts the thread's stack space, triggering an uncatchable StackOverflowException that immediately terminates the hosting 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).
When Scriban renders an object that contains a circular reference, it traverses the object's members infinitely. Because the ObjectRecursionLimit property defaults to unlimited, this behavior exhausts the thread's stack space, triggering an uncatchable StackOverflowException that immediately terminates the hosting process.
When rendering objects (e.g., {{ obj }}), the Scriban rendering engine recursively inspects and formats the object's properties. To prevent infinite loops caused by deeply nested or circular data structures, TemplateContext contains an ObjectRecursionLimit property.
However, this property currently defaults to 0 (unlimited). If the data context pushed into the template contains a circular reference, the renderer will recurse indefinitely. This is especially dangerous for web applications that map user-controlled payloads (like JSON) directly to rendering contexts, or for applications that pass ORM objects (like Entity Framework models, which frequently contain circular navigation properties) into the template.
Proof of Concept (PoC)
The following C# code demonstrates the vulnerability. Executing this will cause an immediate, fatal StackOverflowException, bypassing any standard error handling.
using Scriban;
using Scriban.Runtime;
var template = Template.Parse("{{ a }}");
var context = new TemplateContext();
var a = new ScriptObject();
// Introduce a cycle
a["self"] = a;
context.PushGlobal(new ScriptObject { { "a", a } });
try {
// This crashes the entire process immediately
template.Render(context);
} catch (Exception ex) {
// This will never execute because StackOverflowException
Console.WriteLine("Caught exception: " + ex.Message);
}Impact
This vulnerability allows a Denial of Service (DoS) attack. If a malicious user can manipulate the data structure passed to the renderer to include a cyclic reference, or if the application passes a complex object graph to an untrusted template, the entire .NET hosting process will crash.
Suggested Remediation
Update TemplateContext.cs to set ObjectRecursionLimit to a safe default, such as 20.
public int ObjectRecursionLimit { get; set; } = 20;By implementing this default, circular references will gracefully result in a catchable ScriptRuntimeException rather than a fatal process crash.
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
