{"answers":{"affected":"2 open source packages ship an affected version, including djust.","exploited":"There is no known exploitation of GHSA-xjw9-38cr-6372 in the wild and no public exploit code.","fix":"Upgrade djust to 1.1.2 or later.","what":"GHSA-xjw9-38cr-6372 is a cross-site scripting vulnerability in djust, published on 17 Sep 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for GHSA-xjw9-38cr-6372 and fix it if it is affected.\n\nWhat it is: GHSA-xjw9-38cr-6372 is a cross-site scripting vulnerability in djust, published on 17 Sep 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.\nExploitation: There is no known exploitation of GHSA-xjw9-38cr-6372 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- djust (PyPI): affected all versions; fixed in 1.1.2\n- djust (PyPI): affected all versions; fixed in 1.1.2\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-xjw9-38cr-6372/ (Markdown: https://insights.sbomify.com/GHSA-xjw9-38cr-6372/index.md)","id":"GHSA-xjw9-38cr-6372","markdown":"https://insights.sbomify.com/GHSA-xjw9-38cr-6372/index.md","name":"GHSA-xjw9-38cr-6372","record":{"aliases":[],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["code_execution"],"network_reachable":"yes","non_default_config":false,"product_category":"Python web framework","requires_auth":"none","summary":"Attackers can execute arbitrary JavaScript via XSS by rebinding template variables that were previously marked as safe, affecting djust applications.","user_interaction":"required","vuln_class":"xss"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"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.\n\ndjust's context safety channel is keyed by **name**, not by value. Every bind copied the value and left the grant in place:\n\n```\nview marks   p = mark_safe('\u003cb\u003etrusted\u003c/b\u003e')\ntemplate     {% with p=user_input %}{{ p }}{% endwith %}\n\n  djust   '\u003cimg src=x onerror=alert(1)\u003e'          \u003c- executes\n  django  '\u0026lt;img src=x onerror=alert(1)\u0026gt;'\n```\n\n## Affected binds\n\nEight distinct shapes were live. All are fixed in 1.1.2:\n\n| shape | example |\n|---|---|\n| `{% with %}` rebinding a marked name | `{% with p=hostile %}{{ p }}{% endwith %}` |\n| `{% with %}` **descendant** of a rebound name | `{% with p=hostile %}{{ p.a }}{% endwith %}` |\n| `{% with %}` binding over a marked name | `{% with q=hostile %}{{ q }}{% endwith %}` |\n| `{% for %}` loop variable | `{% for p in hostiles %}{{ p }}{% endfor %}` |\n| `{% for %}` descendant | `{% for p in hostiles %}{{ p.a }}{% endfor %}` |\n| `{% for %}` tuple unpacking | `{% for k, v in rows %}{{ v }}{% endfor %}` |\n| `{% include … with %}` | `{% include \"c.html\" with q=hostile %}` |\n| assign tags | `{% … as x %}` |\n\nNo 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`.\n\n## Impact\n\nStored 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.\n\n## Patches\n\nFixed in **1.1.2**, and in 1.2.0 (`main`).\n\nThe 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.\n\n**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.\n\n## Workarounds\n\nBefore 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.\n\n## Credit\n\nFound 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.","ecosystems":["PyPI"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"djust: A template binding inherits a context safety grant it never earned (XSS)","id":"GHSA-xjw9-38cr-6372","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"PyPI","product":null,"products":[],"type":"xss","year":"2026"},"n_packages":2,"n_references":null,"packages":[{"ecosystem":"PyPI","fixed":["1.1.2"],"introduced":["0"],"last_affected":[],"package":"djust","purl":null,"source":"GHSA-xjw9-38cr-6372"},{"ecosystem":"PyPI","fixed":["1.1.2"],"introduced":["0"],"last_affected":[],"package":"djust","purl":"pkg:pypi/djust","source":"GHSA-xjw9-38cr-6372"}],"products":null,"published":"2026-09-17","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"Attackers can execute arbitrary JavaScript via XSS by rebinding template variables that were previously marked as safe, affecting djust applications.","url":"https://insights.sbomify.com/GHSA-xjw9-38cr-6372/"}