highCVSS 7.5Vulnerability

GHSA-wgh7-7m3c-fx25

Scriban is vulnerable to an uncontrolled process crash resulting in a Denial of Service. Because the recursive-descent parser does not enforce a default limit on expression depth, an attacker who controls template input can craft a heavily nested template that triggers a `StackOverflowException`. In .NET, a `StackOverflowException` cannot be caught by standard `try-catch` blocks, resulting in the immediate and ungraceful termination of the entire hosting process. Scriban utilizes a recursive-descent parser to process template expressions. While the library exposes an `ExpressionDepthLimit` property in its `ParserOptions`, this property defaults to `null` (disabled). If an application accepts user-supplied templates (or dynamically constructs templates from untrusted input), an attacker can supply thousands of nested parentheses or blocks. As the parser recursively evaluates each nested layer, it consumes thread stack space until it exceeds the limits of the host OS, triggering a fatal crash. #### Impact An attacker can supply crafted input that triggers a `StackOverflowException`, causing immediate termination of the hosting process and resulting in a Denial of Service. In applications that process untrusted or user-controlled templates (e.g., web applications or APIs), this can be exploited remotely without authentication. The failure is not recoverable, requiring a full process restart and leading to service disruption. #### Proof of Concept (PoC) The following C# code demonstrates the vulnerability. Executing this code will immediately terminate the application process. ```csharp using Scriban; // Creates a deeply nested expression: (((( ... (1) ... )))) string nested = new string('(', 10000) + "1" + new string(')', 10000); try { // This will crash the entire process immediately Scriban.Template.Parse("{{ " + nested + " }}"); } catch (Exception ex) { // This catch block will never execute because StackOverflowException Console.WriteLine("Caught

Properties

ghsa_id
GHSA-wgh7-7m3c-fx25
severity
high
summary
Scriban has Uncontrolled Recursion in Parser Leads to Stack Overflow and Process Crash (Denial of Service)
cvss_score
7.5
cve_id
GHSA-wgh7-7m3c-fx25
cvss_vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
is_ghsa_only
true
ghsa_published
2026-03-19T21:30:54Z
source_url
https://github.com/advisories/GHSA-wgh7-7m3c-fx25
ghsa_updated
2026-03-19T21:30:56Z

Related Entities (3)

AFFECTS (1)

[Software]nuget/Scriban

HAS_WEAKNESS (1)

[Weakness]Uncontrolled Recursion

REPORTED_BY (1)

[Source]GitHub Advisory Database

Explore deeper with Ninja Signal's threat intelligence graph