Summary
Scriban versions before 7.5.2 allow template authors to use reflection member accessors on imported function values to inspect .NET delegate internals. Depending on the functions exposed by the host application, this may reveal sensitive data such as captured closure values or assembly paths, and may allow service properties to be overwritten.
Affected context
The issue occurs in Scriban environments that let templates access imported .NET delegates through reflection-capable member accessors. It becomes risky when template authors are untrusted or less trusted than the application hosting Scriban, and exposed delegates contain sensitive captured state or references to mutable service properties.
Exploit preconditions
- Attack surface: Scriban template evaluation in an application that imports .NET functions or delegates.
- Required access: Ability to author or modify a template that the application evaluates.
- Trigger point: Template evaluation that uses
array.mapand reflection member accessors on imported delegates. - Why exploitation is possible: Delegate members such as
Target,Method, orReturnTypemay be accessible, allowing templates to inspect internal values or interact with exposed object state.
Why this happens
The underlying issue is insufficient restriction of reflection-based member access on function values exposed to templates. When templates can inspect .NET delegate internals, implementation details and captured state may cross the boundary between the host application and template code. This is associated with CWE-200: Exposure of Sensitive Information to an Unauthorized Actor; access to mutable service properties may also create object-manipulation risks.
Potential impact
- Templates may disclose captured closure secrets or other sensitive values.
- Templates may expose assembly paths and implementation details.
- Templates could overwrite accessible service properties, potentially affecting application behavior.
- Revealed internals may help an attacker identify further weaknesses in the host application.
General mitigation guidance
Common defensive patterns include:
- Restricting or disabling reflection-based member access for untrusted templates.
- Exposing narrow, purpose-built template functions instead of general .NET delegates or service objects.
- Avoiding sensitive data in delegate targets and captured closures.
- Limiting templates to the minimum capabilities and data required for their task.
- Separating template execution from privileged application state and applying least privilege.
How teams detect issues like this
Review template engine configuration for reflection-capable member access and inspect which delegates and objects are exposed to templates. Static analysis and code review can look for broad imports, captured secrets, and mutable service properties reachable from template contexts. Policy checks can require explicit approval for new template-visible functions and enforce restricted access for untrusted templates.

