Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐍 PyPI
Not in CISA KEV

GHSA-xjw9-38cr-6372 djust

GHSA-xjw9-38cr-6372 is a security vulnerability in djust. A fix is available for djust — see the affected versions and patch details below.

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

Published
Sep 17, 2026
Updated
Sep 17, 2026
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Sep 17, 2026 · OSV.dev, FIRST.org (EPSS)

Real-World Exposure

1 pkg affected
🐍djust

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.

Description

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 = mark_safe('<b>trusted</b>')
template     {% with p=user_input %}{{ 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:

shapeexample
{% 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 mark_safe (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 mark_safe 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 mark_safe'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.

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
🐍PyPIdjustall versions1.1.2pip install --upgrade 'djust==1.1.2'

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for djust, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update djust to 1.1.2 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-xjw9-38cr-6372 is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-xjw9-38cr-6372 can be triaged on real exposure rather than presence alone.

Tailored to GHSA-xjw9-38cr-6372. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

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 = mark_safe('<b>trusted</b>') template {% with p=user_input %}{{ 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 f
O3 Security · Impact-Aware SCA

Is GHSA-xjw9-38cr-6372 in your dependencies?

O3 Security finds GHSA-xjw9-38cr-6372 across PyPI dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.

GHSA-xjw9-38cr-6372: djust XSS | O3 Security