MEDIUM6.1
PYSEC-2026-1304
Cross-site Scripting in djangorestframework
Quick fix
PYSEC-2026-1304 — djangorestframework: upgrade to the fixed version with the command below.
pip install --upgrade 'djangorestframework>=3.15.2'Details
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 <br> tags.
Are you affected?
Enter the version of the package you're using.
Affected packages
PyPI/djangorestframework
Introduced in:
0Fixed in: 3.15.2Fix
pip install --upgrade 'djangorestframework>=3.15.2'References
- https://nvd.nist.gov/vuln/detail/CVE-2024-21520[ADVISORY]
- https://github.com/encode/django-rest-framework/pull/9435[WEB]
- https://github.com/encode/django-rest-framework/commit/3b41f0124194430da957b119712978fa2266b642[WEB]
- https://github.com/encode/django-rest-framework[PACKAGE]
- https://github.com/encode/django-rest-framework/compare/3.15.1...3.15.2[WEB]
- https://security.snyk.io/vuln/SNYK-PYTHON-DJANGORESTFRAMEWORK-7252137[WEB]
- https://pypi.org/project/djangorestframework[PACKAGE]
- https://github.com/advisories/GHSA-gw84-84pc-xp82[ADVISORY]