Loading...
Skip to main content

CVE-2026-74789 — Vulnerability in scriban — CVE Details

HIGH

Scriban: Built-in operations bypass LoopLimit and delay cancellation, enabling Denial of Service

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

Summary

## Summary Scriban's `LoopLimit` only applies to script loop statements, not to expensive iteration performed inside operators and builtins. An attacker can submit a single expression such as `{{ 1..1000000 | array.size }}` and force large amounts of CPU work even when `LoopLimit` is set to a very small value. ## Details The relevant code path is: - `ScriptBlockStatement.Evaluate()` calls `context.CheckAbort()` once per statement in `src/Scriban/Syntax/Statements/ScriptBlockStatement.cs` lines 41–46. - `LoopLimit` enforcement is tied to script loop execution via `TemplateContext.StepLoop()`, not to internal helper iteration. - `array.size` in `src/Scriban/Functions/ArrayFunctions.cs` lines 596–609 calls `list.Cast<object>().Count()` for non-collection enumerables. - `1..N` creates a `ScriptRange` from `ScriptBinaryExpression.RangeInclude()` in `src/Scriban/Syntax/Expressions/ScriptBinaryExpression.cs` lines 745–748. - `ScriptRange` then yields every element one by one **without going through `StepLoop()`** in `src/Scriban/Runtime/ScriptRange.cs`. This means a single statement can perform arbitrarily large iteration without being stopped by `LoopLimit`. There is also a related memory-amplification path in `string * int`: - `ScriptBinaryExpression.CalculateToString()` appends in a plain `for` loop in `src/Scriban/Syntax/Expressions/ScriptBinaryExpression.cs` lines 301–334. --- ## Proof of Concept ### Setup ```bash mkdir scriban-poc3 cd scriban-poc3 dotnet new console --framework net8.0 dotnet add package Scriban --version 6.6.0 ``` ### `Program.cs` ```csharp using Scriban; var template = Template.Parse("{{ 1..1000000 | array.size }}"); var context = new TemplateContext { LoopLimit = 1 }; Console.WriteLine(template.Render(context)); ``` ### Run ```bash dotnet run ``` ### Actual Output ``` 1000000 ``` ### Expected Behavior A safety limit of `LoopLimit = 1` should prevent a template from performing one million iterations worth of work. ### Optional Stronger Variant (Memory Amplification) ```csharp using Scriban; var template = Template.Parse("{{ 'A' * 200000000 }}"); var context = new TemplateContext { LoopLimit = 1 }; template.Render(context); ``` This variant demonstrates that `LoopLimit` also does not constrain large internal allocation work. --- ## Impact This is an uncontrolled resource consumption issue. Any application that accepts attacker-controlled templates and relies on `LoopLimit` as part of its safe-runtime configuration can still be forced into heavy CPU or memory work by a single expression. The issue impacts: - Template-as-a-service systems - CMS or email rendering systems that accept user templates - Any multi-tenant use of Scriban with untrusted template content

Advisory Timeline

  • First published March 24, 2026 (202 days ago).
  • Last revised August 17, 2026 — 145 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

NuGet
Update scriban to 7.0.0 or later
dotnet add package scriban --version 7.0.0
NuGet
Update Scriban.Signed to 7.0.0 or later
dotnet add package Scriban.Signed --version 7.0.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 (+119 more)7.0.0
Scriban.Signed
nuget
0.10.0, 0.11.0, 0.12.0, 0.12.1 (+107 more)7.0.0

Vulnerability Classification

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

  • CWE-400
    Uncontrolled Resource ConsumptionMITRE

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-74789?
Scriban: Built-in operations bypass LoopLimit and delay cancellation, enabling 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-74789?
CVE-2026-74789 affects scriban and Scriban.Signed. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-74789 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-c875-h985-hvrc

Related CVEs

  • 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-74795
    HIGH

    Scriban has Uncontrolled Recursion in Parser Leads to Stack Overflow and Process Crash (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-74786
    MEDIUM

    Scriban: Denial of Service via Unbounded Cumulative Template Output Bypassing LimitToString

  • 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