GHSA-c875-h985-hvrc: Scriban Denial of Service Vulnerability

HIGH
CVSS 7.5
CWE-400
Published
Advisory Summary

GHSA-c875-h985-hvrc is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Scriban libraries in the NuGet ecosystem. The issue involves built-in operations bypass looplimit and delay cancellation, enabling denial of service. Remediation is available by upgrading affected packages to version 7.0.0.

GHSA-c875-h985-hvrc at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-c875-h985-hvrc
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Scriban
Package Ecosystem NuGet
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix GHSA-c875-h985-hvrc

To remediate this vulnerability, upgrade all affected Scriban dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

scriban fixed: 7.0.0
Upgrade scriban to 7.0.0
Scriban.Signed fixed: 7.0.0
Upgrade Scriban.Signed to 7.0.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for scriban

How to Check if You Are Affected

To determine whether your application is affected by GHSA-c875-h985-hvrc, inspect your project dependencies for Scriban:

inspect dependencies for scriban

Analyze the terminal output to locate any version of Scriban in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 7.0.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Scriban, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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

GHSA-c875-h985-hvrc Affected Scriban Versions

2 component(s)
Fixed Versions:
7.0.0
Product / Package Ecosystem Affected Versions Fixed Version
scriban
NuGet
< 7.0.0
7.0.0
Scriban.Signed
NuGet
< 7.0.0
7.0.0

References

Frequently Asked Questions

What is GHSA-c875-h985-hvrc?
GHSA-c875-h985-hvrc is a security vulnerability in Scriban involving Built-in operations bypass LoopLimit and delay cancellation, enabling Denial of Service under CWE-400: Uncontrolled Resource Consumption.
Which Scriban versions are affected?
Affected versions include releases prior to 7.0.0 across affected packages: scriban, Scriban.Signed.
What version fixes GHSA-c875-h985-hvrc?
Upgrading to 7.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is scriban affected?
Yes, scriban is affected in releases prior to 7.0.0. Upgrade your dependency to 7.0.0 or later.
Is Scriban.Signed affected?
Yes, Scriban.Signed is affected in releases prior to 7.0.0. Upgrade your dependency to 7.0.0 or later.
What is the CVSS score of GHSA-c875-h985-hvrc?
GHSA-c875-h985-hvrc has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with GHSA-c875-h985-hvrc?
GHSA-c875-h985-hvrc is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check NuGet dependencies for GHSA-c875-h985-hvrc?
Run the dependency tree command: 'inspect dependencies for scriban'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-c875-h985-hvrc",
  "modified" : "2026-07-06T13:03:19Z",
  "published" : "2026-03-24T22:13:08Z",
  "aliases" : [ ],
  "summary" : "Scriban: Built-in operations bypass LoopLimit and delay cancellation, enabling Denial of Service",
  "details" : "## Summary\n\nScriban'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.\n\n## Details\n\nThe relevant code path is:\n\n- `ScriptBlockStatement.Evaluate()` calls `context.CheckAbort()` once per statement in `src/Scriban/Syntax/Statements/ScriptBlockStatement.cs` lines 41–46.\n- `LoopLimit` enforcement is tied to script loop execution via `TemplateContext.StepLoop()`, not to internal helper iteration.\n- `array.size` in `src/Scriban/Functions/ArrayFunctions.cs` lines 596–609 calls `list.Cast<object>().Count()` for non-collection enumerables.\n- `1..N` creates a `ScriptRange` from `ScriptBinaryExpression.RangeInclude()` in `src/Scriban/Syntax/Expressions/ScriptBinaryExpression.cs` lines 745–748.\n- `ScriptRange` then yields every element one by one **without going through `StepLoop()`** in `src/Scriban/Runtime/ScriptRange.cs`.\n\nThis means a single statement can perform arbitrarily large iteration without being stopped by `LoopLimit`.\n\nThere is also a related memory-amplification path in `string * int`:\n\n- `ScriptBinaryExpression.CalculateToString()` appends in a plain `for` loop in `src/Scriban/Syntax/Expressions/ScriptBinaryExpression.cs` lines 301–334.\n\n---\n\n## Proof of Concept\n\n### Setup\n\n```bash\nmkdir scriban-poc3\ncd scriban-poc3\ndotnet new console --framework net8.0\ndotnet add package Scriban --version 6.6.0\n```\n\n### `Program.cs`\n\n```csharp\nusing Scriban;\n\nvar template = Template.Parse(\"{{ 1..1000000 | array.size }}\");\n\nvar context = new TemplateContext\n{\n    LoopLimit = 1\n};\n\nConsole.WriteLine(template.Render(context));\n```\n\n### Run\n\n```bash\ndotnet run\n```\n\n### Actual Output\n\n```\n1000000\n```\n\n### Expected Behavior\n\nA safety limit of `LoopLimit = 1` should prevent a template from performing one million iterations worth of work.\n\n### Optional Stronger Variant (Memory Amplification)\n\n```csharp\nusing Scriban;\n\nvar template = Template.Parse(\"{{ 'A' * 200000000 }}\");\nvar context = new TemplateContext\n{\n    LoopLimit = 1\n};\n\ntemplate.Render(context);\n```\n\nThis variant demonstrates that `LoopLimit` also does not constrain large internal allocation work.\n\n---\n\n## Impact\n\nThis 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.\n\nThe issue impacts:\n\n- Template-as-a-service systems\n- CMS or email rendering systems that accept user templates\n- Any multi-tenant use of Scriban with untrusted template content",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "scriban"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "7.0.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Scriban.Signed"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "7.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/scriban/scriban/security/advisories/GHSA-c875-h985-hvrc"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/scriban/scriban"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-24T22:13:08Z",
    "nvd_published_at" : null
  }
}