Loading...
Skip to main content

CVE-2026-74795 — Scriban has Uncontrolled Recursion in scriban —...

HIGH

Scriban has Uncontrolled Recursion in Parser Leads to Stack Overflow and Process Crash (Denial of Service)

Published March 19, 2026Updated August 17, 2026Source: osv

Summary

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 exception: " + ex.Message); } ``` #### Suggested Remediation Update the `ParserOptions` constructor (or the internal parser initialization) to set a default value for `ExpressionDepthLimit`. A limit of `1000` (or even lower, such as `250` or `500`) is generally more than enough for legitimate templates while safely preventing stack exhaustion. ```csharp public int? ExpressionDepthLimit { get; set; } = 250; ``` Alternatively, document the risk heavily and warn developers to manually set `ExpressionDepthLimit` if evaluating untrusted templates, though a secure-by-default approach is strongly preferred.

Advisory Timeline

  • First published March 19, 2026 (207 days ago).
  • Last revised August 17, 2026 — 150 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

NuGet
Update scriban to 6.6.0 or later
dotnet add package scriban --version 6.6.0
NuGet
Update Scriban.Signed to 6.6.0 or later
dotnet add package Scriban.Signed --version 6.6.0

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (2)

Affects 1 ecosystem: nuget (2).

PackageEcosystemAffectedFixed In
scriban
nuget
0.1.0, 0.10.0, 0.11.0, 0.12.0 (+118 more)6.6.0
Scriban.Signed
nuget
0.10.0, 0.11.0, 0.12.0, 0.12.1 (+106 more)6.6.0

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 7.5 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Frequently Asked Questions

What is CVE-2026-74795?
Scriban has Uncontrolled Recursion in Parser Leads to Stack Overflow and Process Crash (Denial of Service) This vulnerability has been assigned a severity rating of HIGH (CVSS score: 7.5/10).
How do I check if my project is affected by CVE-2026-74795?
CVE-2026-74795 affects scriban and Scriban.Signed. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-74795 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
7.5

High exploitability or significant impact. Prioritize remediation within days.

Also Known As

GHSA-wgh7-7m3c-fx25

Related CVEs

  • CVE-2026-74790
    CRITICAL

    Scriban: Sandbox escape due to TypedObjectAccessorcache bypassing MemberFilter after TemplateContext reuse

  • CVE-2026-74784
    HIGH

    Scriban: array.insert_at index parameter DoS bypasses LoopLimit and LimitToString

  • CVE-2026-74792
    HIGH

    Scriban has a Stack Overflow via Nested Array Initializers That Bypass the ExpressionDepthLimit Fix

  • CVE-2026-74788
    HIGH

    Scriban: Uncontrolled Memory Allocation via string.pad_left/pad_right Allows Remote Denial of Service

  • CVE-2026-74791
    HIGH

    Scriban has an authorization bypass due to stale include cache surviving TemplateContext.Reset()

  • CVE-2026-74787
    HIGH

    Scriban has Uncontrolled Recursion in `object.to_json` Causing Unrecoverable Process Crash via StackOverflowException

  • CVE-2026-73062
    MEDIUM

    Scriban: array * int (ScriptArray<T>.TryEvaluate) bypasses LoopLimit — incomplete fix for GHSA-c875-h985-hvrc, missed sibling of GHSA-24c8-4792-22hx

  • CVE-2026-74785
    MEDIUM

    Scriban has Multiple Denial-of-Service Vectors via Unbounded Resource Consumption During Expression Evaluation

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies