CVE-2026-53878
Django vulnerability analysis and mitigation

Overview

CVE-2026-53878 is an HTTP header injection vulnerability in Django's DomainNameValidator that fails to prohibit newline characters in domain names. Affected versions are Django 5.2 before 5.2.16 and Django 6.0 before 6.0.7; earlier unsupported series (5.0.x, 4.1.x, 3.2.x) were not evaluated but may also be affected. The vulnerability was reported by Bence Nagy and publicly disclosed on July 7, 2026. It carries a CVSS v3.1 score of 6.1 (Medium) and a CVSS v4.0 score of 5.3 (Medium) (GitHub Advisory, Django Security Releases).

Technical details

The root cause is improper neutralization of line delimiters (CWE-144) and CRLF sequences in HTTP headers (CWE-113). Django's DomainNameValidator does not strip or reject newline characters from domain name input; while CharField used in form fields does strip newlines, direct programmatic use of the validator does not. If an application passes a domain name value containing newlines directly into an HTTP response header outside of Django's form handling layer, an attacker can inject arbitrary HTTP headers. Django's own HttpResponse class is not directly vulnerable because it already prohibits newlines in headers, but custom application code that uses validated domain values in response headers is at risk (GitHub Advisory, Red Hat Bugzilla).

Impact

Successful exploitation enables an unauthenticated attacker to inject arbitrary HTTP response headers into affected applications, contingent on user interaction (e.g., a victim visiting a crafted URL). This can lead to session hijacking via cookie injection, cache poisoning, cross-site scripting through injected content-type or location headers, and credential theft. Confidentiality and integrity of the subsequent system (e.g., browser or proxy) are impacted at a low level; availability is not affected (GitHub Advisory, Django Security Releases).

Exploitability

There is no public proof-of-concept exploit and no evidence of in-the-wild exploitation as of the disclosure date (GitHub Advisory). The vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog. The EPSS score is approximately 0.217% (12th percentile), indicating a low near-term exploitation probability. Exploitation is not automatable and requires user interaction, limiting its practical attack surface to applications that directly use DomainNameValidator output in HTTP response headers outside of form handling (GitHub Advisory).

Exploitation steps

  1. Identify a vulnerable target: Find a Django 5.2.x (before 5.2.16) or 6.0.x (before 6.0.7) application that uses DomainNameValidator to validate user-supplied domain names and then places those values directly into HTTP response headers (e.g., a Location, Set-Cookie, or custom header) outside of Django's form handling.
  2. Craft a malicious domain name input: Prepare an input string containing a newline sequence (e.g., \r\n or \n) followed by an injected header, such as evil.com\r\nSet-Cookie: session=attacker_value; Path=/.
  3. Submit the payload: Deliver the crafted domain name to the application via a parameter, form field (if not using CharField), or API endpoint that passes the value through DomainNameValidator and into an HTTP response header.
  4. Trigger user interaction: Lure a victim user to interact with the crafted request (e.g., via a phishing link), causing the server to return the injected header in its HTTP response.
  5. Achieve objective: The injected header is processed by the victim's browser or an intermediate proxy, enabling session hijacking (via injected Set-Cookie), cache poisoning, or redirection attacks (GitHub Advisory, Red Hat Bugzilla).

Indicators of compromise

  • Network: HTTP responses from the Django application containing unexpected or duplicate headers (e.g., multiple Set-Cookie or Location headers) that were not explicitly set by application logic.
  • Logs: Web server or application access logs showing requests with domain name parameters containing URL-encoded newline sequences (%0d%0a, %0a, %0d) in fields processed by DomainNameValidator.
  • Application Behavior: Unexpected HTTP response headers observed in proxy or WAF logs that do not match the application's normal header set, particularly Set-Cookie, Location, or Content-Type headers with anomalous values.

Mitigation and workarounds

Upgrade Django to version 5.2.16 or later (for the 5.2 series) or 6.0.7 or later (for the 6.0 series), which include patches that prevent newline characters from being accepted by DomainNameValidator (Django Security Releases). For applications that cannot be immediately upgraded, sanitize any domain name values before placing them into HTTP response headers by stripping or rejecting newline characters (\r, \n) in application code. Users on unsupported Django versions (5.0.x, 4.1.x, 3.2.x) should evaluate their exposure and consider migrating to a supported release (Red Hat Bugzilla).

Community reactions

The Django project credited Bence Nagy for responsibly reporting the issue and published a coordinated security release on July 7, 2026 (Django Security Releases). Red Hat tracked the issue via Bugzilla and prepared patches for affected downstream packages (Red Hat Bugzilla). The vulnerability was also disclosed on the oss-security mailing list and picked up by Linux distribution security teams including openSUSE and Fedora, which issued their own advisories and package updates.

Additional resources


SourceThis report was generated using AI

Related Django vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-15830MEDIUM6.9
  • Django logoDjango
  • django
NoYesAug 04, 2026
CVE-2026-53877MEDIUM6.3
  • Django logoDjango
  • python3-django5-bash-completion
NoYesJul 07, 2026
CVE-2026-53878MEDIUM5.3
  • Django logoDjango
  • py3-django
NoYesJul 07, 2026
CVE-2026-48588LOW2.3
  • Django logoDjango
  • python-django
NoYesJul 07, 2026
CVE-2026-8404LOW2.3
  • Django logoDjango
  • python313-Django
NoYesJun 03, 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