/

CVE-2026-54757

Severity:

HIGH RISK

(7.8)

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

CVE-2026-54757

Deferred

Vulnerability type

Category:

Server-Side Template Injection

CWE:

CWE-94

Impact:

Remote Code 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

Trestle contains a server-side template injection vulnerability in custom Jinja2 Markdown inclusion tags. When an attacker controls Markdown or lookup-table content that Trestle renders, injected template expressions may execute operating system commands in the Trestle process.

Affected context

The vulnerability occurs in Trestle workflows that render attacker-influenced Markdown or YAML lookup-table values through the MDCleanInclude or MDSectionInclude Jinja2 tags. It is relevant when untrusted workspace content, third-party OSCAL documents, or other externally sourced data reaches these rendering paths and is reinterpreted as Jinja2 template source.

Exploit preconditions

  • Attack surface: Trestle document-rendering workflows and custom Markdown inclusion tags
  • Required access: Ability to influence Markdown content, an imported SSP document, or a YAML lookup-table value processed by Trestle
  • Trigger point: Rendering content through MDCleanInclude or MDSectionInclude
  • Why exploitation is possible: Untrusted content is parsed again as Jinja2 template code by a non-sandboxed environment, allowing template expressions to access Python internals and invoke process capabilities

Why this happens

The underlying bug is server-side template injection, mapped to CWE-94: Improper Control of Generation of Code. Trestle re-parses untrusted Markdown content as template source instead of treating it solely as data. Because the Jinja2 environment is not sandboxed, template evaluation can reach unsafe Python objects and operations, converting attacker-controlled content into executable behavior.

Potential impact

  • Arbitrary operating system commands may execute with the privileges of the Trestle process
  • Local files or compliance documents could be read, modified, or deleted
  • Generated OSCAL output may be tampered with
  • Credentials, tokens, or environment data could be exposed
  • Build, automation, or document-processing systems could be compromised

General mitigation guidance

Mitigation generally focuses on preserving the boundary between document data and executable templates.

Common defensive patterns include:

  • Treating included Markdown and lookup-table values strictly as data
  • Avoiding second-pass template evaluation of untrusted content
  • Using sandboxed or restricted template environments when templating is necessary
  • Allowlisting permitted template constructs and accessible objects
  • Applying strict schemas and validation to imported documents and lookup data
  • Running document-processing jobs with least privilege and minimal filesystem and network access
  • Restricting the provenance and mutability of workspace and third-party document inputs

How teams detect issues like this

Detection can focus on:

  • Static analysis rules identifying non-sandboxed Jinja2 environments and dynamic template compilation
  • Code review checks for template rendering or re-rendering of Markdown and YAML-derived values
  • Searches for inclusion tags that pass user-controlled content into template parsers
  • Policy enforcement requiring approved sandboxing, object allowlists, and input validation
  • Runtime monitoring for unexpected child processes, shell activity, filesystem access, or network connections during document generation
  • Automated security review tools that flag server-side template injection patterns

Sources

SourceLink
github.comgithub.com/oscal-compass/compliance-trestle/commit/0f82d19bd42f9cc0f1b3acd7fc3f6dafe3b6ae10
github.comgithub.com/oscal-compass/compliance-trestle/commit/5335ff873a2a68eb7de43df029bea09cadff22fd
github.comgithub.com/oscal-compass/compliance-trestle/security/advisories/GHSA-jw39-3688-r4rx

Frequently asked

questions

Exploitation is not necessarily network-direct. It can occur when an attacker can supply or modify content that a Trestle service, pipeline, or operator later renders.

The attacker needs a path to influence rendered Markdown, an imported SSP document, or a YAML lookup-table value. The exact requirement depends on how Trestle inputs are obtained and protected.

Do not re-interpret untrusted content as template source. Where templating is required, use a sandboxed environment with strict syntax and object-access restrictions.

Keep data and executable templates separate, validate document inputs, review dynamic rendering paths, and run Trestle automation with least-privilege permissions.

Find out what's already
exploitable in your codebase.