CVE-2026-61597: Djust URLs Vulnerability

MODERATE
Advisory Identifier: GHSA-4mf4-73j6-mvrw
CWE-79
Published
Advisory Summary

CVE-2026-61597 is a MODERATE urls vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Djust libraries in the PyPI ecosystem. The issue involves urls in built-in component template tags. Remediation is available by upgrading affected packages to version 1.0.7.

CVE-2026-61597 at a Glance

CVE Identifier CVE-2026-61597
GHSA Identifier GHSA-4mf4-73j6-mvrw
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Djust
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix CVE-2026-61597

To remediate this vulnerability, upgrade all affected Djust dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

djust fixed: 1.0.7
pip install djust>=1.0.7
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show djust

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-61597, inspect your installed packages using pip:

pip show djust

Analyze the terminal output to locate any version of Djust in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.7), your application is affected.

Note: The pip show djust command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Djust, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Many djust built-in component template tags (`djust.components.templatetags.*`) render a developer/user-supplied URL into an `href` / `action` attribute, HTML-escaping it with `conditional_escape` but **never validating the URL scheme**. HTML escaping prevents attribute breakout but does not neutralize a `javascript:` URI (which needs no escapable characters), so a URL value of `javascript:alert(document.cookie)` lands verbatim in `<a href="javascript:alert(document.cookie)">` and executes in the victim's session on click. Affected sinks (executing href/action contexts; not exhaustive): breadcrumb (`djust_components.py:1535`; `_advanced.py:1999,2022`), `dj_nav` link/dropdown/brand (`djust_components.py:5632,5779,5807,5830`), citation URL (`:6936`), cookie-consent privacy link (`:8240`), error-page action (`_advanced.py:1728`), form `action` (`_forms.py:1239`). `<img src>` sinks are lower risk (javascript: does not execute via img src). No scheme validation exists anywhere in the component tags; a docstring at `djust_components.py:781` even acknowledges the `javascript:` risk without mitigating it. **Severity Medium:** XSS in the victim's authenticated session whenever an app renders one of these components with a URL sourced from user-controllable data; for `href` requires a click, worst case is the stored variant (URL persisted from one user, rendered to another). Conditional on developer usage, hence Medium rather than High. Reproduced: `breadcrumb(items=[{"label":"Home","url":"javascript:alert(document.cookie)"}])` emits `<a ... href="javascript:alert(document.cookie)">Home</a>`; `JaVaScRiPt:` case variant also passes; `https://` URLs are preserved. ### Patches Add a `safe_url()` helper that neutralizes non-allowlisted schemes (`javascript:`, `vbscript:`, `data:`) to `#` while preserving http/https/mailto/tel/relative/anchor URLs, and route every href/action/formaction/xlink:href sink through it (then HTML-escape). Add a regression + an audit_ast/system-check rule flagging un-routed URL-attribute interpolation. ### Workarounds Do not pass user-controllable URLs to the affected built-in component tags; pre-validate URL schemes in application code before binding them to component arguments. ### References Reproducer + finding writeup retained privately by the maintainer.

CVE-2026-61597 Affected Djust Versions

1 component(s)
Fixed Versions:
1.0.7
Product / Package Ecosystem Affected Versions Fixed Version
djust
PyPI
< 1.0.7
1.0.7

References

Frequently Asked Questions

What is CVE-2026-61597?
CVE-2026-61597 is a security vulnerability in Djust involving URLs in built-in component template tags under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Djust versions are affected?
Affected versions include releases prior to 1.0.7 across affected packages: djust.
What version fixes CVE-2026-61597?
Upgrading to 1.0.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is djust affected?
Yes, djust is affected in releases prior to 1.0.7. Upgrade your dependency to 1.0.7 or later.
What CWE is associated with CVE-2026-61597?
CVE-2026-61597 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check PyPI dependencies for CVE-2026-61597?
Run the dependency tree command: 'pip show djust'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-4mf4-73j6-mvrw",
  "modified" : "2026-09-16T21:50:53Z",
  "published" : "2026-09-16T21:50:53Z",
  "aliases" : [ "CVE-2026-61597" ],
  "summary" : "djust is vulnerable to stored/reflected XSS via javascript: URLs in built-in component template tags",
  "details" : "### Impact\nMany djust built-in component template tags (`djust.components.templatetags.*`) render a developer/user-supplied URL into an `href` / `action` attribute, HTML-escaping it with `conditional_escape` but **never validating the URL scheme**. HTML escaping prevents attribute breakout but does not neutralize a `javascript:` URI (which needs no escapable characters), so a URL value of `javascript:alert(document.cookie)` lands verbatim in `<a href=\"javascript:alert(document.cookie)\">` and executes in the victim's session on click.\n\nAffected sinks (executing href/action contexts; not exhaustive): breadcrumb (`djust_components.py:1535`; `_advanced.py:1999,2022`), `dj_nav` link/dropdown/brand (`djust_components.py:5632,5779,5807,5830`), citation URL (`:6936`), cookie-consent privacy link (`:8240`), error-page action (`_advanced.py:1728`), form `action` (`_forms.py:1239`). `<img src>` sinks are lower risk (javascript: does not execute via img src). No scheme validation exists anywhere in the component tags; a docstring at `djust_components.py:781` even acknowledges the `javascript:` risk without mitigating it.\n\n**Severity Medium:** XSS in the victim's authenticated session whenever an app renders one of these components with a URL sourced from user-controllable data; for `href` requires a click, worst case is the stored variant (URL persisted from one user, rendered to another). Conditional on developer usage, hence Medium rather than High.\n\nReproduced: `breadcrumb(items=[{\"label\":\"Home\",\"url\":\"javascript:alert(document.cookie)\"}])` emits `<a ... href=\"javascript:alert(document.cookie)\">Home</a>`; `JaVaScRiPt:` case variant also passes; `https://` URLs are preserved.\n\n### Patches\nAdd a `safe_url()` helper that neutralizes non-allowlisted schemes (`javascript:`, `vbscript:`, `data:`) to `#` while preserving http/https/mailto/tel/relative/anchor URLs, and route every href/action/formaction/xlink:href sink through it (then HTML-escape). Add a regression + an audit_ast/system-check rule flagging un-routed URL-attribute interpolation.\n\n### Workarounds\nDo not pass user-controllable URLs to the affected built-in component tags; pre-validate URL schemes in application code before binding them to component arguments.\n\n### References\nReproducer + finding writeup retained privately by the maintainer.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "djust"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/djust-org/djust/security/advisories/GHSA-4mf4-73j6-mvrw"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/djust-org/djust"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/djust-org/djust/releases/tag/v1.0.7"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-09-16T21:50:53Z",
    "nvd_published_at" : null
  }
}