CVE-2026-57170: Compliance trestle Trestle SSTI Vulnerability
HIGHCVE-2026-57170 is a HIGH (CVSS 7.8) trestle ssti vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Compliance trestle libraries in the PyPI ecosystem. The issue involves trestle ssti in jinja2 include tags allows arbitrary code execution (incomplete fix of cve-2026-46439). Remediation is available by upgrading affected packages to version 3.12.4, 4.1.0.
CVE-2026-57170 at a Glance
Security Impact
CVSS: 7.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2026-57170
To remediate this vulnerability, upgrade all affected Compliance trestle dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install compliance-trestle>=3.12.4
pip install compliance-trestle>=4.1.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show compliance-trestle
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-57170, inspect your installed packages using pip:
pip show compliance-trestle
Analyze the terminal output to locate any version of Compliance trestle in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.12.4), your application is affected.
Note: The pip show compliance-trestle command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Compliance trestle, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-57170 Affected Compliance trestle Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
compliance-trestle
|
PyPI |
< 3.12.4
|
3.12.4
|
|
compliance-trestle
|
PyPI |
≥ 4.0.0
< 4.1.0
|
4.1.0
|
References
Frequently Asked Questions
What is CVE-2026-57170?
Which Compliance trestle versions are affected?
What version fixes CVE-2026-57170?
Is compliance-trestle affected?
What is the CVSS score of CVE-2026-57170?
What CWE is associated with CVE-2026-57170?
How can I check PyPI dependencies for CVE-2026-57170?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-mr95-65j8-9mxp",
"modified" : "2026-09-24T19:50:27Z",
"published" : "2026-09-24T19:50:27Z",
"aliases" : [ "CVE-2026-57170" ],
"summary" : "Trestle SSTI in Jinja2 include tags allows arbitrary code execution (Incomplete fix of CVE-2026-46439)",
"details" : "Reporter: Cavan Loughran, Celvex Group Inc.\n\nSummary\n-------\nThe fix for CVE-2026-46439 (3.12.2 / 4.0.3) removed the recursive re-render loop in trestle/core/commands/author/jinja.py render_template, but the custom include tags in trestle/core/jinja/tags.py (MDSectionInclude, MDCleanInclude) still re-parse the CONTENT of an included markdown file as a Jinja2 template via Parser(self.environment, <file text>).parse() in a plain (non-sandboxed) jinja2.Environment. Because the trestle markdown writers (ssp_io.py SSPMarkdownWriter, docs_control_writer.py DocsControlWriter) write OSCAL prose / component-description fields verbatim (the {{ -> [[ neutralization is applied to parameter tables only), attacker-controlled OSCAL data that flows into an included markdown file is interpreted as template code and can achieve arbitrary code execution on the runner. This is the same trust boundary and impact as CVE-2026-46439 via a sink the fix did not cover.\n\nAffected versions\n-----------------\n4.0.3 and earlier on this code path (the include tags predate and were untouched by the parent fix); the 3.12.x line likewise. Verified present in the fixed release 4.0.3 by direct source read.\n\nTechnical detail\n----------------\nSink (UNCHANGED by the parent fix), trestle/core/jinja/tags.py:\n\nMDSectionInclude.parse (the {% mdsection_include 'file.md' '# Section' %} tag), approximately:\n md_content, _, _ = self.environment.loader.get_source(self.environment, markdown_source.value) # ~line 90\n ...\n local_parser = Parser(self.environment, md_section.content.raw_text) # ~line 104 <-- RE-PARSE\n top_level_output = local_parser.parse() # ~line 105\n return top_level_output.body # ~line 106\n\nMDCleanInclude.parse (the {% md_clean_include 'file.md' %} tag), approximately:\n md_content, _, _ = self.environment.loader.get_source(self.environment, markdown_source.value) # ~line 141\n ...\n local_parser = Parser(self.environment, content) # ~line 150 <-- RE-PARSE\n top_level_output = local_parser.parse() # ~line 151\n return top_level_output.body # ~line 152\n\nParser(self.environment, <included file text>).parse() compiles the included file's markdown text AS A JINJA TEMPLATE and splices the resulting AST .body directly into the host template's compilation. Any {{ ... }} / {% ... %} present in the included file is interpreted as template code, not emitted as literal text. The single-pass fix in render_template has no effect on this: the re-parse happens at compile time inside the tag, on a string the outer render loop never sees as data.\n\nEnvironment is NOT sandboxed (UNCHANGED by the fix), trestle/core/commands/author/jinja.py _create_jinja_environment:\n return Environment(loader=FileSystemLoader(template_folder), extensions=extensions(), trim_blocks=True, autoescape=True)\nThis is a plain jinja2.Environment, not jinja2.sandbox.SandboxedEnvironment, so a re-parsed expression has full access to the usual Jinja SSTI gadget chain leading to OS command execution. autoescape=True HTML-escapes output but does not constrain expression evaluation, so it does not mitigate code execution.\n\nData bridge (partial neutralization only): the included markdown is, in trestle's documented workflow, produced from OSCAL by the trestle generators / writers. trestle/core/ssp_io.py SSPMarkdownWriter writes control statement prose (get_control_statement_ssp) and component implementation descriptions (prose = by_comp.description) into markdown with no Jinja-delimiter escaping. trestle/core/docs_control_writer.py DocsControlWriter writes control section prose (self._md_file.new_line(prose)) and part text raw. The maintainers DO know about the {{-in-data risk: ssp_io.py applies line.replace('{{', '[[').replace('}}', ']]') to neutralize delimiters, but ONLY inside the parameter-table method (_parameter_table). Control-statement prose and component description fields receive no such neutralization. So an OSCAL field such as an SSP component description, a control statement override, or a catalog part prose string that contains {{ <gadget> }} lands verbatim in the generated markdown, and then the include tag re-parses and executes it.\n\nWhy this is a genuine incomplete fix (not the same bug): the parent CVE-2026-46439 re-evaluation site was the recursive loop in render_template (main template output) in commands/author/jinja.py, which the fix removed. THIS variant's re-evaluation site is Parser(self.environment, ...) inside mdsection_include / md_clean_include (included file content) in core/jinja/tags.py, which the fix did NOT touch, and which runs in a plain (non-sandboxed) Environment. Same class (SSTI -> RCE), same trust boundary (untrusted OSCAL data), different and still-live sink.\n\nReachability (non-destructive reasoning)\n----------------------------------------\n1. A pipeline ingests OSCAL content (component-definition, SSP, profile, or catalog) that an external or lower-trust party can influence (a component supplier, a control-narrative contributor, an upstream catalog). This is precisely the parent's accepted attacker: a malicious actor supplies crafted OSCAL content in an automated pipeline (CI/CD).\n2. The pipeline runs trestle author ssp-generate (or equivalent) which writes the OSCAL prose/description fields into markdown verbatim. A field value such as {{ cycler.__init__.__globals__['os'].popen('id').read() }} survives intact (no neutralization on prose/description).\n3. The pipeline then runs trestle author jinja -i template.md.j2 ... where the template composes the document with {% md_clean_include 'generated_control.md' %} or {% mdsection_include 'generated_ssp.md' '# Some Section' %} (the documented populate-content-from-other-documents pattern).\n4. The include tag re-parses the generated markdown in the non-sandboxed environment and the embedded expression executes => code runs with the privileges of the trestle process (the CI runner).\n\nNon-destructive confirmation: place a benign marker such as {{ 7*7 }} in an OSCAL prose / description field; run the generator that writes it to markdown; include that markdown with {% md_clean_include 'generated.md' %}; observe 49 rather than the literal {{ 7*7 }}, confirming evaluation. A malicious field would use the standard Jinja gadget chain; that is deliberately NOT included here.\n\nImpact\n------\nArbitrary code execution on the trestle process (the CI runner), under the same trust boundary that CVE-2026-46439 was assigned on (untrusted OSCAL data in an automated pipeline). Non-sandboxed environment => full RCE in a release that is patched for the parent CVE.\n\nRemediation\n-----------\n(a) render the include re-parse through jinja2.sandbox.SandboxedEnvironment, OR (b) emit the included file content as literal text (do not re-parse it as a template), OR (c) extend the {{ / }} -> [[ / ]] neutralization in ssp_io.py / docs_control_writer.py to ALL OSCAL prose / description / part-text writes, not just parameter tables. Option (a) or (b) is the durable fix; (c) is defense-in-depth.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "compliance-trestle"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.12.4"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "compliance-trestle"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.1.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/oscal-compass/compliance-trestle/security/advisories/GHSA-mr95-65j8-9mxp"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-57170"
}, {
"type" : "WEB",
"url" : "https://github.com/oscal-compass/compliance-trestle/pull/2270"
}, {
"type" : "WEB",
"url" : "https://github.com/oscal-compass/compliance-trestle/commit/0f82d19bd42f9cc0f1b3acd7fc3f6dafe3b6ae10"
}, {
"type" : "WEB",
"url" : "https://github.com/oscal-compass/compliance-trestle/commit/5335ff873a2a68eb7de43df029bea09cadff22fd"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/oscal-compass/compliance-trestle"
}, {
"type" : "WEB",
"url" : "https://github.com/oscal-compass/compliance-trestle/releases/tag/v3.12.4"
}, {
"type" : "WEB",
"url" : "https://github.com/oscal-compass/compliance-trestle/releases/tag/v4.1.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1336", "CWE-94" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-09-24T19:50:27Z",
"nvd_published_at" : "2026-08-26T05:18:11Z"
}
}