CVE-2025-26699: Django Denial-of-Service Vulnerability in Text Wrapping Functions
Summary
CVE-2025-26699: An issue was discovered in Django 5.1 before 5.1.7, 5.0 before 5.0.13, and 4.2 before 4.2.20. Affects django across 3 version ranges.
>= 4.2, < 4.2.20
>= 5.0, < 5.0.13
>= 5.1, < 5.1.7
Fixed in 4.2.20, 5.0.13 or 5.1.7, depending on the release line you run. How to fix ↓
Also tracked for
- django · Bitnami
- python-django · Debian:11
The same CVE-2025-26699 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It provides a robust set of features for building web applications, including an ORM, routing, templating, and security features. However, certain functions, such as django.utils.text.wrap() and the wordwrap template filter, can be exploited when handling excessively long strings, leading to potential denial-of-service attacks.
Vulnerability Detail
An issue was discovered in Django versions 5.1 before 5.1.7, 5.0 before 5.0.13, and 4.2 before 4.2.20. The vulnerability arises from the django.utils.text.wrap() method and the wordwrap template filter, which can be exploited with very long strings. This can lead to a denial-of-service condition, where the application may become unresponsive due to excessive resource consumption.
How To Fix
Latest published version: 6.1.2 as of 22 Oct 2026
pip install --upgrade "django==6.1.2"
Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.
If you can't move to the latest
The minimum fixed version depends on the release line you run.
-
>= 4.2, < 4.2.204.2.20pip install --upgrade "django==4.2.20" -
>= 5.0, < 5.0.135.0.13pip install --upgrade "django==5.0.13" -
>= 5.1, < 5.1.75.1.7pip install --upgrade "django==5.1.7"
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
As a temporary workaround, you can implement input validation to restrict the length of strings passed to the wrap() method and wordwrap template filter. For example, you can truncate any input string longer than a specified limit before processing it.
Conclusion
The vulnerability identified as CVE-2025-26699 poses a significant risk to applications using affected versions of Django. It is crucial to update to the latest patched versions to mitigate the risk of denial-of-service attacks. Implementing input validation can serve as a temporary workaround while updates are being applied.
See every vulnerability recorded for django →
FAQ
Django versions 5.1 before 5.1.7, 5.0 before 5.0.13, and 4.2 before 4.2.20 are affected.
The vulnerability allows for a potential denial-of-service attack when very long strings are processed by specific text wrapping functions.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
Implement input validation to limit the length of strings processed by the vulnerable functions as a temporary measure.
More details can be found in the advisory database at https://github.com/pypa/advisory-database/blob/main/vulns/django/PYSEC-2025-13.yaml.
Related vulnerabilities
Recent vulnerabilities recorded for django.