Skip to main content

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

0
High
Published: 09/17/2026 (09/17/2026, 20:31:48 UTC)
Source: GCVE Database
Product: djust

Description

djust versions prior to 1.1.2 contain a vulnerability where a template binding inherits a context safety grant it never earned, leading to stored or reflected cross-site scripting (XSS). This occurs when a view marks a value safe (e.g., using mark_safe) and a template later rebinds that name to attacker-controlled input, causing the safety mark to be incorrectly retained. The issue affects multiple template binding constructs such as {% with %}, {% for %}, {% include … with %}, and assign tags. The vulnerability is fixed in version 1.1.2 and later.

CVSS v4.0

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
None
Vuln. Confidentiality
None
Vuln. Integrity
High
Vuln. Availability
None
Subsq. Confidentiality
None
Subsq. Integrity
None
Subsq. Availability
None
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N

Affected software

PyPIghsa
djust
Affected versions
<1.1.2

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 09/18/2026, 01:27:01 UTC

Technical Analysis

The vulnerability in djust arises because the context safety channel is keyed by variable name rather than by value. When a template rebinding occurs (e.g., {% with p=user_input %}), the safety grant associated with the original safe value is incorrectly inherited by the new, potentially unsafe value. This leads to XSS when the template outputs attacker-controlled input marked as safe. Eight distinct binding shapes are affected, including rebinding in {% with %}, loop variables in {% for %}, tuple unpacking, and includes with context overrides. The fix in 1.1.2 changes the behavior so that a bind replaces the safety grant rather than inheriting it, preventing unsafe values from being treated as safe. Some over-escaping issues remain and are tracked for 1.2.0 but do not cause leaks.

Potential Impact

This vulnerability allows stored or reflected XSS in any djust application that uses mark_safe (or equivalent safety grants) combined with templates that rebind those safe names to attacker-controlled input. Exploitation requires no unusual template constructs and can lead to execution of arbitrary JavaScript in the context of the vulnerable application, potentially compromising user sessions or data.

Mitigation Recommendations

A fix is available in djust version 1.1.2 and later. Users should upgrade to at least version 1.1.2 to remediate this vulnerability. Until upgrading, avoid reusing context variable names for both mark_safe'd content and untrusted input, and avoid rebinding such names in template constructs like {% with %}, {% for %}, {% include … with %}, or assign tags.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Gcve Source
db.gcve.eu
Osv Id
GHSA-xjw9-38cr-6372
Osv Schema Version
1.4.0
Ecosystems
["PyPI"]
Database Specific Severity
HIGH
Cvss Version
4.0

Threat ID: 6aac8dee55bf5e2cf54900ee

Added to database: 09/18/2026, 01:03:42 UTC

Last enriched: 09/18/2026, 01:27:01 UTC

Last updated: 09/18/2026, 01:27:01 UTC

Views: 3

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses