CVE-2026-125112: djust: A template binding inherits a context safety grant it never earned (XSS)

Published Sep 17, 2026
·
Updated

A context safety grant was inherited by a template binding that never earned it, so rebinding a name the view had marked safe left the mark attached to the new, attacker-controlled value.

djust's context safety channel is keyed by name, not by value. Every bind copied the value and left the grant in place:

view marks p = marksafe('<b>trusted</b>') template {% with p=userinput %}{{ p }}{% endwith %}

djust '<img src=x onerror=alert(1)>' <- executes django '&lt;img src=x onerror=alert(1)&gt;'

Affected binds

Eight distinct shapes were live. All are fixed in 1.1.2:

| shape | example | |---|---| | {% with %} rebinding a marked name | {% with p=hostile %}{{ p }}{% endwith %} | | {% with %} descendant of a rebound name | {% with p=hostile %}{{ p.a }}{% endwith %} | | {% with %} binding over a marked name | {% with q=hostile %}{{ q }}{% endwith %} | | {% for %} loop variable | {% for p in hostiles %}{{ p }}{% endfor %} | | {% for %} descendant | {% for p in hostiles %}{{ p.a }}{% endfor %} | | {% for %} tuple unpacking | {% for k, v in rows %}{{ v }}{% endfor %} | | {% include … with %} | {% include "c.html" with q=hostile %} | | assign tags | {% … as x %} |

No filter chain and no |safe anywhere in the template is required. The precondition is that the application marked some value safe under a name that a template later rebinds — an ordinary pattern, since a view commonly marks trusted markup safe and templates commonly reuse short names such as p, item or row.

Impact

Stored or reflected XSS in any djust application that combines marksafe (or any framework path that grants a context key safety) with a template that rebinds that name. Exploitation requires no unusual template construct.

Patches

Fixed in 1.1.2, and in 1.2.0 (main).

The rule is that a bind replaces the grant rather than inheriting one. It is stated that way deliberately: the originally reported defects pointed the opposite direction — a grant being lost across some binds, causing over-escaping — and fixing only the reported direction would have left this leak in place. Both directions are the same rule.

Not fixed in 1.1.2, and tracked for 1.2.0: two over-escaping cases where a grant fails to travel with a value that legitimately carries one ({% with body=post.text|linebreaks %}, and marksafe reaching a template through dict.values / dict.items). Both escape more than Django rather than less, so neither is a leak.

Workarounds

Before upgrading, avoid reusing a context name for both marksafe'd content and untrusted input, and avoid rebinding such a name in {% with %}, {% for %}, {% include … with %} or an assign tag.

Credit

Found while preparing the 1.1.1 security release: the reproducer published in GHSA-9395-2g46-rj3f was run against the built 1.1.1 artifact before that advisory was published, and proved the class was still live. Publishing the original text would have reported this class as patched when it was not.

Other sources

djust provides Phoenix LiveView-style reactive server-side rendering for Django with Rust-powered performance. Prior to versions 1.0.10 and 1.1.2, djust keys context output-safety grants by variable name and fails to revoke a grant when a template bind replaces the value associated with that name. A template using {% with %}, {% for %}, {% include ... with %}, tuple unpacking, or assign tags can therefore rebind a name that previously held marksafe content and emit the new attacker-controlled value without escaping, including descendant lookups through the rebound name. This can cause stored or reflected cross-site scripting when a victim renders the affected template. This issue is fixed in versions 1.0.10 and 1.1.2.

— MITRE

Affected Software

3 affected componentsFixes available
pypi/djust<1.0.10, >=1.1.0<1.1.2
pip/djust<1.0.10
1.0.10
pip/djust>=1.1.0<1.1.2
1.1.2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/djust to a version that resolves this vulnerability.

    Fixed in 1.0.10
  2. Upgrade

    Upgrade pip/djust to a version that resolves this vulnerability.

    Fixed in 1.1.2
  3. Upgrade

    Upgrade djust to a version that resolves this vulnerability.

    Fixed in 1.1.2
  4. Compensating control

    Before upgrading, avoid reusing a context name for both mark_safe'd content and untrusted input, and avoid rebinding such names in {% with %}, {% for %}, {% include … with %}, tuple unpacking, or assign tags.

Event History

Sep 17, 2026
Advisory Published
via OSV·08:31 PM
Data Sourced
via OSV·08:31 PM
DescriptionSeverityWeaknessAffected Software
Nov 9, 2026
CVE Published
via MITRE·10:08 PM
Data Sourced
via MITRE·10:08 PM
DescriptionWeakness
Data Sourced
via NVD·10:18 PM
DescriptionSeverityWeakness

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203