Scriban Affected by Memory Exhaustion (OOM) via Unbounded String Generation (Denial of Service)
`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; ```
AI Analysis
Technical Summary
The Scriban template engine has a vulnerability in versions before 6.6.0 where the TemplateContext.LimitToString property defaults to unlimited output size. Although a LoopLimit of 1000 exists, it does not prevent exponential string growth through repeated concatenation. An attacker can supply a malicious template that doubles a string 30 times, causing over 1GB of memory allocation and crashing the process due to out-of-memory conditions. The suggested fix is to enforce a default limit on string output size, such as setting LimitToString to 1,048,576 characters (1MB).
Potential Impact
This vulnerability allows an unauthenticated attacker to cause a denial of service by exhausting the application's memory through exponential string growth during template rendering. The impact is limited to availability, as it leads to process crashes and severe memory pressure without affecting confidentiality or integrity.
Mitigation Recommendations
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.
Scriban Affected by Memory Exhaustion (OOM) via Unbounded String Generation (Denial of Service)
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; ```
CVSS v3.1
Score 5.3medium
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The Scriban template engine has a vulnerability in versions before 6.6.0 where the TemplateContext.LimitToString property defaults to unlimited output size. Although a LoopLimit of 1000 exists, it does not prevent exponential string growth through repeated concatenation. An attacker can supply a malicious template that doubles a string 30 times, causing over 1GB of memory allocation and crashing the process due to out-of-memory conditions. The suggested fix is to enforce a default limit on string output size, such as setting LimitToString to 1,048,576 characters (1MB).
Potential Impact
This vulnerability allows an unauthenticated attacker to cause a denial of service by exhausting the application's memory through exponential string growth during template rendering. The impact is limited to availability, as it leads to process crashes and severe memory pressure without affecting confidentiality or integrity.
Mitigation Recommendations
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.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-5rpf-x9jg-8j5p
- Osv Schema Version
- 1.4.0
- Aliases
- []
- Ecosystems
- ["NuGet"]
- Database Specific Severity
- MODERATE
- Cvss Version
- 3.1
Threat ID: 6a4c346127e9c79719600ae4
Added to database: 07/06/2026, 23:04:01 UTC
Last enriched: 07/06/2026, 23:34:01 UTC
Last updated: 07/31/2026, 15:42:45 UTC
Views: 14
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.