<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:webfeeds="http://webfeeds.org/rss/1.0"><channel><title>Trestle - CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/trestle/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata. Fed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Fri, 28 Aug 2026 21:19:10 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/trestle/feed.xml" rel="self" type="application/rss+xml"/><image><url>https://feed.craftedsignal.io/favicon-32x32.png</url><title>CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/</link><width>32</width><height>32</height></image><webfeeds:icon>https://feed.craftedsignal.io/favicon.svg</webfeeds:icon><item><title>Trestle Server-Side Template Injection via Custom Jinja2 Extensions</title><link>https://feed.craftedsignal.io/briefs/2026-08-trestle-ssti/</link><pubDate>Fri, 28 Aug 2026 21:19:10 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-08-trestle-ssti/</guid><description>The Trestle command-line tool is vulnerable to Server-Side Template Injection (SSTI) due to the unsafe re-evaluation of untrusted Markdown content as Jinja2 template code.</description><content:encoded><![CDATA[<p>Trestle contains multiple Server-Side Template Injection (SSTI) vulnerabilities within its Jinja2 rendering pipeline. The application processes Markdown files and other data sources using custom Jinja2 extensions (<code>MDCleanInclude</code> and <code>MDSectionInclude</code>). These extensions improperly treat untrusted content as Jinja2 template source code by passing it directly to the <code>jinja2.Parser</code> object without adequate sanitization or sandboxing. Because the environment utilizes a standard <code>jinja2.Environment</code> rather than a <code>SandboxedEnvironment</code>, attackers can inject malicious Jinja2 expressions, such as object traversal payloads (e.g., <code>__class__.__mro__</code>, <code>__globals__</code>), to achieve arbitrary command execution via Python's <code>os.system</code> or <code>subprocess</code> modules. This pattern exists within <code>trestle/core/jinja/tags.py</code> and is triggered whenever a user-provided or workspace-modified Markdown file is processed by the Trestle authoring commands.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker places a malicious <code>.md</code> file containing a Jinja2 payload (e.g., <code>{{ ... os.system(...) }}</code>) into the Trestle workspace.</li>
<li>Attacker executes the <code>trestle author jinja</code> CLI command, targeting a legitimate template that utilizes the vulnerable <code>{% md_clean_include %}</code> or <code>{% mdsection_include %}</code> tags.</li>
<li>The Trestle engine loads the malicious file from the filesystem via <code>FileSystemLoader</code>.</li>
<li>The <code>MDCleanInclude</code> or <code>MDSectionInclude</code> tag handler processes the file content, extracting the Markdown body without sanitization.</li>
<li>The extracted content is passed as raw string input to the <code>Parser</code> constructor in <code>trestle/core/jinja/tags.py</code>.</li>
<li>The <code>Parser.parse()</code> method triggers the evaluation of the injected Jinja2 syntax within the template context.</li>
<li>The injected Python payload executes with the privileges of the Trestle process, leading to full Remote Code Execution (RCE) or sensitive data exfiltration.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation allows for arbitrary code execution on the system running the Trestle command. If used in automated CI/CD pipelines, this can result in the compromise of build environments, leakage of environment variables (e.g., API keys, AWS credentials), or lateral movement within the infrastructure.</p>
<h2 id="recommendation">Recommendation</h2>
<ol>
<li>Immediately restrict write access to all Trestle workspace directories to trusted users to prevent the introduction of malicious Markdown files.</li>
<li>Patch the application code by modifying <code>trestle/core/jinja/tags.py</code> to stop re-parsing Markdown content via <code>Parser.parse()</code>, replacing it with <code>nodes.TemplateData</code> as suggested by the security advisory.</li>
<li>Transition from <code>jinja2.Environment</code> to <code>jinja2.sandbox.SandboxedEnvironment</code> in <code>trestle/core/commands/author/jinja.py</code> to restrict access to sensitive Python object attributes.</li>
<li>Implement a pre-commit hook or CI scanning gate to audit all workspace files for Jinja2 syntax patterns and dangerous Python method calls (e.g., <code>__globals__</code>, <code>os.system</code>, <code>subprocess</code>).</li>
</ol>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>ssti</category><category>rce</category><category>python</category><category>jinja2</category></item></channel></rss>