djust template XSS via inherited context safety grant

Severity: high · CVSS 6.1 · Published 2026-09-17

djust is a Django-compatible template engine. A security mark applied by developers to trusted content (using mark_safe) was incorrectly inherited when a template later reused the same variable name with untrusted user input. This allows attackers to inject malicious HTML or JavaScript that executes in users' browsers, affecting any application that combines safe-marked content with template variable rebinding.

Technologies: djust (PyPI). Vendors: PyPI.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
High severity, with a CVSS score of 6.1, published 17 September 2026.
Which products and versions are affected?
djust (PyPI) <= 1.1.1.
Is there a fix for This vulnerability?
A patch was published on 2026-09-17: Fixed in djust 1.1.2 and 1.2.0 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is This vulnerability attacked?
It is attacked over the network, in a software library.
Am I affected?
Check whether you run djust (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

Technical details

djust's context safety model is keyed by variable name rather than value. When a template rebinds a name previously marked safe (via mark_safe or similar) to a new, attacker-controlled value, the safety grant is incorrectly inherited by the new value and rendered unescaped. The vulnerability affects eight template constructs: `{% with %}` rebinding, `{% for %}` loops, `{% include … with %}`, and assign tags. No filter chain or explicit `|safe` filter is required; exploitation requires only that a view marks some value safe under a name that the template later rebinds to untrusted input—a common pattern. Fixed in version 1.1.2 by ensuring binds replace rather than inherit safety grants.

Affected products

  • djust djust before 1.1.2

Timeline

  • 2026-09-17: disclosed: GHSA-xjw9-38cr-6372 published
  • 2026-09-17: patched: Fixed in djust 1.1.2 and 1.2.0

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.