CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-XJW9-38CR-6372

GHSA-XJW9-38CR-6372: Cross-Site Scripting via Stale Safe-Key Inheritance in djust Template Shadowing

Amit Schendel
Amit Schendel
Senior Security Researcher

Sep 18, 2026·6 min read·10 visits

Executive Summary (TL;DR)

A name-based context safety grant in djust is inherited by shadowed variables, causing raw rendering of untrusted values and allowing unauthenticated remote execution of arbitrary JavaScript.

An escaping defect in the djust templating engine allows Cross-Site Scripting (XSS) when a template binding construct shadows a variable that was previously marked safe. The Rust-based context safety tracking incorrectly preserves name-based safety grants even after the variable name has been bound to a new, untrusted value.

Vulnerability Overview

The djust templating engine is a high-performance, reactive server-side rendering library designed for Django applications. It uses a Rust-powered backend implementation (comprising the djust_core and djust_templates crates) to compile and render templates quickly. To maintain compatibility with Django's safety markings, djust passes information about which variables have been marked as safe across the PyO3 foreign function interface boundary.

However, the mechanism used to track context safety properties was designed to key safety settings by variable name rather than using individual object instances. When standard Django templates wrap strings in SafeData subclasses, the djust engine registers the corresponding variable paths inside a flat security lookup collection. If an outer variable is marked safe, any inner shadow scope that rebinds that same variable name will inherit the safe designation.

This architectural design flaw exposes a cross-site scripting attack surface. When templates employ common shadowing structures such as nested loop scopes or with blocks, the safety metadata remains pinned to the key. This allows untrusted user inputs bound to the shadowed variable name to bypass escaping and render raw HTML directly to the client browser.

This vulnerability affects all releases of djust from version 1.0.0 up to and including version 1.1.1. The issue has been addressed in version 1.1.2 by introducing active safety-key revocation during scope binding operations.

Technical Root Cause Analysis

To understand the root cause of the vulnerability, we must examine the context management architecture in crates/djust_core/src/context.rs. The Context struct tracks safe variables using a HashSet containing String keys named safe_keys. When a Python string is marked safe via Django's mark_safe, its dictionary path is added to this set.

When rendering template nodes, the engine determines whether to escape a value by calling Context::is_safe with the variable's key path. If the path exists in safe_keys, the engine skips HTML sanitization. The vulnerability occurs because the engine handles variable rebinding by overwriting the context value map while leaving the safe_keys set unchanged.

This security bypass occurs across eight template binding structures. These include with assignments, for loops, tuple unpacking in loop iterations, template inclusions using with blocks, and custom assign tags. In each case, the safety grant associated with the key survives the shadowing operation, causing the new, untrusted value to render without escaping.

Vulnerable vs. Patched Code Analysis

Before the patch, the template renderer in crates/djust_templates/src/renderer.rs updated variable values in shadow scopes using Context::set, which did not affect the safe_keys HashSet:

// Vulnerable update path in crates/djust_templates/src/renderer.rs
new_context.set(var_name.clone(), value);

To resolve this issue, the maintainers implemented Context::bind in crates/djust_core/src/context.rs. This method revokes the safety grant of the shadowed variable and any of its dotted-path descendants before binding the new value:

impl Context {
    // Safe binding method introduced in v1.1.2
    pub fn bind(&mut self, name: String, value: Value) {
        self.revoke_safe_subtree(&name);
        self.set(name, value);
    }
 
    // Revokes safety designations for the key and all nested paths
    pub fn revoke_safe_subtree(&mut self, key: &str) {
        if self.safe_keys.is_empty() {
            return;
        }
        self.safe_keys.remove(key);
        let prefix = format!("{}.", key);
        self.safe_keys.retain(|k| !k.starts_with(&prefix));
    }
}

For loop constructs ({% for %}), calling revoke_safe_subtree inside the loop body would degrade performance to O(N * M) complexity, where N is the loop count and M is the size of safe_keys. To avoid this, the fix hoists the revocation step out of the loop body:

// Optimized loop initialization in crates/djust_templates/src/renderer.rs
let mut ctx = context.clone();
for var_name in var_names {
    ctx.revoke_safe_subtree(var_name);
}

This optimization strips safe keys from the context once before starting the loop iterations, maintaining template rendering speed while preventing safe-key inheritance.

Exploitation Methodology & Proof of Concept

An attacker can exploit this vulnerability by targeting template components that shadow variables that are marked safe in the parent view context. This requires the application to expose an endpoint where input can be passed into a shadowed template variable.

Consider an application where a Django view marks a variable named 'p' as safe to output trusted HTML. If the associated template subsequently binds user input to 'p' within an inner block, the input inherits the safe marking of the outer variable:

{% with p=request.GET.q %}
  <div class="user-container">
    {{ p }}
  </div>
{% endwith %}

If an attacker targets this endpoint with a payload containing malicious HTML or JavaScript, the template engine skips escaping and renders the payload directly into the HTTP response. When the response is loaded, the victim's browser processes and executes the injected script:

<div class="user-container">
  <img src=x onerror=alert(document.domain)>
</div>

This allows the attacker to execute arbitrary scripts in the victim's browser, enabling session hijacking, CSRF bypass, and unauthorized actions within the application.

Impact Assessment

This vulnerability poses a significant risk to applications using the djust template library. Based on CVSS v3.1 metrics, the security impact is assessed at a High severity level with a score of 8.2 (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N).

The attack vector is network-based (AV:N) and requires low complexity (AC:L) to execute. It requires no authentication privileges (PR:N) but does require interaction from a victim (UI:R), such as clicking a link containing the exploit payload. The impact scope is changed (S:C) because the vulnerability allows code execution to migrate from the server's templating context to the victim's browser session.

Successful exploitation can result in a high loss of confidentiality (C:H) as attackers can steal session tokens and sensitive data. It also causes a low loss of integrity (I:L) because attackers can modify the structure of the rendered web page. The vulnerability is classified under CWE-79 (Improper Neutralization of Input During Web Page Generation).

Remediation & Patch Completeness

The recommended remediation is upgrading the djust library to version 1.1.2 or higher. This release integrates safe context bindings across all template rendering pathways, ensuring safety grants do not persist past shadow scopes.

If you cannot update the library immediately, you can mitigate the vulnerability by reviewing your templates. Ensure that no variable names marked safe in your Django views are shadowed inside with, for, or include blocks. Using unique, non-overlapping names for safe-marked variables and user-controlled variables will prevent safe-key inheritance.

Additionally, you can deploy Web Application Firewall rules to block common XSS payloads at the network boundary. Rules should target script tags, execution hooks like onerror=, and JavaScript protocols in URL parameters. However, these signatures should be used as a defense-in-depth measure and not as a replacement for the library update.

Official Patches

djust-orgOfficial Release v1.1.2 containing safety-key revocation logic.

Technical Appendix

CVSS Score
8.2/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N

Affected Systems

djust-org/djust (Python/Rust template library)

Affected Versions Detail

Product
Affected Versions
Fixed Version
djust
djust-org
>= 1.0.0, <= 1.1.11.1.2
AttributeDetail
CWE IDCWE-79
Attack VectorNetwork (AV:N)
CVSS v3.18.2 (High)
Exploit StatusPoC
KEV StatusNot Listed
ImpactCross-Site Scripting (XSS)

MITRE ATT&CK Mapping

T1059.007Command and Scripting Interpreter: JavaScript
Execution
T1189Drive-by Compromise
Initial Access
T1204.002User Execution: Malicious Link
Lateral Movement
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The software does not neutralize or incorrectly neutralizes user-controlled input before it is placed in output that is used as a web page.

Known Exploits & Detection

GitHubIntegration and regression tests demonstrating the exploit via template bindings.

Vulnerability Timeline

Release of version 1.1.1, resolving other safety defects.
2026-08-29
Discovery and patch verification of GHSA-XJW9-38CR-6372.
2026-08-30
Version 1.1.2 released on the 1.1 maintenance branch, completely resolving the binding grant leak.
2026-08-30

References & Sources

  • [1]GHSA-XJW9-38CR-6372 Advisory Database entry
  • [2]djust Release v1.1.2
  • [3]GitHub Patch Comparison
  • [4]Raw Git Diff (Plaintext Patch)

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 2 hours ago•CVE-2026-9639
6.5

CVE-2026-9639: Authenticated Denial of Service via Nil-Pointer Dereference in Canonical LXD Custom Volume Backup Import

CVE-2026-9639 (GHSA-j93m-3j9p-m5m8) is a null pointer dereference vulnerability in Canonical LXD affecting versions 5.0.0 through 5.21.4 and 6.0 through 6.8. The flaw resides in the (*lxdBackend).CreateCustomVolumeFromBackup method within lxd/storage/backend_lxd.go. An authenticated attacker with the can_create_storage_volumes permission can upload a crafted custom volume backup tarball that omits the expires_at field on a snapshot entry, triggering an unhandled SIGSEGV panic and terminating the LXD daemon.

Amit Schendel
Amit Schendel
5 views•9 min read
•about 3 hours ago•CVE-2026-33050
8.8

CVE-2026-33050: OS Command Injection in GeoNode Vector Upload Handler

An operating system command injection vulnerability (CWE-78) exists in GeoNode versions prior to 5.1.0. The vulnerability occurs in the vector upload processing pipeline when handling user-supplied geospatial files. By supplying a crafted layer name containing shell metacharacters, an authenticated attacker with basic data upload privileges can execute arbitrary commands on the underlying server or container hosting the GeoNode application and Celery worker processes.

Alon Barad
Alon Barad
5 views•9 min read
•about 4 hours ago•CVE-2026-46429
5.5

CVE-2026-46429: Unrestricted File Upload and Validation Bypass in GeoNode

GeoNode versions prior to 5.0.3 contain an unrestricted file upload vulnerability (CWE-434) within the document and dataset ingestion architecture. Authenticated low-privileged users can bypass upload validation via direct REST API interactions, file extension masquerading, metadata mutation via PATCH requests, or malicious archive submissions. This allows attackers to store and serve dangerous file types, alter on-disk file references, or trigger path traversal and resource exhaustion during archive extraction.

Amit Schendel
Amit Schendel
5 views•10 min read
•about 5 hours ago•CVE-2026-55649
6.3

CVE-2026-55649: Stored Cross-Site Scripting in GeoNode Document Metadata Abstract Field

CVE-2026-55649 is a stored Cross-Site Scripting (XSS) vulnerability in GeoNode versions prior to 5.0.3. The flaw exists because document abstract metadata fields are ingested via the metadata management pipeline and stored in the backend database without HTML sanitization or input neutralization. An authenticated attacker with privileges to create or edit document metadata can inject arbitrary HTML and JavaScript payloads into these fields. When another user, such as an administrator, views the affected document page or catalog listing, the unencoded payload is rendered into the Document Object Model (DOM) and executes within the victim's browser session.

Amit Schendel
Amit Schendel
7 views•9 min read
•about 6 hours ago•GHSA-QX75-2P3R-PWM5
7.7

CVE-2026-55622: Cross-Project Instance Copy Authorization Bypass in Canonical LXD and LXC Incus

CVE-2026-55622 (GHSA-qx75-2p3r-pwm5) is an improper access control vulnerability (CWE-284) in Canonical LXD and LXC Incus (tracked as GHSA-c9f5-j9c3-mhrg). In multi-tenant deployments utilizing project-based isolation, the REST API handler for instance creation via POST /1.0/instances verifies that the authenticated user has authorization in the destination project specified by the query parameter, but fails to verify whether the user holds read or view permissions for the source instance when executing a copy operation across projects. Consequently, an authenticated client restricted to a single project can clone instances or snapshots from unauthorized projects into their own project, resulting in complete disclosure of the target instance filesystem and embedded credentials.

Amit Schendel
Amit Schendel
6 views•11 min read
•about 7 hours ago•GHSA-7MR3-28H5-M5VX
7.7

GHSA-7mr3-28h5-m5vx: Authorization Bypass and Cross-Project Volume Copy in Canonical LXD

An authorization bypass vulnerability in Canonical LXD (tracked as GHSA-7mr3-28h5-m5vx and CVE-2026-55621, and as GHSA-64f3-v33m-w89f in Linux Containers Incus) allows an authenticated user with restricted project access to copy custom storage volumes and volume snapshots from unauthorized projects. The flaw resides in the storagePoolVolumesPost REST API handler, which verifies permissions on the destination project but fails to check whether the caller holds view entitlements on the source project or volume specified in the request body.

Alon Barad
Alon Barad
5 views•10 min read