Loading advisory.
Loading advisory.
Scriban has an authorization bypass due to stale include cache surviving TemplateContext.Reset()
TemplateContext.Reset() claims that a TemplateContext can be reused safely on the same thread, but it does not clear CachedTemplates.
Published 2026-03-24 22:09 UTC · Modified 2026-08-17 17:41 UTC
Severity and EPSS are shown separately. Helm does not combine them into one score.
| Package | Ecosystem | Affected | Fixed in | Upgrade command |
|---|---|---|---|---|
| scriban | NuGet | < 7.0.0 versions 0.1.0, 0.10.0, 0.11.0, 0.12.0, 0.12.1, 0.13.0, 0.14.0, 0.15.0, 0.16.0, 0.2.0, 0.2.1, 0.2.2, 0.3.0, 0.3.1, 0.3.1-pre028, 0.4.0, 0.5.0, 0.6.0, 0.7.0, 0.9.0 and 103 more | 7.0.0 | dotnet add package scriban --version 7.0.0 |
| Scriban.Signed | NuGet | < 7.0.0 versions 0.10.0, 0.11.0, 0.12.0, 0.12.1, 0.13.0, 0.14.0, 0.15.0, 0.16.0, 0.9.0, 0.9.1, 1.0.0, 1.0.0-beta-001, 1.0.0-beta-002, 1.0.0-beta-003, 1.0.0-beta-004, 1.0.0-beta-005, 1.0.0-beta-006, 1.1.0, 1.1.1, 1.2.0 and 91 more | 7.0.0 | dotnet add package Scriban.Signed --version 7.0.0 |
TemplateContext.Reset() claims that a TemplateContext can be reused safely on the same thread, but it does not clear CachedTemplates. If an application pools TemplateContext objects and uses an ITemplateLoader that resolves content per request, tenant, or user, a previously authorized include can be served to later renders without calling TemplateLoader.Load() again.
The relevant code path is:
TemplateContext.Reset() only clears output, globals, cultures, and source files in src/Scriban/TemplateContext.cs lines 877–902.
CachedTemplates is initialized once and kept on the context in src/Scriban/TemplateContext.cs line 197.
include resolves templates through IncludeFunction.Invoke() in src/Scriban/Functions/IncludeFunction.cs lines 29–43.
IncludeFunction.Invoke() calls TemplateContext.GetOrCreateTemplate() in src/Scriban/TemplateContext.cs lines 1249–1256.
If a template path is already present in CachedTemplates, Scriban returns the cached compiled template and does not call TemplateLoader.Load() again.
This becomes a security issue when ITemplateLoader.Load() returns request-dependent content. A first render can prime the cache with an admin-only or tenant-specific template, and later renders on the same reused TemplateContext will receive that stale template even after Reset().
mkdir scriban-poc1
cd scriban-poc1
dotnet new console --framework net8.0
dotnet add package Scriban --version 6.6.0Program.csusing Scriban;
using Scriban.Parsing;
using Scriban.Runtime;
var loader = new SwitchingLoader();
var context = new TemplateContext
{
TemplateLoader = loader,
};
var template = Template.Parse("{{ include 'profile' }}");
loader.Content = "admin-only";
Console.WriteLine("first=" + template.Render(context));
context.Reset();
loader.Content = "guest-view";
Console.WriteLine("second=" + template.Render(context));
sealed class SwitchingLoader : ITemplateLoader
{
public string Content { get; set; } = string.Empty;
public string GetPath(TemplateContext context, SourceSpan callerSpan, string templateName) => templateName;
public string Load(TemplateContext context, SourceSpan callerSpan, string templatePath) => Content;
public ValueTask<string> LoadAsync(TemplateContext context, SourceSpan callerSpan, string templatePath)
=> new(Content);
}dotnet runfirst=admin-only
second=admin-onlyfirst=admin-only
second=guest-viewThe second render should reload the template after Reset(), but it instead reuses the cached compiled template from the previous render.
This is a cross-render data isolation issue. Any application that reuses TemplateContext objects and uses a request-dependent ITemplateLoader can leak previously authorized template content across requests, users, or tenants.
The issue impacts applications that:
Pool or reuse TemplateContext
Call Reset() between requests
Use include
Resolve include content based on request-specific state
No public exploit code known to Helm's sources (Nuclei templates, Metasploit, Exploit-DB and PoC-in-GitHub). That does not mean none exists.
One EPSS score on record: 0.004 on 2026-11-24.
| Date | Score | Previous | Model |
|---|---|---|---|
| 2026-11-24 | 0.004 | first score | v2026.06.15 |