# GHSA-5rpf-x9jg-8j5p: Scriban Affected by Memory Exhaustion (OOM) via Unbounded String Generation (Denial of Service)

> Attackers can cause denial of service in applications using Scriban by supplying templates that trigger exponential memory allocation.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 19 Mar 2026

## What is GHSA-5rpf-x9jg-8j5p?

GHSA-5rpf-x9jg-8j5p is a denial of service vulnerability in Scriban.Signed, published on 19 Mar 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

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

## Which versions are affected by GHSA-5rpf-x9jg-8j5p?

4 open source packages ship an affected version, including Scriban.Signed and scriban.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `Scriban.Signed` | NuGet | All versions | 6.6.0 |
| `Scriban.Signed` | NuGet | All versions | 6.6.0 |
| `scriban` | NuGet | All versions | 6.6.0 |
| `scriban` | NuGet | All versions | 6.6.0 |

## How do I fix GHSA-5rpf-x9jg-8j5p?

Upgrade Scriban.Signed to 6.6.0 or later.

## Is GHSA-5rpf-x9jg-8j5p being exploited?

There is no known exploitation of GHSA-5rpf-x9jg-8j5p in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-5rpf-x9jg-8j5p and fix it if it is affected.

What it is: GHSA-5rpf-x9jg-8j5p is a denial of service vulnerability in Scriban.Signed, published on 19 Mar 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-5rpf-x9jg-8j5p in the wild and no public exploit code.

Affected packages and fixed versions:
- Scriban.Signed (NuGet): affected all versions; fixed in 6.6.0
- Scriban.Signed (NuGet): affected all versions; fixed in 6.6.0
- scriban (NuGet): affected all versions; fixed in 6.6.0
- scriban (NuGet): affected all versions; fixed in 6.6.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-5rpf-x9jg-8j5p/ (Markdown: https://insights.sbomify.com/GHSA-5rpf-x9jg-8j5p/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-5rpf-x9jg-8j5p

---
From sbomify Insights: https://insights.sbomify.com/GHSA-5rpf-x9jg-8j5p/
Summaries are generated and may contain mistakes; the official description above is the record.
