Skip to main content
VulnerabilityPublished Updated

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

Affects scribanSource GCVE Database

0

CVSS 5.3 Medium : upgrade to 6.6.0 when convenient.

Data as of 7 Jul 2026, 12:28 UTC

CVSS 3.1 base score
5.3Medium
How severe the flaw is on the 0–10 CVSS scale.
Patch
Available – fixed in 6.6.0
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

What to do

Upgrade scriban and Scriban.Signed to 6.6.0.

Affected software

ProductAffectedFixed in
NuGetscribanAffected
  • <6.6.0
Fixed in
  • 6.6.0
NuGetScriban.SignedAffected
  • <6.6.0
Fixed in
  • 6.6.0

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

A fix is available by upgrading to Scriban version 6.6.0 or later, where a sensible default limit for string output (LimitToString) is enforced. If upgrading is not immediately possible, users should manually set the LimitToString property to a reasonable value such as 1,048,576 characters to prevent unbounded memory allocation. Patch status is not explicitly stated in a vendor advisory, so users should verify the fix in version 6.6.0 or later.

Description

`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; ```

References

Community reviews

Loading reviews…