{"answers":{"affected":"3 open source packages ship an affected version, including djangorestframework.","exploited":"It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-21520 exists.","fix":"Upgrade djangorestframework to 3.15.2 or later.","what":"CVE-2024-21520 is a medium-severity cross-site scripting vulnerability in djangorestframework, published on 26 Jun 2024. 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 CVE-2024-21520 and fix it if it is affected.\n\nWhat it is: CVE-2024-21520 is a medium-severity cross-site scripting vulnerability in djangorestframework, published on 26 Jun 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.\nExploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-21520 exists.\n\nAffected packages and fixed versions:\n- djangorestframework (PyPI): affected all versions; fixed in 3.15.2\n- djangorestframework (PyPI): affected all versions; fixed in 3.15.2\n- djangorestframework (PyPI): affected all versions; fixed in 3.15.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/CVE-2024-21520/ (Markdown: https://insights.sbomify.com/CVE-2024-21520/index.md)","id":"CVE-2024-21520","markdown":"https://insights.sbomify.com/CVE-2024-21520/index.md","name":"CVE-2024-21520","record":{"aliases":["DEBIAN-CVE-2024-21520","GHSA-gw84-84pc-xp82","PYSEC-2026-1304","ROOT-APP-PYPI-CVE-2024-21520","UBUNTU-CVE-2024-21520","openSUSE-SU-2026:10115-1"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["code_execution"],"network_reachable":"yes","non_default_config":false,"product_category":"Django REST framework","requires_auth":"none","summary":"An attacker can execute arbitrary scripts in a victim's browser via improper sanitization in the break_long_headers template filter.","user_interaction":"required","vuln_class":"xss"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"snyk","cpe":[],"cvss":{"score":5.3,"severity":"medium","source":"cna","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:L/SI:L/SA:N/E:P","version":"4.0"},"cwes":[{"id":"CWE-79","name":"Improper Neutralization of Input During Web Page Generation"}],"description":"Versions of the package djangorestframework before 3.15.2 are vulnerable to Cross-site Scripting (XSS) via the break_long_headers template filter due to improper input sanitization before splitting and joining with \u003cbr\u003e tags.","ecosystems":["PyPI","openSUSE:Tumbleweed"],"exploits":{"exploitdb":0,"first_seen":"2024-05-26","github_poc":1,"max_poc_stars":0,"metasploit":0,"nuclei":0,"refs":[{"date":"2024-05-26T00:30:12Z","kind":"github_poc","ref":"https://github.com/ch4n3-yoon/CVE-2024-21520-Demo","stars":0,"title":"A demonstration of common XSS vulnerabilities in Django Rest Framework applications. This repository showcases intentionally vulnerable code to educate developers on identifying and mitigating XSS attacks in DRF-based projects. For educational purposes only."}],"tier":"weaponised"},"has_fix":true,"headline":"Cross-site Scripting in djangorestframework","id":"CVE-2024-21520","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"PyPI","product":null,"products":[],"type":"xss","year":"2024"},"n_packages":4,"n_references":3,"next":{"headline":"@discordjs/opus vulnerable to Denial of Service","id":"CVE-2024-21521"},"packages":[{"ecosystem":"PyPI","fixed":["3.15.2"],"introduced":["0"],"last_affected":[],"package":"djangorestframework","purl":null,"source":"GHSA-gw84-84pc-xp82"},{"ecosystem":"PyPI","fixed":["3.15.2"],"introduced":["0"],"last_affected":[],"package":"djangorestframework","purl":"pkg:pypi/djangorestframework","source":"GHSA-gw84-84pc-xp82"},{"ecosystem":"PyPI","fixed":["3.15.2"],"introduced":["0"],"last_affected":[],"package":"djangorestframework","purl":"pkg:pypi/djangorestframework","source":"PYSEC-2026-1304"},{"ecosystem":"openSUSE:Tumbleweed","fixed":["3.16.1-2.1"],"introduced":["0"],"last_affected":[],"package":"python-djangorestframework","purl":"pkg:rpm/opensuse/python-djangorestframework\u0026distro=openSUSE%20Tumbleweed","source":"openSUSE-SU-2026:10115-1"}],"prev":{"headline":"Arbitrary File Creation in opencart","id":"CVE-2024-21519"},"products":["djangorestframework"],"published":"2024-06-26","related":[],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CC BY 4.0","name":"PyPA Advisory Database","prefix":"PYSEC"},{"class":"attribution","licence":"CC BY 4.0","name":"SUSE","prefix":"openSUSE"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"},{"class":"open","licence":"CC0","name":"PoC-in-GitHub"}],"ssvc":{"automatable":"no","exploitation":"poc","technical_impact":"partial"},"state":"PUBLISHED","updated":"2024-12-31","vendors":["n/a"]},"summary":"An attacker can execute arbitrary scripts in a victim's browser via improper sanitization in the break_long_headers template filter.","url":"https://insights.sbomify.com/CVE-2024-21520/"}