/

CVE-2026-46439

Severity:

HIGH RISK

(7.8)

Server-Side Template Injection (CWE-94) in Trestle

CVE-2026-46439

Deferred

Vulnerability type

Category:

Server-Side Template Injection

CWE:

CWE-94, CWE-1336

Impact:

Arbitrary Command Execution

Severity:

HIGH RISK

(7.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

compliance-trestle contains a server-side template injection vulnerability in the trestle author jinja command. Recursive re-evaluation causes attacker-controlled data inserted into a trusted template to be interpreted as template code, which may enable arbitrary command execution with the privileges of the running process.

Affected context

The vulnerability affects workflows that use the trestle author jinja command to render compliance content, such as SSP documents or Lookup Tables. It becomes risky when attacker-controlled values are included in data rendered by a trusted template and the rendered output is recursively compiled and evaluated as a new template.

Exploit preconditions

  • Attack surface: The trestle author jinja template-rendering command
  • Required access: Ability to influence data fields consumed by a trusted template
  • Trigger point: Recursive parsing and rendering of previously rendered output
  • Why exploitation is possible: Data that was intended to remain plain text is reinterpreted as template logic during a subsequent rendering pass

Why this happens

The underlying bug is recursive re-compilation and re-rendering of output generated by a template engine. This breaks the intended trust boundary between trusted template code and untrusted data, allowing expressions embedded in data values to be evaluated as executable template content.

This maps primarily to CWE-94: Improper Control of Generation of Code, because attacker-controlled content can influence executable behavior. It is also closely related to CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine, because template syntax in data is not safely treated as literal content.

Potential impact

  • Arbitrary commands may execute with the privileges of the running process
  • Compliance authoring workflows could be compromised
  • Sensitive files, credentials, or environment data could be accessed
  • Generated compliance artifacts may be altered or poisoned
  • The host or build environment could be used for further compromise

General mitigation guidance

Mitigation generally focuses on preserving the separation between trusted templates and untrusted data.

Common defensive patterns include:

  • Rendering untrusted values as data only, without recursive template evaluation
  • Treating rendered output as inert text rather than compiling it again
  • Applying strict template-engine sandboxing and capability restrictions where supported
  • Validating and constraining data fields before rendering
  • Limiting process privileges, filesystem access, and network permissions
  • Separating authoring, rendering, and execution environments
  • Keeping template-processing components aligned with maintained security fixes

How teams detect issues like this

Organizations can look for:

  • Static-analysis findings involving recursive template compilation or rendering
  • Code paths that pass rendered output back into a template engine
  • Review signals showing that data fields and template source share the same evaluation path
  • Tests verifying that template syntax supplied through data remains literal
  • Policy checks requiring sandboxed rendering and restricted process privileges
  • Runtime monitoring for unexpected child processes or command execution during document generation

Automated code-review and dependency-analysis tools may help identify unsafe template-engine usage, but should be supplemented with focused tests for recursive rendering behavior.

Sources

SourceLink
github.comgithub.com/oscal-compass/compliance-trestle/commit/247fcce289f60103f3d8e28d8ec51a6986b94fb6
github.comgithub.com/oscal-compass/compliance-trestle/commit/7d107b3ac53caca7bde97a6278b23cd739d94525
github.comgithub.com/oscal-compass/compliance-trestle/security/advisories/GHSA-gg2g-p7xc-qqmm
github.comgithub.com/pypa/advisory-database/tree/main/vulns/compliance-trestle/PYSEC-2026-2425.yaml

Frequently asked

questions

Yes. The key condition is control over data rendered into a trusted template. Recursive processing can cause that data to be interpreted as template content even when the template itself is trusted.

An attacker generally needs a way to modify or supply data fields consumed by the trestle author jinja workflow, such as values in compliance documents or lookup data.

Treat rendered data as inert text and prevent already-rendered output from being compiled or evaluated again. Template execution should be restricted to explicitly trusted template source.

Maintain a strict trust boundary between templates and data, test that user-controlled values remain literal, use sandboxing where appropriate, and run rendering processes with minimal privileges.

Find out what's already
exploitable in your codebase.