Register for the AI for Security Summit: Join Figma, Perplexity & Wiz

CVE-2024-21520
Python vulnerability analysis and mitigation

Overview

A Cross-site Scripting (XSS) vulnerability was discovered in djangorestframework versions prior to 3.15.2. The vulnerability (CVE-2024-21520) exists in the break_long_headers template filter due to improper input sanitization before splitting and joining with tags. The issue was disclosed on June 13, 2024, and affects the Django REST framework package (Snyk).

Technical details

The vulnerability occurs in the break_long_headers template filter used in the rest_framework/base.html template file by APIView. The issue stems from unsanitized user input being processed by the template filter before splitting and joining with tags. The vulnerability has been assigned a CVSS v4.0 base score of 5.3 (Medium) and CVSS v3.1 base score of 6.1 (Medium). The vulnerability is classified as CWE-79: Improper Neutralization of Input During Web Page Generation (Snyk).

Impact

If exploited, this vulnerability could allow attackers to execute cross-site scripting attacks through the manipulation of header values. The impact primarily affects the integrity and confidentiality of the application with limited scope. The vulnerability could potentially be used to steal cookies, hijack user sessions, expose sensitive information, or deliver malware (Snyk).

Exploitability

The vulnerability requires network access and partial user interaction to exploit. A proof-of-concept exploit has been developed demonstrating the vulnerability through the manipulation of the Location header in API responses. The exploit probability is rated at 0.05% (19th percentile) according to the EPSS model (Snyk).

Mitigation and workarounds

The vulnerability has been fixed in djangorestframework version 3.15.2. Users should upgrade to this version or later to address the security issue. The fix involves properly escaping the header input before processing in the break_long_headers template filter (GitHub Commit).

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Debian

Fixed

bookworm

djangorestframework

Affected

bullseye

djangorestframework

Affected

sid

djangorestframework: 3.15.2-1

Fixed

trixie

djangorestframework: 3.15.2-1

Fixed

SourceThis report was generated using AI

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-66455CRITICAL9.8
  • Python logoPython
  • lmdeploy
NoYesSep 18, 2026
CVE-2026-63374CRITICAL9.3
  • Python logoPython
  • airflow-core-2
NoYesSep 18, 2026
CVE-2026-59163CRITICAL9.1
  • Python logoPython
  • mnemosyne-memory
NoYesSep 18, 2026
CVE-2026-33625HIGH8.8
  • Python logoPython
  • lmdeploy
NoYesSep 18, 2026
CVE-2026-64847MEDIUM6.8
  • Python logoPython
  • airflow-3
NoYesSep 18, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management