---
title: "GHSA-5wr9-m6jw-xx44: Scriban: Sandbox escape due to TypedObjectAccessorcache bypassing MemberFilter after TemplateContext reuse"
url: https://erroneo.us/security/ghsa/GHSA-5wr9-m6jw-xx44/
description: "GHSA-5wr9-m6jw-xx44 (critical, NuGet): Scriban: Sandbox escape due to TypedObjectAccessorcache bypassing MemberFilter after TemplateContext reuse. Summary…"
type: advisory
section: "Security Digest"
date_published: 2026-03-24
date_modified: 2026-07-06
publisher: erroneo.us
author: erroneo.us Security Desk
ghsa: "GHSA-5wr9-m6jw-xx44"
license: All rights reserved. Quote with attribution and a link.
---

# GHSA-5wr9-m6jw-xx44: Scriban: Sandbox escape due to TypedObjectAccessorcache bypassing MemberFilter after TemplateContext reuse

## Affected packages

- NuGet `scriban` < 7.0.0 → fixed: 7.0.0
- NuGet `Scriban.Signed` < 7.0.0 → fixed: 7.0.0

## Details

Summary TemplateContext caches type accessors by Type only, but those accessors are built using the current MemberFilter and MemberRenamer. When a TemplateContext is reused and the filter is tightened for a later render, Scriban still reuses the old accessor and continues exposing members that should now be hidden. Details The relevant code path is: - TemplateContext.GetMemberAccessor() caches accessors in memberAccessors by Type in src/Scriban/TemplateContext.cs lines 850–863. - For plain .NET objects, GetMemberAccessorImpl() creates a new TypedObjectAccessor(type, keyComparer, MemberFilter, MemberRenamer) in src/Scriban/TemplateContext.cs lines 909–939. - TypedObjectAccessor stores the current filter and precomputes the exposed member set in its constructor and PrepareMembers() in src/Scriban/Runtime/Accessors/TypedObjectAccessor.cs lines 33–40 and 119–179. - Member access later goes through ScriptMemberExpression.GetValue() in src/Scriban/Syntax/Expressions/ScriptMemberExpression.cs lines 67–95, which uses the cached accessor. - TemplateContext.Reset() does not clear memberAccessors in src/Scriban/TemplateContext.cs lines 877–902. As a result, once a permissive accessor has been created for a given type, changing TemplateContext.MemberFilter later does not take effect for that type on the same reused context. This is especially relevant because the Scriban docs explicitly recommend TemplateContext.MemberFilter for indirect .NET object exposure. --- Proof of Concept Setup Program.cs Run Actual Output Expected Behavior The second render should fail or stop exposing Secret, because the filter only allows Public and EnableRelaxedMemberAccess is disabled. This reproduces a direct filter bypass caused by the stale cached accessor. --- Impact This is a protection-mechanism bypass. Applications that use TemplateContext.MemberFilter as part of their sandbox or object-exposure policy can unintentionally expose hidden members across requests when they reuse a TemplateContext. The impact includes: - Unauthorized read access to filtered properties or fields - Unauthorized writes if the filtered member also has a setter - Policy bypass across requests, users, or tenants when contexts are pooled

## Sources

- [GitHub Advisory GHSA-5wr9-m6jw-xx44](https://github.com/advisories/GHSA-5wr9-m6jw-xx44)
- [github.com](https://github.com/scriban/scriban/security/advisories/GHSA-5wr9-m6jw-xx44)

---
Source page: https://erroneo.us/security/ghsa/GHSA-5wr9-m6jw-xx44/ · Security Digest: https://erroneo.us/security/ · More: https://erroneo.us/llms.txt
