compliance-trestle Vulnerable to Remote Code Execution via Recursive Server-Side Template Injection (SSTI)
Date: 2026-05
Affected: pip/compliance-trestle, pip/compliance-trestle
Attack vector: rce
Category: vulnerability-disclosure
Severity: High
CVE: CVE-2026-46345
CVE-2026-46439
CWE: CWE-1336
CWE-22
CWE-36
CWE-73
CWE-94
CVSS: 7.8 (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H)

A High severity Server-Side Template Injection (SSTI) vulnerability exists in the `trestle author jinja` command. The command recursively evaluates rendered templates, allowing an attacker to achieve arbitrary command execution with privileges of the running process by injecting malicious payloads into data fields (such as SSP documents or Lookup Tables). **The vulnerability does not require attacker control of the template itself. Only attacker-controlled input data rendered into a trusted template is required.** This distinction is critical: the template author may only intend to render plain text (e.g., `Title: {{ ssp.metadata.title }}`), but because of the recursive parsing, the data field itself becomes executable. The vulnerability is caused by recursive re-compilation and re-rendering of already-rendered output. ## Details In `trestle/core/commands/author/jinja.py`, the `render_template` method performs recursive template evaluation to allow nesting within expressions: ```python @staticmethod def render_template(template: Template, lut: Dict[str, Any], template_folder: pathlib.Path) -> str: new_output = template.render(**lut) output = '' error_countdown = JinjaCmd.max_recursion_depth while new_output != output and error_countdown > 0: error_countdown = error_countdown - 1 output = new_output random_name = uuid.uuid4() dict_loader = DictLoader({str(random_name): new_output})


Mitigations:

Architectural layers (MAESTRO):