Description
Scriban before 7.0.0 (affected versions <= 6.6.0) contains an uncontrolled memory allocation vulnerability in the string.pad_left and string.pad_right template functions, which perform no validation on the width parameter before delegating to .NET's String.PadLeft/PadRight. When an application exposes Scriban to untrusted template input, an attacker can supply an arbitrarily large width value (e.g., 500,000,000) to trigger ~1GB memory allocations in a single call, resulting in OutOfMemoryException and denial of service. The TemplateContext.LimitToString limit does not prevent this because it is only enforced after the string has been fully allocated.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| scriban | scriban | < 7.0.0 | 7.0.0 |
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| NuGet | Scriban | < 7.0.0 | 7.0.0 | GHSA-v66j-x4hw-fv9g |
| NuGet | Scriban.Signed | < 7.0.0 | 7.0.0 | GHSA-v66j-x4hw-fv9g |
References
- GitHub Security Advisory (GHSA-v66j-x4hw-fv9g) vendor-advisory
- VulnCheck Advisory: Scriban before 7.0.0 Denial of Service via string.pad_left/pad_right third-party-advisory