CVE-2026-54757
Server‑side template injection in Trestle Jinja2 tags enables remote code execution.
- CVSS 7.8
- 94
- Input Validation and Sanitization
- Remote
Compliance-trestle (Trestle) is a Python SDK and command-line tool for managing OSCAL compliance documents. In versions before 3.12.4 and versions 4.0.0 through 4.0.3, Trestle is vulnerable to server-side template injection that can lead to remote code execution. This occurs because the MDCleanInclude and MDSectionInclude Jinja2 tags re-parse untrusted Markdown content as template source code using a non-sandboxed jinja2.Environment. An attacker who controls content that Trestle renders, such as a crafted workspace Markdown file, a third-party SSP document, or a YAML lookup-table value, can inject a Jinja2 expression that traverses Python object internals to execute arbitrary operating system commands in the context of the Trestle process. This issue is fixed in versions 3.12.4 and 4.1.0.
- CWE
- 94
- CVSS base score
- 7.8
- Published
- 2026-08-25
- OWASP
- A04 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Incorrect Check
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Python
- Fixed by upgrading
- Yes
Solution
Upgrade Trestle to 3.12.4 or later (or to 4.1.0 or later).
Vulnerable code sample
import jinja2
def render_markdown(md_text: str) -> str:
# VULNERABLE: unsandboxed Jinja2 environment allows template injection
env = jinja2.Environment()
template = env.from_string(md_text)
return template.render()Patched code sample
import jinja2
from jinja2.sandbox import SandboxedEnvironment
def render_markdown(md_text: str) -> str:
# FIX: use sandboxed environment to prevent template injection
env = SandboxedEnvironment()
template = env.from_string(md_text)
return template.render()Payload
__VAITP_MODEL_REFUSED__
Cite this entry
@misc{vaitp:cve202654757,
title = {{Server‑side template injection in Trestle Jinja2 tags enables remote code execution.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-54757},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-54757/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
